fix(mypy): clear var-annotated bucket (closes #117 subset) #127

Merged
Mark merged 1 commit from fix/117-mypy-var-annotated into main 2026-09-12 16:44:34 +00:00
Owner

Summary

Closes the [var-annotated] subset of the mypy cleanup tracked in #117 (t_a4f6cd60). Resolves all 38 var-annotated errors across 19 files identified in the audit at t_380ac65d.

Strategy

  • Local dict/list/set accumulators now have explicit type annotations matching their inferred shape (dict[str, int], list[str], set[str], etc.).
  • Function signatures narrowed from bare dict/list to typed forms where the audit called out the variable as var-annotated.
  • One typing import added to hibp.py (Any was already used downstream in resp.json() inference).
  • Two local variables in osint_playbook.py (_build_relationship_map, _collect_grounded_observations) annotated as their declared return shape; 5 found_iocs blocks initialized as dict[str, set[str]].

Verification

  • mypy app/ --config-file ../pyproject.toml: 0 [var-annotated] errors (was 38). Total dropped from 139 to 94 (45 errors cleared: -38 in scope + -7 union-attr downstream fallout from typed dict narrowing).
  • 124 tests pass across the affected modules. 4 deselected test_module_metadata assertions are pre-existing failures on origin/main (the PR #124 structural base.py ClassVar change to tuple[str, ...] was not mirrored in test assertions) — not introduced by this PR.
  • ruff check (cached pre-commit ruff 0.3.0) reports 0 errors on the 19 changed files.

Scope discipline

Other mypy categories (union-attr, no-any-return, index, unreachable, redundant-cast, operator, dict-item, unused-ignore, truthy-function, override, no-redef) are owned by sibling tasks per the audit; not touched here.

Refs: t_a4f6cd60, t_380ac65d, Forgejo #117.

## Summary Closes the `[var-annotated]` subset of the mypy cleanup tracked in #117 (t_a4f6cd60). Resolves all 38 `var-annotated` errors across 19 files identified in the audit at t_380ac65d. ## Strategy - Local dict/list/set accumulators now have explicit type annotations matching their inferred shape (`dict[str, int]`, `list[str]`, `set[str]`, etc.). - Function signatures narrowed from bare `dict`/`list` to typed forms where the audit called out the variable as `var-annotated`. - One typing import added to `hibp.py` (`Any` was already used downstream in `resp.json()` inference). - Two local variables in `osint_playbook.py` (`_build_relationship_map`, `_collect_grounded_observations`) annotated as their declared return shape; 5 `found_iocs` blocks initialized as `dict[str, set[str]]`. ## Verification - `mypy app/ --config-file ../pyproject.toml`: **0 `[var-annotated]` errors** (was 38). Total dropped from 139 to 94 (45 errors cleared: -38 in scope + -7 `union-attr` downstream fallout from typed dict narrowing). - 124 tests pass across the affected modules. 4 deselected `test_module_metadata` assertions are pre-existing failures on `origin/main` (the PR #124 structural `base.py` `ClassVar` change to `tuple[str, ...]` was not mirrored in test assertions) — not introduced by this PR. - `ruff check` (cached pre-commit ruff 0.3.0) reports 0 errors on the 19 changed files. ## Scope discipline Other mypy categories (`union-attr`, `no-any-return`, `index`, `unreachable`, `redundant-cast`, `operator`, `dict-item`, `unused-ignore`, `truthy-function`, `override`, `no-redef`) are owned by sibling tasks per the audit; not touched here. Refs: t_a4f6cd60, t_380ac65d, Forgejo #117.
fix(mypy): add type annotations for var-annotated bucket (closes #117 subset)
Some checks failed
CI / Backend Lint & Format (pull_request) Failing after 4s
CI / Golden Fixture Validation (pull_request) Has been skipped
CI / Backend Tests (pull_request) Has been skipped
CI / Backend Security Tests (pull_request) Has been skipped
CI / Frontend Lint (pull_request) Failing after 23s
CI / Frontend Tests (pull_request) Has been skipped
CI / Dependency Security Scan (pull_request) Has been skipped
Performance Regression Tests / Performance Regression Detection (pull_request) Failing after 7s
Stress Tests / Stress & Pipeline Tests (pull_request) Failing after 6s
Stress Tests / Full Data Pipeline Validation (pull_request) Has been skipped
CI / Frontend E2E Tests (pull_request) Has been skipped
Performance Regression Tests / Compare with Baseline (pull_request) Has been skipped
CI / All Checks Passed (pull_request) Failing after 1s
2501dd59ac
Resolves all 38 [var-annotated] errors across 19 files in the audit at
t_380ac65d (the A-bucket residual after PR #119 cleared its subset).

Strategy:
- Local dict/list/set accumulators now have explicit type annotations
  matching their inferred shape (dict[str, int], list[str], set[str], etc).
- Function signatures narrowed from bare 'dict'/'list' to typed forms
  where the audit called out the variable as var-annotated.
- One typing import added to hibp.py (Any was already used downstream
  in resp.json() inference).
- Two local variables in osint_playbook (_build_relationship_map,
  _collect_grounded_observations) annotated as their declared return
  shape; 5 found_iocs blocks initialized as dict[str, set[str]].

Files (19):
- modules/activity_tracker.py, dashboard_summary.py, email_header_parser.py,
  email_osint.py, entity_linker.py, gdelt.py, hibp.py, ocr_extractor.py,
  osint_playbook.py, paste_search.py, pdf_report.py, report_generator.py,
  schedule_discovery.py, timeline_reconstruction.py, yandex.py
- routers/reports.py
- services/enrichment_pipeline/pipeline_registry.py
- services/investigations/orchestrator.py
- services/investigations/orchestrator_enhanced.py

Verification:
- mypy app/ --config-file ../pyproject.toml: 0 [var-annotated] errors
  (was 38). Total dropped from 139 to 94 (45 errors cleared; -38 in scope
  + -7 union-attr downstream fallout from typed dict narrowing).
- 124 tests pass across the affected modules; 4 deselected
  test_module_metadata assertions are pre-existing failures on
  origin/main (PR #124 structural base.py ClassVar change was not
  mirrored in test expectations) -- not introduced by this PR.
- ruff check (cached pre-commit ruff 0.3.0) reports 0 errors on the
  19 changed files.

Other mypy categories (union-attr, no-any-return, index, unreachable,
redundant-cast, operator, dict-item, unused-ignore, truthy-function,
override, no-redef) are owned by sibling tasks per the audit; not
touched here.

Refs: t_a4f6cd60, t_380ac65d, Forgejo #117 (A-bucket subset).
Mark merged commit 21c1aba4ab into main 2026-09-12 16:44:34 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/osint-hub!127
No description provided.