Repository navigation
feat(devtools): topology drift dashboard - #455
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 55 minutes and 19 seconds. ⌛ 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 (6)
📝 WalkthroughWalkthroughThis PR introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as DevTools CLI
participant Cmd as render-topology-status
participant TopologyFile as topology-target.yaml
participant FileSystem as Realized Tree<br/>(polylogue/*.py)
participant Renderer as Dashboard Renderer
participant Output as topology-status.md
CLI->>Cmd: invoke with --check flag
Cmd->>TopologyFile: read topology projection
TopologyFile-->>Cmd: YAML structure with issues & targets
Cmd->>FileSystem: scan realized Python files
FileSystem-->>Cmd: set of realized file paths
Cmd->>Renderer: process rows with topology data
Renderer->>Renderer: compute per-issue metrics<br/>(cells, conflicts, pending)
Renderer-->>Cmd: rendered markdown body
Cmd->>Output: write dashboard with markers
Output-->>Cmd: write complete
alt --check mode
Cmd->>Output: compare existing vs rendered
alt mismatch or missing header
Cmd-->>CLI: return error code
else content matches
Cmd-->>CLI: return success
end
else normal mode
Cmd-->>CLI: return success
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
…ns (#456) ## Summary Fixes a projection-rule defect surfaced by the topology-status dashboard (PR #455). The rule was emitting `__init__.py` for any module whose name equaled the subpackage prefix exactly, which caused multiple modules to claim the same destination — 12 false-conflict rows in the dashboard. ## Problem `build_topology_projection.py:lib_target()` and `storage_target()` use a strip-prefix-then-stem rule. When the stem strips empty (e.g. module `session_payload` matches prefix `session_payload`), the rule defaulted to `__init__.py`. Two such modules in the same cluster collide: - `lib/session/__init__.py` claimed by `session_payload`, `session_summaries`, `session_profile` - `storage/runtime/__init__.py` claimed by `store_runtime` (the catch-all prefix) `devtools verify-topology` reports `conflicts: 12` and the dashboard shows them in its conflicts column. ## Solution New resolver: ```python def _resolve_target(name: str, sub: str, prefix: str) -> str: stem = name[len(prefix):] if not stem: # Module name == prefix; preserve full name to avoid colliding at __init__.py. return f"polylogue/{sub}{name}" if not stem.endswith(".py"): stem = stem + ".py" stem = stem.lstrip("_") if not stem or stem == ".py": return f"polylogue/{sub}{name}" return f"polylogue/{sub}{stem}" ``` After regen: `verify-topology --json` reports `conflicts: 0`. Dashboard column will read 0 once this and #455 are both merged. ## Verification ``` $ devtools build-topology-projection $ devtools verify-topology --json | jq '.counts' {"orphans": 0, "missing": 0, "conflicts": 0, "kernel_rule": 0, "tbd": 39} $ devtools verify --quick verify: all checks passed (incl. all 8 lints) ``` ## Related - #429 — projection lint pattern. - #455 — topology drift dashboard (sibling PR; conflicts column will read 0 after both merge). - #424 / #425 — refactors that consume the projection. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Phase 3 of #429. - devtools/render_topology_status.py: renders docs/topology-status.md from docs/plans/topology-target.yaml plus the realized polylogue/ tree. - Wired into devtools render-all so drift fails the generated-surface check. - docs/topology-status.md: checked-in dashboard with per-issue migration progress (cells, at-target, pending, conflicts), summary counts (stable / kernel / primitives / TBD), and the explicit TBD list. The dashboard makes structural-cohesion progress visible in the maintainer-facing docs without requiring anyone to run a lint locally. Each refactor PR (#403 / #413 / #414 / #420 / #424 / #425 / #426) updates this dashboard automatically as cells move. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
The dashboard now exists (rendered by render_topology_status.py in this PR), so the xfail flips to UNEXPECTED PASS in CI strict mode. Convert to a regular assert as the pattern dictates: each topology refactor's xfail flips to a normal test in the same PR that lands the refactor.
507f783 to
6828c33
Compare
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@devtools/render_topology_status.py`:
- Line 105: The Markdown line in the parts.append call that builds the summary
uses `**Realized polylogue/**/*.py**: ...` which produces broken bold runs;
update the string in the parts.append that references realized_targets so the
glob is not inside the bold markers—e.g., move the bolding to just the label and
wrap or escape the glob (use backticks around polylogue/**/*.py or escape the
inner asterisks) so the entire label renders correctly while still including
{len(realized_targets)}.
- Around line 147-160: When running the --check branch (args.check) the current
code uses existing.split(GENERATED_BEGIN, 1)[-1].split(GENERATED_END, 1)[0]
which silently falls back to the whole file if either GENERATED_BEGIN or
GENERATED_END is missing; update the args.check logic to first verify both
GENERATED_BEGIN and GENERATED_END are present in existing (e.g., using "if
GENERATED_BEGIN not in existing or GENERATED_END not in existing"), print a
clear error like "header markers missing" to stderr and return non-zero, and
only then extract existing_body and compare it to body so the failure mode is
actionable (refer to the existing variables args.check, existing,
GENERATED_BEGIN, GENERATED_END, and existing_body).
- Around line 37-68: Replace the duplicated hard-coded membership checks with
the existing NON_OWNER_TAGS constant inside render_dashboard and ensure no rows
are dropped silently by adding an unclassified list (e.g., unclassified:
list[dict[str, object]] = []) and appending any row that doesn't match
NON_OWNER_TAGS, target == "TBD", or owner.startswith("#"); then either include
the unclassified count in the dashboard output or assert that unclassified is
empty before finishing (update references to stable_count, kernel_count,
primitive_count, tbd, and by_owner accordingly).
- Around line 87-93: The current pending/at_target use cell["path"] and
misclassifies deletions and already-at-destination rows; change logic to derive
both from the realized set by checking the cell's target membership in
realized_targets: compute target_str = str(cell.get("target") or "") for each
cell, let at_target = sum(1 for cell in cells if target_str in realized_targets
and target_str) and pending = total - at_target (or explicitly sum of targets
not in realized_targets), replacing the existing pending/at_target lines
(referenced symbols: pending, at_target, realized_targets, cells, total). Also
change conflicts to count distinct duplicated targets by using a set
comprehension (referenced symbols: targets, conflicts) e.g. conflicts = len({t
for t in targets if t and targets.count(t) > 1}).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: d09aef0f-963e-4ca1-a9ba-b59a5dc46cf6
📒 Files selected for processing (6)
devtools/command_catalog.pydevtools/generated_surfaces.pydevtools/render_topology_status.pydocs/devtools.mddocs/topology-status.mdtests/unit/architecture/test_topology_invariants.py
| NON_OWNER_TAGS = {"stable", "kernel", "lib-root", "storage-root"} | ||
|
|
||
|
|
||
| def realized_paths() -> set[str]: | ||
| return {p.relative_to(ROOT).as_posix() for p in ROOT.glob("polylogue/**/*.py") if "__pycache__" not in p.parts} | ||
|
|
||
|
|
||
| def render_dashboard(rows: Iterable[dict[str, object]], realized: set[str]) -> str: | ||
| """Build the dashboard markdown body.""" | ||
| by_owner: dict[str, list[dict[str, object]]] = defaultdict(list) | ||
| tbd: list[dict[str, object]] = [] | ||
| stable_count = 0 | ||
| kernel_count = 0 | ||
| primitive_count = 0 | ||
|
|
||
| for row in rows: | ||
| owner = str(row.get("owner") or "") | ||
| target = str(row.get("target") or "") | ||
| if owner == "stable": | ||
| stable_count += 1 | ||
| continue | ||
| if owner == "kernel": | ||
| kernel_count += 1 | ||
| continue | ||
| if owner in {"lib-root", "storage-root"}: | ||
| primitive_count += 1 | ||
| continue | ||
| if target == "TBD": | ||
| tbd.append(row) | ||
| continue | ||
| if owner.startswith("#"): | ||
| by_owner[owner].append(row) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Dead constant and silently-dropped rows.
Two small hygiene items in the classification loop:
NON_OWNER_TAGS = {"stable", "kernel", "lib-root", "storage-root"}(L37) is unused; the loop hard-codes the same membership at L55–63. Either route the checks through the constant or drop it.- Any row whose
owneris neither in the non-owner tags, nor an issue tag (startswith("#")), nortarget == "TBD"is silently discarded. It contributes to none of the per-issue rows, none of the bucket counters, and theTotal declaredline — so the totals can quietly diverge from the YAML row count without any signal. Consider a finalelse: unclassified.append(row)branch and either surface the count or assert it's empty.
♻️ Sketch
-NON_OWNER_TAGS = {"stable", "kernel", "lib-root", "storage-root"}
+PRIMITIVE_TAGS = {"lib-root", "storage-root"}
@@
- if owner == "stable":
+ if owner == "stable":
stable_count += 1
continue
if owner == "kernel":
kernel_count += 1
continue
- if owner in {"lib-root", "storage-root"}:
+ if owner in PRIMITIVE_TAGS:
primitive_count += 1
continue
if target == "TBD":
tbd.append(row)
continue
if owner.startswith("#"):
by_owner[owner].append(row)
+ continue
+ # Surface anything the projection schema didn't anticipate.
+ unclassified.append(row)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| NON_OWNER_TAGS = {"stable", "kernel", "lib-root", "storage-root"} | |
| def realized_paths() -> set[str]: | |
| return {p.relative_to(ROOT).as_posix() for p in ROOT.glob("polylogue/**/*.py") if "__pycache__" not in p.parts} | |
| def render_dashboard(rows: Iterable[dict[str, object]], realized: set[str]) -> str: | |
| """Build the dashboard markdown body.""" | |
| by_owner: dict[str, list[dict[str, object]]] = defaultdict(list) | |
| tbd: list[dict[str, object]] = [] | |
| stable_count = 0 | |
| kernel_count = 0 | |
| primitive_count = 0 | |
| for row in rows: | |
| owner = str(row.get("owner") or "") | |
| target = str(row.get("target") or "") | |
| if owner == "stable": | |
| stable_count += 1 | |
| continue | |
| if owner == "kernel": | |
| kernel_count += 1 | |
| continue | |
| if owner in {"lib-root", "storage-root"}: | |
| primitive_count += 1 | |
| continue | |
| if target == "TBD": | |
| tbd.append(row) | |
| continue | |
| if owner.startswith("#"): | |
| by_owner[owner].append(row) | |
| PRIMITIVE_TAGS = {"lib-root", "storage-root"} | |
| def realized_paths() -> set[str]: | |
| return {p.relative_to(ROOT).as_posix() for p in ROOT.glob("polylogue/**/*.py") if "__pycache__" not in p.parts} | |
| def render_dashboard(rows: Iterable[dict[str, object]], realized: set[str]) -> str: | |
| """Build the dashboard markdown body.""" | |
| by_owner: dict[str, list[dict[str, object]]] = defaultdict(list) | |
| tbd: list[dict[str, object]] = [] | |
| stable_count = 0 | |
| kernel_count = 0 | |
| primitive_count = 0 | |
| for row in rows: | |
| owner = str(row.get("owner") or "") | |
| target = str(row.get("target") or "") | |
| if owner == "stable": | |
| stable_count += 1 | |
| continue | |
| if owner == "kernel": | |
| kernel_count += 1 | |
| continue | |
| if owner in PRIMITIVE_TAGS: | |
| primitive_count += 1 | |
| continue | |
| if target == "TBD": | |
| tbd.append(row) | |
| continue | |
| if owner.startswith("#"): | |
| by_owner[owner].append(row) | |
| continue | |
| # Surface anything the projection schema didn't anticipate. | |
| unclassified.append(row) |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/render_topology_status.py` around lines 37 - 68, Replace the
duplicated hard-coded membership checks with the existing NON_OWNER_TAGS
constant inside render_dashboard and ensure no rows are dropped silently by
adding an unclassified list (e.g., unclassified: list[dict[str, object]] = [])
and appending any row that doesn't match NON_OWNER_TAGS, target == "TBD", or
owner.startswith("#"); then either include the unclassified count in the
dashboard output or assert that unclassified is empty before finishing (update
references to stable_count, kernel_count, primitive_count, tbd, and by_owner
accordingly).
| pending = sum(1 for cell in cells if str(cell.get("path")) in realized_targets) | ||
| at_target = total - pending | ||
| title = ISSUE_TITLES.get(owner, "—") | ||
| # Conflicts: rows whose target collides with another row's target. | ||
| targets = [str(cell.get("target") or "") for cell in cells] | ||
| conflicts = len([t for t in targets if targets.count(t) > 1 and t]) | ||
| parts.append(f"| {owner} | {title} | {total} | {at_target} | {pending} | {conflicts} |") |
There was a problem hiding this comment.
At target / Pending semantics are computed from path, not target.
pending counts cells whose current path is still on disk, and at_target is then derived as total - pending. Two failure modes:
- A file deleted from the realized tree (no
path, notarget) is counted asat_targeteven though no migration occurred. - A row where
path == target(already at destination, but still owned by an issue) is counted aspending.
For an informational dashboard this is mostly cosmetic, but it can mask real progress and overstate completion late in a migration. Consider deriving both counts directly from the realized set:
🩹 Suggested logic
- total = len(cells)
- pending = sum(1 for cell in cells if str(cell.get("path")) in realized_targets)
- at_target = total - pending
+ total = len(cells)
+ at_target = sum(
+ 1 for cell in cells
+ if str(cell.get("target") or "") in realized_targets
+ )
+ pending = sum(
+ 1 for cell in cells
+ if str(cell.get("path")) in realized_targets
+ and str(cell.get("path")) != str(cell.get("target") or "")
+ )Also nit on L92: conflicts = len([t for t in targets if targets.count(t) > 1 and t]) counts cells participating in a conflict (e.g. 3 rows colliding on one target → conflicts = 3), not the number of distinct duplicated targets. If the column is meant to be "how many distinct target collisions exist", swap to len({t for t in targets if t and targets.count(t) > 1}).
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/render_topology_status.py` around lines 87 - 93, The current
pending/at_target use cell["path"] and misclassifies deletions and
already-at-destination rows; change logic to derive both from the realized set
by checking the cell's target membership in realized_targets: compute target_str
= str(cell.get("target") or "") for each cell, let at_target = sum(1 for cell in
cells if target_str in realized_targets and target_str) and pending = total -
at_target (or explicitly sum of targets not in realized_targets), replacing the
existing pending/at_target lines (referenced symbols: pending, at_target,
realized_targets, cells, total). Also change conflicts to count distinct
duplicated targets by using a set comprehension (referenced symbols: targets,
conflicts) e.g. conflicts = len({t for t in targets if t and targets.count(t) >
1}).
| parts.append( | ||
| f"- **Total declared**: {sum(len(v) for v in by_owner.values()) + stable_count + kernel_count + primitive_count + len(tbd)}" | ||
| ) | ||
| parts.append(f"- **Realized polylogue/**/*.py**: {len(realized_targets)} files declared") |
There was a problem hiding this comment.
Broken Markdown bold run in the summary line.
**Realized polylogue/**/*.py**: … contains four ** runs on one line. Most renderers parse this as <strong>Realized polylogue/</strong>/*.py**: …, leaving the trailing ** as literal asterisks and dropping the intended bolding of the whole label. You can see the artifact in the generated docs/topology-status.md L27. Escape the inner asterisks (or move them outside the bold span).
🩹 Proposed fix
- parts.append(f"- **Realized polylogue/**/*.py**: {len(realized_targets)} files declared")
+ parts.append(f"- **Realized `polylogue/**/*.py`**: {len(realized_targets)} files declared")Backticks contain the glob and prevent the ** runs from being interpreted as bold delimiters; the test regex \b\d+\s+files declared still matches.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| parts.append(f"- **Realized polylogue/**/*.py**: {len(realized_targets)} files declared") | |
| parts.append(f"- **Realized `polylogue/**/*.py`**: {len(realized_targets)} files declared") |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/render_topology_status.py` at line 105, The Markdown line in the
parts.append call that builds the summary uses `**Realized polylogue/**/*.py**:
...` which produces broken bold runs; update the string in the parts.append that
references realized_targets so the glob is not inside the bold markers—e.g.,
move the bolding to just the label and wrap or escape the glob (use backticks
around polylogue/**/*.py or escape the inner asterisks) so the entire label
renders correctly while still including {len(realized_targets)}.
| if args.check: | ||
| if not args.output.exists(): | ||
| print(f"render-topology-status: {args.output} missing", file=sys.stderr) | ||
| return 1 | ||
| existing = args.output.read_text(encoding="utf-8") | ||
| expected_header = "# Topology status\n\n" | ||
| if expected_header not in existing: | ||
| print(f"render-topology-status: {args.output} header missing", file=sys.stderr) | ||
| return 1 | ||
| existing_body = existing.split(GENERATED_BEGIN, 1)[-1].split(GENERATED_END, 1)[0].strip("\n") | ||
| if existing_body != body.strip("\n"): | ||
| print(f"render-topology-status: {args.output} out of sync", file=sys.stderr) | ||
| return 1 | ||
| return 0 |
There was a problem hiding this comment.
--check silently degrades when generated markers are missing.
existing.split(GENERATED_BEGIN, 1)[-1].split(GENERATED_END, 1)[0] falls back to the entire file when either marker is absent (split returns a single-element list and [-1] / [0] happily index it). The user then sees the generic "out of sync" message even though the real cause is a malformed/hand-edited file with no markers. Worth an explicit guard so the failure mode is actionable.
🩹 Proposed guard
- existing_body = existing.split(GENERATED_BEGIN, 1)[-1].split(GENERATED_END, 1)[0].strip("\n")
- if existing_body != body.strip("\n"):
+ if GENERATED_BEGIN not in existing or GENERATED_END not in existing:
+ print(
+ f"render-topology-status: {args.output} missing generated markers",
+ file=sys.stderr,
+ )
+ return 1
+ existing_body = existing.split(GENERATED_BEGIN, 1)[1].split(GENERATED_END, 1)[0].strip("\n")
+ if existing_body != body.strip("\n"):
print(f"render-topology-status: {args.output} out of sync", file=sys.stderr)
return 1📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if args.check: | |
| if not args.output.exists(): | |
| print(f"render-topology-status: {args.output} missing", file=sys.stderr) | |
| return 1 | |
| existing = args.output.read_text(encoding="utf-8") | |
| expected_header = "# Topology status\n\n" | |
| if expected_header not in existing: | |
| print(f"render-topology-status: {args.output} header missing", file=sys.stderr) | |
| return 1 | |
| existing_body = existing.split(GENERATED_BEGIN, 1)[-1].split(GENERATED_END, 1)[0].strip("\n") | |
| if existing_body != body.strip("\n"): | |
| print(f"render-topology-status: {args.output} out of sync", file=sys.stderr) | |
| return 1 | |
| return 0 | |
| if args.check: | |
| if not args.output.exists(): | |
| print(f"render-topology-status: {args.output} missing", file=sys.stderr) | |
| return 1 | |
| existing = args.output.read_text(encoding="utf-8") | |
| expected_header = "# Topology status\n\n" | |
| if expected_header not in existing: | |
| print(f"render-topology-status: {args.output} header missing", file=sys.stderr) | |
| return 1 | |
| if GENERATED_BEGIN not in existing or GENERATED_END not in existing: | |
| print( | |
| f"render-topology-status: {args.output} missing generated markers", | |
| file=sys.stderr, | |
| ) | |
| return 1 | |
| existing_body = existing.split(GENERATED_BEGIN, 1)[1].split(GENERATED_END, 1)[0].strip("\n") | |
| if existing_body != body.strip("\n"): | |
| print(f"render-topology-status: {args.output} out of sync", file=sys.stderr) | |
| return 1 | |
| return 0 |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@devtools/render_topology_status.py` around lines 147 - 160, When running the
--check branch (args.check) the current code uses
existing.split(GENERATED_BEGIN, 1)[-1].split(GENERATED_END, 1)[0] which silently
falls back to the whole file if either GENERATED_BEGIN or GENERATED_END is
missing; update the args.check logic to first verify both GENERATED_BEGIN and
GENERATED_END are present in existing (e.g., using "if GENERATED_BEGIN not in
existing or GENERATED_END not in existing"), print a clear error like "header
markers missing" to stderr and return non-zero, and only then extract
existing_body and compare it to body so the failure mode is actionable (refer to
the existing variables args.check, existing, GENERATED_BEGIN, GENERATED_END, and
existing_body).
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: da7b8f5c82
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds a generated “topology drift” dashboard to make architectural-cohesion progress visible in-repo, and wires it into the existing devtools render-all generated-surface checks.
Changes:
- Introduces
devtools render-topology-statusto renderdocs/topology-status.mdfromdocs/plans/topology-target.yaml+ the realizedpolylogue/tree. - Registers the new dashboard in the generated-surfaces pipeline (
render-all) and exposes it in the devtools command catalog/docs. - Updates the topology invariant test to stop
xfailand assert the dashboard doc exists.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
devtools/render_topology_status.py |
New renderer for the topology status dashboard markdown. |
devtools/generated_surfaces.py |
Adds topology-status to the generated surfaces registry so render-all --check enforces drift. |
devtools/command_catalog.py |
Adds the render-topology-status command spec to the devtools command registry. |
docs/topology-status.md |
New checked-in generated dashboard output. |
docs/devtools.md |
Documents the new generated-surface command. |
tests/unit/architecture/test_topology_invariants.py |
Converts the Phase 3 dashboard check from xfail to a passing assertion. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| pending = sum(1 for cell in cells if str(cell.get("path")) in realized_targets) | ||
| at_target = total - pending |
There was a problem hiding this comment.
pending/at_target are computed from whether the declared path exists in the realized tree, but verify-topology requires declared paths to match realized paths, so this will always mark every cell as pending (even after a cell is migrated). Migration progress should be derived from the projection fields (e.g., path == target means “at target”) or by checking target in realized explicitly.
| pending = sum(1 for cell in cells if str(cell.get("path")) in realized_targets) | |
| at_target = total - pending | |
| at_target = sum( | |
| 1 | |
| for cell in cells | |
| if ( | |
| str(cell.get("path") or "") == str(cell.get("target") or "") | |
| or str(cell.get("target") or "") in realized_targets | |
| ) | |
| ) | |
| pending = total - at_target |
| # Conflicts: rows whose target collides with another row's target. | ||
| targets = [str(cell.get("target") or "") for cell in cells] | ||
| conflicts = len([t for t in targets if targets.count(t) > 1 and t]) | ||
| parts.append(f"| {owner} | {title} | {total} | {at_target} | {pending} | {conflicts} |") |
There was a problem hiding this comment.
Conflict counting is currently scoped to targets within a single issue (cells) and uses targets.count(...) in a way that misses collisions between issues (the main kind you want to detect in the projection). Consider computing a global Counter of all non-TBD targets across the whole projection, then for each issue count how many of its cells have a target with global count > 1.
| "#426": "rationalize package-root layout and consolidate facade surface", | ||
| } | ||
|
|
||
| NON_OWNER_TAGS = {"stable", "kernel", "lib-root", "storage-root"} |
There was a problem hiding this comment.
NON_OWNER_TAGS is defined but not used. If it’s not part of an intended near-term follow-up, removing it would keep the module’s intent clearer.
…ns (#456) ## Summary Fixes a projection-rule defect surfaced by the topology-status dashboard (PR #455). The rule was emitting `__init__.py` for any module whose name equaled the subpackage prefix exactly, which caused multiple modules to claim the same destination — 12 false-conflict rows in the dashboard. ## Problem `build_topology_projection.py:lib_target()` and `storage_target()` use a strip-prefix-then-stem rule. When the stem strips empty (e.g. module `session_payload` matches prefix `session_payload`), the rule defaulted to `__init__.py`. Two such modules in the same cluster collide: - `lib/session/__init__.py` claimed by `session_payload`, `session_summaries`, `session_profile` - `storage/runtime/__init__.py` claimed by `store_runtime` (the catch-all prefix) `devtools verify-topology` reports `conflicts: 12` and the dashboard shows them in its conflicts column. ## Solution New resolver: ```python def _resolve_target(name: str, sub: str, prefix: str) -> str: stem = name[len(prefix):] if not stem: # Module name == prefix; preserve full name to avoid colliding at __init__.py. return f"polylogue/{sub}{name}" if not stem.endswith(".py"): stem = stem + ".py" stem = stem.lstrip("_") if not stem or stem == ".py": return f"polylogue/{sub}{name}" return f"polylogue/{sub}{stem}" ``` After regen: `verify-topology --json` reports `conflicts: 0`. Dashboard column will read 0 once this and #455 are both merged. ## Verification ``` $ devtools build-topology-projection $ devtools verify-topology --json | jq '.counts' {"orphans": 0, "missing": 0, "conflicts": 0, "kernel_rule": 0, "tbd": 39} $ devtools verify --quick verify: all checks passed (incl. all 8 lints) ``` ## Related - #429 — projection lint pattern. - #455 — topology drift dashboard (sibling PR; conflicts column will read 0 after both merge). - #424 / #425 — refactors that consume the projection. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
## Summary Phase 3 of #429. Renders `docs/topology-status.md` from the topology projection (`docs/plans/topology-target.yaml`) plus the realized `polylogue/` tree. The dashboard is checked-in markdown so structural-cohesion progress is visible to anyone reading docs, not just to those who run lints locally. ## Problem After Phase 1 of #429 landed (`devtools verify-topology` lint, plus xfail tests), structural drift was checkable only via local commands. Outsiders looking at the architecture-cohesion track had no single artifact telling them "of the seven topology refactors, here's how far each has gotten." ## Solution `devtools render-topology-status` builds a per-issue dashboard table: ``` | Issue | Title | Cells | At target | Pending | Conflicts | | --- | --- | --: | --: | --: | --: | | #403 | rationalize source and test module structure | 16 | 0 | 16 | 0 | | #414 | rationalize product ownership and package boundary | 8 | 0 | 8 | 0 | | #424 | group lib by domain cluster | 57 | 0 | 57 | 8 | | #425 | group storage by ownership domain | 63 | 0 | 63 | 4 | | #426 | rationalize package-root layout and consolidate facade surface | 15 | 0 | 15 | 0 | ``` Plus summary counts (stable / kernel / primitives / TBD) and the explicit TBD list. Wired into `devtools render-all` as a generated surface — drift fails `render-all --check`. Each refactor PR updates the dashboard automatically as cells move. ## Verification ``` $ devtools render-topology-status $ devtools render-all --check render-all: check topology-status ... sync OK $ devtools verify --quick verify: all checks passed (incl. all 8 lints) ``` ## Coordinates with Pattern complete for #429: 1. **Phase 1** (PR #438): projection + lints + xfail tests. 2. **Phase 2**: topology obligation family in `polylogue/proof/catalog.py` (still pending). 3. **Phase 3** (this PR): drift dashboard. ## Related - #429 — pattern source. - #432 — evidence-driven structural specification (Phase 2 substrate). - #401 — post-renewal consolidation umbrella. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added `devtools render-topology-status` CLI command to generate topology status dashboard. * Topology status dashboard displays per-issue migration progress, cell counts, target status, and conflict detection. * Dashboard automatically renders from target configuration and project codebase. * **Tests** * Resolved previously failing topology status documentation test. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
|
Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.
Only the rows listed above are dispositioned. Held findings remain open. |
Summary
Phase 3 of #429. Renders
docs/topology-status.mdfrom the topology projection (docs/plans/topology-target.yaml) plus the realizedpolylogue/tree. The dashboard is checked-in markdown so structural-cohesion progress is visible to anyone reading docs, not just to those who run lints locally.Problem
After Phase 1 of #429 landed (
devtools verify-topologylint, plus xfail tests), structural drift was checkable only via local commands. Outsiders looking at the architecture-cohesion track had no single artifact telling them "of the seven topology refactors, here's how far each has gotten."Solution
devtools render-topology-statusbuilds a per-issue dashboard table:Plus summary counts (stable / kernel / primitives / TBD) and the explicit TBD list.
Wired into
devtools render-allas a generated surface — drift failsrender-all --check. Each refactor PR updates the dashboard automatically as cells move.Verification
Coordinates with
Pattern complete for #429:
polylogue/proof/catalog.py(still pending).Related
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
devtools render-topology-statusCLI command to generate topology status dashboard.Tests