Repository navigation
feat(devtools): Gate the routes that reach a derived-tier rebuild - #5329
Conversation
polylogue-b5l AC5 requires that a derived tier is rebuilt only by ordinary daemon convergence and cited `devtools gate layering` as its check. Measured at 2b20817, that citation is false: an orchestration-only rebuild route added under polylogue/maintenance/ and awaiting pipeline.services.indexing.rebuild_index outside DaemonConverger left the layering gate green (count 0, exit 0). Its writer census fires on a new uncensused file executing its own DML, so both realistic shapes of a second build path pass it. `devtools gate rebuild-routes` censuses the other question: who can reach a rebuild entrypoint at all. It builds a function-grain AST call graph over polylogue/, reports every direct caller of a declared entrypoint and every entry root of the upward closure, and requires each to carry a route classification and a reason in docs/plans/rebuild-route-census.yaml. A declared entrypoint that resolves to no definition is refused, so a rename cannot empty the census, and `route: daemon_convergence` must be structurally provable from the declared stage seeds rather than asserted. AST is primary because devtools/verify_layering.py documents that grimp silently drops the 85 namespace-package modules in this checkout; an import-graph census would report every parser as reaching nothing. The substantive finding the census records: no rebuild entrypoint is reachable from make_default_convergence_stages at this head. Every declared route is demo seeding, daemon-hosted demo augmentation, or unreached -- including IndexService.rebuild_index, publish_session_profile, rebuild_archive_session_insights, rebuild_session_insights_async and InsightsRebuildActuator, whose only callers are tests. Verification: devtools test tests/unit/devtools/test_verify_rebuild_routes.py (13 passed, receipt 20260921T051448Z-focused-test-3817561-254c27dc); devtools verify --quick exit 0 with `gate rebuild-routes ... ok`; devtools render all --check exit 0, no "out of sync". Anti-vacuity was executed, not argued: the DML-free probe module above leaves `devtools gate layering` green (count 0, gate_passed true, exit 0) and reddens `devtools gate rebuild-routes` (count 1, rebuild_route_undeclared, exit 1) naming the route and its entrypoints. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Warning Review limit reachedNext included review available in 29 minutes. View limit detailsLimit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (4)
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ac88227f4b
ℹ️ 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".
) ## Summary Four live declared CLI routes were committing against the durable `source.db` with no daemon, and one recovery operation was unexecutable in every daemon state. Both directions are fixed. ## What was found at head — more than #5310 claimed `#5310`'s "the last CLI in-process writers" is false. Beyond the reported `_blob_publications.py:35-41`: - `_blob_integrity.py` runs `UPDATE raw_sessions` (`blob-reference-replace-from-source`) and `DELETE FROM blob_refs` (`blob-reference-prune-orphans`) All three call `require_write_lease` — **which is inert outside the daemon**, because enforcement is only armed there. The assertion returned `None` and the write proceeded **beside a live daemon**. And the inverse defect: `maintenance.blob-gc.recover` was **unexecutable in every daemon state**. `PendingBlobGCGenerationAbandonActuator._require_offline_writer_ownership` refused precisely when the daemon it requires was running. It was pinned as a `strict=True` xfail, which is why it never showed as red. ## Solution Four routes moved onto declared `DaemonAuthority.WRITE` / `DaemonFallback.NEVER` operations: `maintenance.blob-publications.abandon`, `maintenance.blob-refs.replace-from-source`, `maintenance.blob-refs.prune-orphans`, plus gc-recover unblocked. Side-fix for `5vps8` AC9: `_execute_named_mutation` dropped the executor's `receipt_ref`, so **every actuator behind it rendered `null` for an audited destructive mutation**. The envelope and `MutationResult` now carry it. For `l65ry`: no forwarding wrappers remain and the offline-writer guard is **deleted, not demoted**; preview commands stay read-only dry runs; `docs/internals.md` reconciled. ## The closure gate caught a real hazard Putting the blob-ref actuators beside their siblings would have added `storage/blob_integrity.py` to the derived closure — a ratchet violation. They live in a new `operations/maintenance_actuators.py` reached only from the out-of-closure handler module. **Net closure only shrinks**, by the eight files the offline-guard deletion released. `operations/specs.py` and `mutation_actuators.py` are **IN** — this moves the derived identity and must land before a rebuild starts, never during one. ## Verification - `devtools verify --quick` — exit 0, all gates including `schema-closure`, re-run **after rebase** onto current master - `devtools gate rebuild-routes` — **exit 0**, count 0. The lane could not run #5329's new gate before rebasing and reasoned it would pass; it was run here and does. - `devtools render all --check` — exit 0, zero `out of sync` - `devtools test`: maintenance CLI + operations declarations 172 passed / 6 failed; operations + kernel + blob-gc-durable-intent 510 / 3; daemon route + MCP envelopes 95 / 1; mutation-envelope consumers passed. **Every failure inherited and named** — six `test_migrate_tier_cli_*` on the documented version-floor cause in a file untouched here, two version-floor reds, and one recorded verbatim in the known-red file. **Four mutations executed**: reinstating the offline guard reproduces `requires the daemon to be stopped; a daemon writer lease is active`; reinstating each in-process write call makes the refusal test exit 0 with the row deleted or the manifest written. ## Residuals - **`5vps8` AC1 is advanced, not met.** A gate sweep found further writers this lane did not touch: `_blob_integrity.py:284,:429` carry docstrings reading "Always mutates the archive", `commands/backup.py:58` runs `backup_archive` in-process, and `commands/embed.py:895` opens `ops.db` writable. Do not treat this landing as discharging AC1. - **AC2/AC3 not done**: `pipeline/services/archive_ingest.py:199` is still `open_existing(read_only=False)`. `polylogue import` is routed, but `polylogue demo seed` → `seed_demo_archive` → `parse_sources_archive` still reaches it in-process, as does the `api/ingest.py` facade. Deleting that engine is a separate cohesive bead across ~20 test files. - **AC12 remains unsatisfiable** — no named baseline exists; no count was manufactured. - `ops maintenance operation-recovery --confirm` still writes `audit.db` in-process behind `offline_maintenance_block_reason` — a deliberate break-glass path whose premise is a dead daemon, so routing it is a design question. - `blob-disposition restore --active` lacks the guard `apply` has (verified: 0 vs 2 references), but `restore_plan_members` is additive filesystem spool restoration writing no SQLite — lower severity than the four routed here. - `test_runtime_operation_catalog_covers_the_current_runtime_paths` was **already red at base** for three unrelated drifts, proven via `git show HEAD:`; reconciled. Advances polylogue-5vps8 and polylogue-l65ry. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):
Resolving every thread listed; confirmed defects are fixed under the named bead. |
Summary
devtools gate rebuild-routes— a rebuild-entrypoint caller census over an ASTfunction-grain call graph of
polylogue/, declared indocs/plans/rebuild-route-census.yamland registered in the quick set. It reportsevery direct caller of a declared rebuild entrypoint and every entry root of the
upward closure, and requires each to carry a route classification plus a reason.
Problem
polylogue-b5lAC5 requires that a derived tier is rebuilt only by ordinarydaemon convergence, and cited
devtools gate layeringas its check. Thatcitation was false and the criterion had no enforcing check at head. Measured:
an orchestration-only second rebuild route left
gate layeringgreen at count 0;it only reddens for a new uncensused file bearing its own raw DML.
It answers the substantive question, not just the enforcement one
No second production build path exists at head (5404968) — and neither does
a first one. Closure is 17 functions over 5 entrypoints, and
closure ∩ forward-reach(make_default_convergence_stages)is empty.Per caller:
pipeline/services/indexing.py rebuild_index— only caller isIndexService.rebuild_index, which is re-exported frompolylogue.pipelinebutconstructed by no production caller, only
tests/unit/pipeline/test_indexing.py. Unreached.operations/mutation_actuators.py InsightsRebuildActuator.apply— nothingunder
polylogue/constructs it. Themaintenance.insights.rebuildoperationis served by
execute_insights_rebuild_operation→SessionInsightMaintenance.converge_part→
SessionProfileConvergenceOwner, which never touchesrebuild_session_insights_sync. Unreached.storage/derived/session/derivation.py publish_session_profile— zero callers;operations/session_profile_convergence.pyimportsSessionProfileDerivationfrom the same module, not this function. Unreached.
demo/seed.py— reached from CLIdemo seed|receipts|tour, and newly found,not in the starting inventory, from
operations/daemon_mutations.maintenance_demo_augmentand
daemon/http.py POST /api/demo/augment, both over the daemon's own archive root.rebuild_archive_session_insightsis also unreached — its docstring still claimspolylogue.apiandstorage.raw_convergencecall it; at head neither does.Verification
devtools test tests/unit/devtools/test_verify_rebuild_routes.py— 13 passeddevtools verify --quick— exit 0,gate rebuild-routes ... ok (8.7s)among 24 green gatesdevtools render all --check— exit 0,grep 'out of sync'= 0devtools schema closure— not applicable; the commit touchesdevtools/,docs/plans/andtests/only, no file underpolylogue/Anti-vacuity executed, not argued. Added an orchestration-only
maintenance/second_rebuild_route.py(grep -ci 'execute|insert|delete|update'= 0) awaiting
rebuild_index:gate layering --json→ count 0, gate_passed true, exit 0 — reproducing the measured holegate rebuild-routes→ count 1, rulerebuild_route_undeclared, diagnosisgate_semantic_violation, exit 1Probe removed, gate returns to count 0. A second probe with three hops and no
entrypoint named anywhere in the module also reddened it.
Design
.pyunderpolylogue/, with synthetic package trees plus one live-checkout assertion.verify_layering.py:250's precedent: grimp drops the 85namespace-package modules, so an import-graph census would report every parser
as reaching nothing. A test seeds a probe in a directory with no
__init__.pyand requires it be caught.
mutation_actuators.pyimports its rebuild inside
apply().rename cannot silently empty the census.
route: daemon_convergencemust be structurally provable from the declaredstage seeds. The forward walk is an under-approximation, so being inside it
proves reachability while being outside proves nothing — the token is therefore
refused rather than trusted. No entry claims it today.
Residuals
devtools gate layeringwithout--jsoncrashes withKeyError: 'observed'atverify_layering.py:1277._sqlite_degradation_findingsreturns entries keyed file/anchor/digest/removedwhile the plaintext printer reads
entry['observed']/entry['baseline']— astale per-file-count shape. 54 baseline entries no longer reproduce, so it fires
on every plaintext run today, masked because the gate table runs
--json. Leftunfixed to keep this commit cohesive. Filed separately.
daemon/http.py POST /api/demo/augmentreachesapply_demo_post_ingest_augmentationdirectly rather than through the declared
maintenance.demo.augmentdispatcher —a second entry into one augmentation inside the daemon. Recorded in the census reason.
candidates; the census pins them so none can quietly acquire one.
rebuild primitive was added without being declared. That needs a signature heuristic.
Closes polylogue-sbebh.
🤖 Generated with Claude Code
https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq