Skip to content

Run mypy on tests/ in CI too #39

Description

@shauryagangrade

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

  1. Change the CI step to mypy src/intent_alignment tests (or add a second step mypy tests).
  2. 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.
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions