chore: drop the vestigial obj_type parameter from _diff_element - #10229
Draft
ogenstad wants to merge 1 commit into
Draft
chore: drop the vestigial obj_type parameter from _diff_element#10229ogenstad wants to merge 1 commit into
ogenstad wants to merge 1 commit into
Conversation
`obj_type` was passed only to be used as a variable annotation (`local_element: obj_type = ...`), which is not a valid type expression, so both checkers had to be told to ignore the whole file for `valid-type` / `invalid-type-form`. The parameter had no other purpose.
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would auto-approve. Drops an unused private parameter and its type-annotation workaround, removing now-dead linter suppressions. No behavior change; internal typing cleanup with type checkers passing.
Re-trigger cubic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
BaseNodeSchema._diff_elementtook anobj_typeparameter that existed only to be used as avariable annotation:
A parameter is not a type expression, so both type checkers had to be told to ignore the whole file:
valid-typefor mypy,invalid-type-formfor ty. The parameter had no other purpose - it was neverread at runtime, and the annotation it produced was meaningless.
What changed
Dropped the parameter and its two call-site arguments, and removed the annotations. The locals are
now inferred from
get_func, which is what was effectively happening anyway.Suppressions retired:
valid-typeandno-redeffrom the mypyinfrahub.core.schema.basenode_schemaoverridebasenode_schema.pyfrom ty'sinvalid-type-formglobno-redefgoes too because the second loop re-annotated the same two locals; with the annotationsgone there is nothing to redefine.
What stayed the same
No behaviour change.
AttributeSchemaandRelationshipSchemaare still imported and usedelsewhere in the module, and the diff logic is untouched.
How to review
Two files. The
pyproject.tomldiff is the point of the change; the Python diff is 4 lines added and10 removed.
How to test
uv run invoke backend.lint # ruff + ty + mypy uv run pytest backend/tests/unitBoth pass on this branch: ty
All checks passed!, mypySuccess: no issues found in 1610 source files, ruff clean, 2233 unit tests pass.Impact & rollout
_diff_elementis private; no external callersChecklist