Skip to content

Migrate mypy ignore_errors blanket to per-line directives #34

@fede-kamel

Description

@fede-kamel

Problem

`pyproject.toml` declares mypy `strict` but applies `ignore_errors = true` to 10 module groups:

  • `locus.rag.*`
  • `locus.memory.*`
  • `locus.integrations.*`
  • `locus.streaming.*`
  • `locus.loop.*`
  • `locus.playbooks.*`
  • `locus.server.*`
  • `locus.core.reducers`, `locus.core.send`
  • `locus.multiagent.graph`
  • `locus.hooks.builtin.*`
  • `locus.reasoning.*`
  • `locus.tools.context`, `locus.tools.registry`, `locus.models.registry`
  • `locus.skills.*`
  • `locus.a2a.*`

These modules escape static checking entirely. There are also 309 `: Any` annotations across `src/` indicating over-promised unions.

Proposed migration

For each ignored module:

  1. Remove the `ignore_errors = true` block.
  2. Run mypy and triage failures.
  3. Replace bare `Any` with concrete types where possible (use `TypeAlias` for complex unions).
  4. Add `# type: ignore[error-code]` per-line for genuine SDK-stub gaps, with a comment explaining why.
  5. Cast external SDK responses explicitly at the boundary.

Acceptance

  • Zero `ignore_errors` blocks in `pyproject.toml`
  • `: Any` count under 100 (currently 309) in `src/`
  • Every `# type: ignore` has an error code and justification comment
  • mypy strict passes on full src tree

Effort

~1 week.

Source: 2026 best-in-class audit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions