Skip to content

chore: drop the vestigial obj_type parameter from _diff_element - #10229

Draft
ogenstad wants to merge 1 commit into
developfrom
pog-drop-obj-type-param
Draft

chore: drop the vestigial obj_type parameter from _diff_element#10229
ogenstad wants to merge 1 commit into
developfrom
pog-drop-obj-type-param

Conversation

@ogenstad

@ogenstad ogenstad commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Why

BaseNodeSchema._diff_element took an obj_type parameter that existed only to be used as a
variable annotation:

local_element: obj_type = get_func(self, name=name)

A parameter is not a type expression, so both type checkers had to be told to ignore the whole file:
valid-type for mypy, invalid-type-form for ty. The parameter had no other purpose - it was never
read 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-type and no-redef from the mypy infrahub.core.schema.basenode_schema override
  • basenode_schema.py from ty's invalid-type-form glob

no-redef goes too because the second loop re-annotated the same two locals; with the annotations
gone there is nothing to redefine.

What stayed the same

No behaviour change. AttributeSchema and RelationshipSchema are still imported and used
elsewhere in the module, and the diff logic is untouched.

How to review

Two files. The pyproject.toml diff is the point of the change; the Python diff is 4 lines added and
10 removed.

How to test

uv run invoke backend.lint          # ruff + ty + mypy
uv run pytest backend/tests/unit

Both pass on this branch: ty All checks passed!, mypy Success: no issues found in 1610 source files, ruff clean, 2233 unit tests pass.

Impact & rollout

  • Backward compatibility: _diff_element is private; no external callers
  • Performance: no change
  • Config/env changes: none beyond the two linter suppressions removed
  • Deployment notes: safe to deploy

Checklist

  • Tests added/updated
  • Changelog entry added
  • External docs updated
  • Internal .md docs updated
  • I have reviewed AI generated content

Review in cubic

`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.
@github-actions github-actions Bot added the group/backend Issue related to the backend (API Server, Git Agent) label Aug 12, 2026

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@codspeed-hq

codspeed-hq Bot commented Aug 12, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 13 untouched benchmarks


Comparing pog-drop-obj-type-param (323b39b) with develop (54bca7a)1

Open in CodSpeed

Footnotes

  1. No successful run was found on develop (2146176) during the generation of this report, so 54bca7a was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

group/backend Issue related to the backend (API Server, Git Agent)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant