Skip to content

Zero out remaining basedpyright targeted diagnostics - #33

Merged
Aztec03hub merged 1 commit into
mainfrom
fix-basedpyright-final-sweep
Jun 23, 2026
Merged

Zero out remaining basedpyright targeted diagnostics#33
Aztec03hub merged 1 commit into
mainfrom
fix-basedpyright-final-sweep

Conversation

@Aztec03hub

Copy link
Copy Markdown
Owner

Summary

Final basedpyright cleanup: drives all targeted diagnostic classes to ZERO across src/claude_comms and tests (274 → 0), with behavior-preserving changes only.

Targeted classes zeroed (before → after)

Class Before After
reportAttributeAccessIssue 87 0
reportArgumentType 76 0
reportUnusedParameter 51 0
reportOptionalMemberAccess 42 0
reportUnusedFunction 4 0
reportReturnType 4 0
reportUnnecessaryIsInstance 4 0
reportUnusedVariable 3 0
reportUnreachable 2 0
reportUnnecessaryComparison 1 0
Total targeted 274 0

What changed (behavior-preserving only)

  • Type-narrowing: assert x is not None before optional member access (reg.get(key).connections, .profile_status_*, .recipients, etc.); assert isinstance(block, TextContent) before .text on MCP content-block unions; assert isinstance(result, Panel) in the TUI bubble test helper.
  • Accurate annotations: yielding pytest fixtures retyped -> Iterator[RegistryStore]; test helpers narrowed strParticipantType (all callers pass valid literals); _bubble_panel -> Panel; an ASGI test wrapper widened to MutableMapping[str, Any].
  • PublishFn protocol fix: added an unused, defaulted retain: bool = False to mock publish callbacks so they match the PublishFn protocol (the protocol matches by parameter name, so callback param names were preserved).
  • pilot.app → typed local app across the TUI tests (same object, already typed ClaudeCommsApp) to resolve private-attribute access.
  • Per-line # pyright: ignore[...] only where a fix would otherwise change behavior: defensive runtime guards in source (isinstance/raise on already-typed params), @pytest.fixture(autouse=True) helpers reported unused, and intentional negative-test bad-value calls (type="robot", op="wat", None args).
  • Unused local callback params / tuple bindings renamed to _-prefixed; pytest fixture params kept their names with a def-line ignore (renaming would break injection).

No logic changes, no deleted live code. The MCP tools and all tests behave identically.

Out of scope (intentionally untouched)

Pre-existing project-wide type-inference noise — reportAny, reportUnknown*, reportExplicitAny, reportMissingParameterType, reportMissingTypeArgument, reportConstantRedefinition, reportDeprecated, reportImplicitStringConcatenation, and the other non-targeted error classes (reportImplicitRelativeImport, reportOptionalSubscript, etc.) — is unchanged (verified identical before/after).

Verification

  • .venv/bin/basedpyright src/claude_comms tests: targeted classes = 0 (baseline noise unchanged).
  • .venv/bin/ruff check clean; .venv/bin/ruff format --check clean.
  • .venv/bin/python -m pytest -q: 1467 passed.

🤖 Generated with Claude Code

… ignores + test type-narrowing)

Drives all targeted basedpyright classes to zero across src/claude_comms and
tests (274 -> 0): reportUnusedFunction/Parameter/Variable/Import, reportUnreachable,
reportArgumentType, reportAttributeAccessIssue, reportOptionalMemberAccess,
reportReturnType, reportUnnecessary*.

Behavior-preserving only: type-narrowing asserts, isinstance guards, accurate
return/param annotations, ParticipantType narrowing on test helpers, an added
unused defaulted retain param on mock publish callbacks to satisfy the PublishFn
protocol, and per-line pyright ignores on defensive runtime guards, autouse
fixtures, and intentional negative-test bad-value calls. No logic changes.

Baseline type-inference noise (reportAny/reportUnknown*/reportMissingTypeArgument
etc.) is intentionally out of scope and left unchanged.
@Aztec03hub
Aztec03hub merged commit 2514591 into main Jun 23, 2026
5 of 8 checks passed
@Aztec03hub
Aztec03hub deleted the fix-basedpyright-final-sweep branch June 23, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant