fix(mypy): clear Annotation-debt bucket for in-scope codes (closes #117) #118
No reviewers
Labels
No labels
agentic-osint
audit
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:preflight
blocked:verify-failed
bug
chore
deferred
enhancement
feature-request
in-progress
lint-baseline
lint-cleanup
needs-decompose
needs-triage
performance
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/osint-hub!118
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/annotation-tidy-t_5df1a1a4"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #117 — clears 165 mypy errors classified as Annotation-debt for in-scope error codes (
[misc],[arg-type],[valid-type]) per the per-error artifact att_32c522a2(workspace/home/b/.hermes/kanban/boards/fixit/workspaces/t_0c1a5bf7/mypy_classification.json).Sub-issue of #109 (umbrella mypy debt). Sibling to #116 (Real-bug bucket).
Fixes
1.
app/modules/base.py— ClassVar declaration (clears 158 [misc])EvidenceModuledeclaredname: str = "",description: str = "",requires_config: ClassVar[list[str]] = []with two instance variables and one class variable. EveryEvidenceModulesubclass redeclares them asClassVar[...]. mypy flagged 158 such redeclarations with[misc] Cannot override instance variable with class variable.Fix: declare all three as
ClassVar[...]in the base class. Single 3-line edit cascades across every module.2. Six
[arg-type]SQLAlchemyorder_bytyping gapsFix by
cast(ColumnElement[Any], <model column>)at the use site — runtime behavior is correct; the stubs disagree:app/services/investigations/state_machine.py:149—InvestigationCheckpoint.step_numberapp/services/investigations/async_executor.py:98—InvestigationTask.created_atapp/services/investigations/orchestrator_enhanced.py:327—EntityActionQueue.created_atapp/services/investigations/orchestrator_v3_llm.py:767—InvestigationStep.step_number(legacyQuery.order_byoverload)app/routers/investigations.py:861—InvestigationTask.created_atapp/routers/investigations.py:889—EntityActionQueue.created_atEach
cast(...)is the minimum annotation-only fix per the card body — no# type: ignore, no runtime change.3.
app/modules/registry.py:237—[valid-type]builtinanylist_module_details(cls) -> list[dict[str, any]]used the Python builtinany(a function) as a type annotation. Replace with the typingAnyand add it to the existingfrom typing import ...line.Out of scope
Per the parent card body's explicit "Stay within scope" clause:
[assignment],[return-value],[attr-defined],[call-arg]— entirely Real-bug bucket; owned by sibling card and issue #116.[var-annotated],[no-any-return],[index],[call-overload],[override]Annotation-debt rows — explicitly excluded by the card scope; need separate decomposition (return-type tightening, iterator-materialization patterns, SQLAlchemy overload handling).Verification
mypy app/ --config-file ../pyproject.tomltotal errorspytest tests/{test_base,test_registry,unit/test_module_*} -qpytest -k 'state_machine or async_executor or orchestrator or investigations'Why −11 R-bucket: mypy short-circuits on the first error per statement. Fixing an A-bucket error unmasks a sibling R-bucket error on the same or adjacent line. All unmasked errors were already in the artifact at their original (pre-fix)
(file, line)— they just shifted by +1 to +4 lines due to myimportadditions andcast(...)wrapping. No genuinely new R-bucket errors.Test plan
cd backend && python3.12 -m pytest tests/test_base.py tests/test_registry.py tests/unit/test_module_registry.py tests/unit/test_module_base.py— expect 77 pass.cd backend && python3.12 -m pytest tests/ -k 'state_machine or async_executor or orchestrator or investigations' --ignore=tests/integration --ignore=tests/performance --ignore=tests/security --ignore=tests/e2e— expect 48 pass, 4 skip.cd backend && mypy app/ --config-file ../pyproject.toml | grep -E '\[(misc|arg-type|valid-type)\]'— expect empty.Refs #109, #117
Superseded by #119, which is merged as
abdf87dand auto-closed #117.This PR could not be merged as-is: its head
fix/annotation-tidy-t_5df1a1a4@7e9a485was 15 commits behindmainand conflicted inbackend/app/modules/base.pyandbackend/app/services/investigations/orchestrator_enhanced.py. In both conflictsmainalready carried an equivalent-or-better version of the change (notablyrequires_config: ClassVar[tuple[str, ...]] = ()rather than the mutablelist[str] = []proposed here), so both were resolved in favour ofmain.The remaining non-redundant work from this branch — the
typing.Anyfix inmodules/registry.pyand fourorder_by(cast(ColumnElement[Any], ...))sites — was rebased onto currentmainand landed via #119. A new branch was used rather than force-pushing this one, so no history was rewritten here.Verification on the rebased branch (Python 3.12, per
requires-python = ">=3.12"): mypy 312 → 305 errors,ruff check .clean, and the full pytest suite produced an identical failure set toorigin/main(83 failed / 1700 passed / 9 skipped on both), confirming no regressions.Closing as superseded — no work is lost.
Pull request closed