Repository navigation
Closed
Labels
area:devtoolsDevtools and repo control-plane toolingphase:architectureArchitecture and design spinetype:featNew featuretype:testTests
Description
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:
- A maintainer looking for "the tests that own this module" can't infer the path.
- 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.pydevtools 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.pyhas 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
docs/plans/test-ownership.yamlseeded with the auto-derived mapping for the current tree.devtools/verify_test_ownership.pyexists, asserts manifest validity in under 5 seconds.- Wired into
devtools verify(full). - Each topology refactor (refactor: rationalize source and test module structure #403, refactor(lib): group lib by domain cluster #424, refactor(storage): group storage by ownership domain #425, refactor: rationalize package-root layout and consolidate facade surface #426) updates the manifest in the same PR as the production move.
Related
- feat(devtools): make architectural cohesion executable #429, feat(devtools): evidence-driven structural specification — cross-cut manifest, witness, dashboard #432, feat(devtools): declare and enforce inter-package layering rules #433 — pattern siblings.
- refactor(tests): split oversized contract suites #419 — oversized test suites; coordinates with the splits.
- refactor: rationalize source and test module structure #403, refactor(lib): group lib by domain cluster #424, refactor(storage): group storage by ownership domain #425, refactor: rationalize package-root layout and consolidate facade surface #426 — production moves whose test ownership this lint enforces.
- chore: track post-renewal consolidation and architectural cohesion #401 — post-renewal consolidation umbrella.
Metadata
Metadata
Assignees
Labels
area:devtoolsDevtools and repo control-plane toolingphase:architectureArchitecture and design spinetype:featNew featuretype:testTests
Activity
feat(devtools): make architectural cohesion executable (Phase 1 of #429…
feat(devtools): file-size budgets per package and module
feat(devtools): file-size budgets per package and module
feat(devtools): test-ownership manifest with import-resolution
feat(devtools): file-size budgets per package and module
feat(devtools): test-ownership manifest with import-resolution
feat(devtools): migration-completeness manifest
feat(devtools): test-ownership manifest with import-resolution
feat(devtools): test-ownership manifest with import-resolution (#450)
feat(devtools): migration-completeness manifest
feat(devtools): migration-completeness manifest (#451)
chore: delete one orphan re-export shim (#452)
feat(devtools): verify-cross-cuts lint (Phase 1 of #432)
feat(devtools): verify-cross-cuts lint (Phase 1 of #432) (#457)
feat(devtools): make architectural cohesion executable (Phase 1 of #429…
feat(devtools): test-ownership manifest with import-resolution (#450)
feat(devtools): migration-completeness manifest (#451)
chore: delete one orphan re-export shim (#452)
feat(devtools): verify-cross-cuts lint (Phase 1 of #432) (#457)