Skip to content

feat(devtools): test-ownership manifest #437

Closed

Description

@Sinity

Parent

Part of #401. Pattern application from #429. Anticipates failure mode of #403, #414, #420, #424, #425, #426 (production moves but tests don't).

Problem

When a production module moves (e.g. polylogue/lib/query_runtime.py → polylogue/lib/query/runtime.py per #424), its test files often stay put — tests/unit/lib/test_query_runtime.py lingers. Imports update mechanically, but the test-tree mirror of the production tree drifts.

This becomes painful in two ways:

  1. A maintainer looking for "the tests that own this module" can't infer the path.
  2. Coverage analysis is wrong: a missing test for the new module path looks like full coverage because the old test file still imports from the new location.

Target

# docs/plans/test-ownership.yaml
defaults:
  rule: "production at polylogue/<X>.py is owned by tests/unit/<X>/test_<X>.py or tests/unit/<parent>/test_<X>.py"

owners:
  - production: polylogue/lib/query/runtime.py
    tests:
      - tests/unit/lib/query/test_runtime.py
      - tests/unit/lib/query/test_runtime_props.py

shared:
  # files where the rule cannot apply (e.g. cross-cutting integration tests)
  - tests/integration/test_full_pipeline.py

devtools verify-test-ownership walks production, asserts each module has at least one declared test owner, asserts each declared test file exists, asserts no test file is unowned.

The rule is auto-derived: contributors only need an entry when the production-test mapping isn't obvious.

Why this matters

  • Production moves drag tests with them. Every refactor PR that moves production must update the manifest, which forces touching the test tree.
  • Coverage gaps surface. If polylogue/lib/query/runtime.py has no declared owner, it's an unmoved test or an untested module.
  • Refactor confidence. A maintainer can grep production: to find tests for a module without inferring path conventions.

Acceptance criteria

Related

Activity

  1. added
    type:feat
    phase:architecture
    area:devtools
    on Apr 26, 2026
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

    area:devtoolsphase:architecturetype:feattype:test

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions