Repository navigation
refactor(topology): classify structural gates as blocking vs advisory (#856) - #875
Conversation
Classify each topology/layering structural check as blocking architectural boundary, advisory placement hygiene, or generated-doc freshness. Keep blocking checks limited to durable architecture contracts: orphans, missing, conflicts, kernel-rule in verify-topology, and import-boundary violations in verify-layering. TBD placement cells stay warning-only (blocking only with --strict-tbd). blob_gc.py is already resolved (owner: storage-root, concrete target) — no longer TBD anywhere. Add tests for the chosen blocking/advisory classification covering all five finding classes and layering enforcement. Co-Authored-By: Claude Opus 4.7 <[email protected]>
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR formalizes the intended “gate classification” semantics for topology/layering tooling: which checks are blocking architectural contracts vs advisory hygiene vs generated-doc freshness/navigation.
Changes:
- Document
verify-topologyas blocking on orphans/missing/conflicts/kernel_rule, withTBDtreated as advisory unless--strict-tbd. - Document
verify-layeringas a blocking architectural boundary (import layering rules). - Add unit tests intended to validate blocking vs advisory behavior for topology (and partially for layering helpers).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
tests/unit/devtools/test_topology_gates.py |
Adds tests around verify-topology blocking/advisory behavior and some layering helper assertions. |
devtools/verify_topology.py |
Updates module documentation to explicitly classify blocking vs advisory findings and exit semantics. |
devtools/verify_layering.py |
Updates module documentation to describe the layering gate as a blocking architectural boundary. |
devtools/render_topology_status.py |
Updates module documentation to classify the rendered dashboard as a generated-doc freshness/navigation artifact. |
devtools/build_topology_projection.py |
Updates module documentation to clarify projection output as navigation, not proof. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Enforces the substrate-vs-surface import boundary: substrate packages | ||
| (storage, pipeline, sources, insights) must not import surface adapters | ||
| (cli, mcp, daemon, ui, rendering). This is a durable architecture contract, |
|
|
||
| This is a navigation/advisory artifact, not a blocking architectural gate. | ||
| The underlying structural contracts are enforced by ``verify-topology`` | ||
| (orphans, missing, kernel-rule) and ``verify-layering`` (import-boundary). |
| tbd — projection cells still marked TBD | ||
| (blocking only with --strict-tbd) | ||
|
|
||
| Exits 0 if everything passes, 1 if any blocking finding. |
| def test_layering_no_violations_passes(tmp_path: Path) -> None: | ||
| storage = tmp_path / "polylogue" / "storage" | ||
| storage.mkdir(parents=True, exist_ok=True) | ||
| (storage / "module.py").write_text("import os\nfrom polylogue.core import json\n", encoding="utf-8") | ||
|
|
||
| imports = verify_layering._collect_imports(storage, repo_root=tmp_path) | ||
| assert "polylogue.cli" not in imports.get("polylogue/storage/module.py", set()) | ||
|
|
||
|
|
| def test_layering_disallow_violation_detected(tmp_path: Path) -> None: | ||
| storage = tmp_path / "polylogue" / "storage" | ||
| storage.mkdir(parents=True, exist_ok=True) | ||
| (storage / "bad_importer.py").write_text("from polylogue.cli import click_app\n", encoding="utf-8") | ||
|
|
||
| cli = tmp_path / "polylogue" / "cli" | ||
| cli.mkdir(parents=True, exist_ok=True) | ||
| (cli / "click_app.py").write_text("", encoding="utf-8") | ||
|
|
||
| imports = verify_layering._collect_imports(storage, repo_root=tmp_path) | ||
| # from polylogue.cli import click_app -> module = "polylogue.cli" | ||
| assert "polylogue.cli" in imports.get("polylogue/storage/bad_importer.py", set()), "storage imports cli module" | ||
|
|
||
| rules: list[dict[str, Any]] = [ | ||
| { | ||
| "target": "polylogue/storage", | ||
| "description": "Storage substrate.", | ||
| "disallow": { | ||
| "from": ["polylogue/cli", "polylogue/mcp", "polylogue/daemon", "polylogue/ui", "polylogue/rendering"] | ||
| }, | ||
| } | ||
| ] | ||
|
|
||
| violations: list[dict[str, object]] = [] | ||
| for rule in rules: | ||
| target = str(rule["target"]) | ||
| target_dir = tmp_path / target | ||
| disallow_from = list(rule.get("disallow", {}).get("from", [])) | ||
| file_imports = verify_layering._collect_imports(target_dir, repo_root=tmp_path) | ||
| for file_rel, file_imports_set in file_imports.items(): | ||
| for imp in file_imports_set: | ||
| if not imp.startswith("polylogue"): | ||
| continue | ||
| for disallowed in disallow_from: | ||
| if verify_layering._package_matches(str(disallowed), imp): | ||
| violations.append({"file": file_rel, "import": imp, "disallowed": disallowed}) | ||
|
|
||
| assert len(violations) >= 1, "storage importing cli should produce violation" |
Closes #856. Topology / layering gates were undifferentiated: advisory placement output could be counted as serious verification evidence, blurring the line between durable architecture and bookkeeping hygiene. - Blocking gates: `verify-topology` orphans, missing, conflicts, kernel_rule; `verify-layering` substrate-vs- surface boundary. - Advisory gates: `verify-topology` TBD (blocking only with `--strict-tbd`); `verify-cluster-cohesion`; `verify-cross-cuts`. Not in default verify. - Generated freshness: `render-topology-status` checked via `render-all --check`. - Navigator (not a check): `build-topology-projection`. - 13 new tests in `tests/unit/devtools/test_topology_gates.py` pin the classifications so future edits cannot promote an advisory check into a blocker silently. - `polylogue/storage/blob_gc.py`: confirmed already resolved (`owner: storage-root`, target `polylogue/storage/blob_gc.py`). Closes #856
Closes #856. Topology / layering gates were undifferentiated: advisory placement output could be counted as serious verification evidence, blurring the line between durable architecture and bookkeeping hygiene. - Blocking gates: `verify-topology` orphans, missing, conflicts, kernel_rule; `verify-layering` substrate-vs- surface boundary. - Advisory gates: `verify-topology` TBD (blocking only with `--strict-tbd`); `verify-cluster-cohesion`; `verify-cross-cuts`. Not in default verify. - Generated freshness: `render-topology-status` checked via `render-all --check`. - Navigator (not a check): `build-topology-projection`. - 13 new tests in `tests/unit/devtools/test_topology_gates.py` pin the classifications so future edits cannot promote an advisory check into a blocker silently. - `polylogue/storage/blob_gc.py`: confirmed already resolved (`owner: storage-root`, target `polylogue/storage/blob_gc.py`). Closes #856
Summary
Classify each topology/layering structural check as blocking architectural boundary, advisory placement hygiene, or generated-doc freshness. Keep blocking checks limited to durable architecture contracts.
Problem
Topology/source structural checks were useful only when protecting real architectural boundaries. Without explicit classification, advisory placement output risked being counted as serious verification evidence.
Solution
Classification of each gate
verify-topologyorphansverify-topologymissingverify-topologyconflictsverify-topologykernel_ruleverify-topologyTBD--strict-tbd)verify-layeringverify-cluster-cohesionverify-cross-cutsrender-topology-statusrender-all --checkbuild-topology-projectionblob_gc.py resolution
polylogue/storage/blob_gc.pyis already resolved:owner: storage-rootwith concrete targetpolylogue/storage/blob_gc.py. Zero TBD cells in the current projection. This acceptance criterion was already satisfied by the current topology-target.yaml.Key decisions
verify-topologycontinues to fail only on orphans/missing/conflicts/kernel_rule — not on exact placement drift. This matches the "only fail on missing/orphaned/root-kernel violations" guidance.verify-layeringremains blocking — the substrate-vs-surface import boundary is real.Verification
Closes #856.