Skip to content

Fix typing errors for protocols#9058

Open
solababs wants to merge 2 commits intodevelopfrom
sb-27042026-fix-typing-for-protocols
Open

Fix typing errors for protocols#9058
solababs wants to merge 2 commits intodevelopfrom
sb-27042026-fix-typing-for-protocols

Conversation

@solababs
Copy link
Copy Markdown
Contributor

Why

CoreNode in protocols_base.py was defined as a @runtime_checkable Protocol. Every generated class in protocols.py inherits from it, making them Protocol subclasses too. mypy's type-abstract rule rejects Protocol classes as type[X] arguments — the pattern used throughout the codebase (kind=CoreNumberPool, schema=CoreAccountGroup, etc.)

The prior workaround was a blanket disable_error_code = ["type-abstract"] in pyproject.toml. This PR removes the suppression and fixes the root cause.

How to test

uv run invoke backend.mypy        # must pass with 0 errors, no type-abstract suppression
uv run invoke backend.test-unit

Checklist

  • I have reviewed AI generated content

@solababs solababs requested a review from a team as a code owner April 27, 2026 08:41
@github-actions github-actions Bot added the group/backend Issue related to the backend (API Server, Git Agent) label Apr 27, 2026
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 27, 2026

Merging this PR will not alter performance

✅ 12 untouched benchmarks


Comparing sb-27042026-fix-typing-for-protocols (7772c2c) with develop (517f745)

Open in CodSpeed

@solababs solababs force-pushed the sb-27042026-fix-typing-for-protocols branch from 3a7d899 to 777e628 Compare April 27, 2026 15:23
Comment thread backend/infrahub/core/protocols_base.py Outdated
@runtime_checkable
class CoreNode(Protocol):
class CoreNode:
_is_runtime_protocol: ClassVar[bool] = True
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.

does this line actually do anything?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This has been removed

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.

2 participants