Summary
Extend the CI type-check to include tests/ so test code stays type-consistent with the strict [tool.mypy] config.
Why
ci.yml runs mypy src/intent_alignment only (.github/workflows/ci.yml:32). The test suite, however, registers duck-typed providers (e.g. tests/unit/test_engine.py:39-45, tests/integration/test_edge_cases.py:68-80) that deliberately bypass EvidenceProvider, and fixtures use dict-typed contexts that evaluate()'s narrow AlignmentContext annotation would flag. Type-checking tests would have surfaced the mismatch tracked in the evaluate() typing issue earlier, and keeps the suite from silently drifting from the library's types.
Suggested approach
- Change the CI step to
mypy src/intent_alignment tests (or add a second step mypy tests).
- Fix the resulting errors in the least invasive way, e.g.:
- annotate duck-typed providers as
EvidenceProvider (they satisfy the interface) or add # type: ignore[no-redef]-style ignores only where a deliberate duck type is tested,
- loosen
evaluate() to AlignmentContext | dict[str, Any] (per the separate typing bug) or cast in tests,
- keep the existing
[tool.mypy] strictness for src/ unchanged.
- Optionally add a
tests/ section to [tool.mypy] with a slightly relaxed disallow_untyped_defs if that proves too noisy.
Acceptance criteria
mypy src/intent_alignment tests passes in CI and locally.
- Strictness for
src/ is unchanged.
Summary
Extend the CI type-check to include
tests/so test code stays type-consistent with the strict[tool.mypy]config.Why
ci.ymlrunsmypy src/intent_alignmentonly (.github/workflows/ci.yml:32). The test suite, however, registers duck-typed providers (e.g.tests/unit/test_engine.py:39-45,tests/integration/test_edge_cases.py:68-80) that deliberately bypassEvidenceProvider, and fixtures usedict-typed contexts thatevaluate()'s narrowAlignmentContextannotation would flag. Type-checking tests would have surfaced the mismatch tracked in theevaluate()typing issue earlier, and keeps the suite from silently drifting from the library's types.Suggested approach
mypy src/intent_alignment tests(or add a second stepmypy tests).EvidenceProvider(they satisfy the interface) or add# type: ignore[no-redef]-style ignores only where a deliberate duck type is tested,evaluate()toAlignmentContext | dict[str, Any](per the separate typing bug) or cast in tests,[tool.mypy]strictness forsrc/unchanged.tests/section to[tool.mypy]with a slightly relaxeddisallow_untyped_defsif that proves too noisy.Acceptance criteria
mypy src/intent_alignment testspasses in CI and locally.src/is unchanged.