Repository navigation
fix: Derive four drifted mirrors from the facts that own them - #5042
Conversation
The daemon's FTS5 tuning read a hand-maintained `_FTS_SURFACES` tuple whose comment pointed at a file that no longer exists (`fts_lifecycle.py` moved to `storage/fts/`). The list had already drifted: `blocks_command_trigram`, an FTS5 surface declared by the index tier and maintained by triggers on `blocks`, was absent from it, so neither the startup `automerge=0` pass nor the bounded periodic merge ever reached it. It kept FTS5's default automerge and paid unbounded inline segment merges on the live-ingest writer -- exactly the write amplification #1864 removed for the other two surfaces, and the heaviest path during a from-scratch rebuild. The surface set is now read from `sqlite_master` on the open connection, so the tier DDL that declares an FTS5 table is its sole owner. The presence checks fall out of the enumeration, and no new import edge is added. Anti-vacuity: `test_configure_covers_every_declared_fts5_surface` enumerates the FTS5 tables in the built schema and asserts every one of them is tuned to automerge=0. Declaring a new FTS5 surface moves the tuned set with no edit here; restoring the hand list makes it red on `blocks_command_trigram`. Verification: devtools test tests/integration/test_live_write_amplification.py -> PASSED exit=0 diagnosis=pytest_passed Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
…budget `AFFECTED_MAX_WORKERS` was a hand-set `4`: a second statement of how many pytest workers fit in `agentctl-pytest.slice`, restated beside the derived one instead of read from it. It had already drifted past the owner. An affected run occupies the same slice as the corpus run, and `worker_memory.width_within(PYTEST_SLICE_MEMORY_HIGH_MIB)` currently answers 3, so on an idle slice the *selective* run was admitted at 4 workers where the full corpus is held to 3 -- a peak of 4*2263 + 1075 = 10127 MiB against the 9830 MiB headroom budget that exists because a corpus run was already OOM-killed in this slice. Width is now `min(AFFECTED_POLICY_MAX_WORKERS, CORPUS_MAX_WORKERS)`: this module stays free to be stricter than memory allows, but can no longer claim more than the memory owner says fits, and a change to the slice budget moves it with no edit here. A third copy of the literal, `"max_workers": 4` in the admission payload test, now reads the constant. Anti-vacuity: `test_affected_width_never_exceeds_the_memory_owner` asserts the cap is at or below `CORPUS_MAX_WORKERS` and equals the minimum; restoring a hand-set literal above the corpus width makes it red. Verification: devtools test tests/unit/devtools/test_verification_admission.py -> PASSED exit=0 diagnosis=pytest_passed Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
`config paths` built its tier set by hand and listed five tiers: `audit` was missing. The consequences were wrong observable outcomes, not cosmetics. With `audit.db` absent, `missing_tiers` could not contain `audit`, so `final_shape_ready` was true, `storage_layout` reported `archive_complete`, and -- because `missing_backup_required` filters `BACKUP_REQUIRED_TIERS` through `missing_tiers` -- the `missing_backup_required_tier:audit` blocker could never fire and `archive_layout_ready` stayed true for an archive missing a durable, append-only tier. `archive_schema_ready` likewise skipped the audit tier's version check. This is the readiness signal an operator reads while standing up an archive from scratch. `archive_layout.py` exists because this exact truth had already been hand-written twice and drifted; its docstring says so. Membership is now read from `ARCHIVE_TIER_ORDER` (which derives from `ARCHIVE_TIER_SPECS`), the name->enum map is built from `ArchiveTier` itself, and the schema-ready check folds over the resolved tiers instead of a five-name literal. A fourth copy, `_ARCHIVE_TIERS` in the CLI test, now derives from the same owner. Anti-vacuity: the test fixture and its assertions are generated from `ARCHIVE_TIER_ORDER`, and `test_paths_json_reports_archive_layout_blockers` now asserts `missing_backup_required_tier:audit` is emitted and that `audit` appears in `missing_tiers`. Adding a tier to `ARCHIVE_TIER_SPECS` moves both the command and the test with no edit at either site; restoring the five-name literal makes them red. Verification: devtools test tests/unit/cli/test_paths.py -> PASSED exit=0 diagnosis=pytest_passed Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
Follow-up to the tier derivation: `ARCHIVE_TIER_ORDER` is `tuple[str, ...]` while `ArchiveLocation.active_tier` takes the `ArchiveTierName` literal, so the derived enumeration needs an explicit cast to keep `gate mypy` green. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
Three documentation facts were restated by hand beside their owners, and all three had already drifted. `docs/insights-rigor-matrix.md` named `rigor.py:list_rigor_contracts()` its source of truth in the second paragraph and then hand-wrote the rows anyway. It carried 11 of the registry's 13 contracts -- `command_shapes` and `tool_episodes` were absent entirely -- and listed the `threads` contract under `work_threads`, an insight type nothing in the codebase answers to, so a reader following the doc would ask for a name the registry rejects. Every bullet in a row turned out to be a projection of one contract field, so the matrix is now a generated block rendered by `devtools render insights-rigor-matrix` and covered by `devtools render all --check`. `docs/provider-origin-identity.md` enumerated "every current `Origin` token" in the same paragraph that tells the reader not to hand-maintain a second per-origin token list, and its list was missing `beads-issue`. `docs/data-model.md` carried the same 11-of-12 list. Both copies are deleted rather than corrected: the `Origin` enum owns the set, and `docs/agent-manual.md` already renders it from `origin_meanings()` under an import-time parity check. `docs/maintenance.md` also referred to `work_threads`; corrected to `threads`. Anti-vacuity: adding a contract to the rigor registry, or editing one's fields, now makes `devtools render all --check` report `insights-rigor-matrix` out of sync until it is regenerated -- the gate that the hand-written matrix was never subject to. The two origin lists can no longer drift because they no longer exist. Verification: devtools render all --check -> no "out of sync"; insights-rigor-matrix checked devtools verify --quick -> 15/15 gates ok Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 6 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 (12)
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 |
A deliberate sweep for facts stated by hand in more than one place. Four had
already drifted; two of those produce wrong observable outcomes on the
from-scratch rebuild path this campaign is about to run.
1. FTS5 automerge silently skipped a trigger-maintained table
Owner: the index-tier DDL.
polylogue/daemon/fts_automerge.pyhand-listed twosurfaces (
messages_fts,session_work_events_fts) behind a "must be kept insync" comment pointing at a file that no longer exists.
Drifted:
blocks_command_trigram— an FTS5 table onblocks— was missingfrom the list, so neither the startup
automerge=0pass nor the bounded periodicmerge ever reached it. It kept FTS5's default automerge and paid unbounded
inline segment merges on the live-ingest writer — exactly the write
amplification #1864 removed for the other two, on the heaviest path during a
from-scratch rebuild.
Now read from
sqlite_master; no new import edge.2.
config pathsreportedarchive_completefor an archive missingaudit.dbOwner:
ARCHIVE_TIER_SPECSviaarchive_layout.ARCHIVE_TIER_ORDER.Drifted:
cli/commands/paths.pylisted five of six tiers, omittingaudit—in two places (
tier_pathsand_TIER_ENUM_BY_NAME). Withaudit.dbabsent,final_shape_readywas true,storage_layoutsaidarchive_complete,archive_layout_readystayed true, andmissing_backup_required_tier:auditcould never fire — for a durable, append-only tier.
That is the readiness signal an operator reads while standing an archive up from
scratch. A fourth copy in the CLI test pinned the drift; it now derives too.
3. The affected-run worker cap exceeded the corpus cap in its own cgroup
Owner:
worker_memory.width_within(PYTEST_SLICE_MEMORY_HIGH_MIB).Drifted:
AFFECTED_MAX_WORKERS = 4against a derivedCORPUS_MAX_WORKERS = 3— admitting the selective run wider than the full corpus, peak 10,127 MiBagainst a 9,830 MiB headroom budget that exists precisely because a corpus run
was already OOM-killed in that cgroup. Now
min(policy, CORPUS_MAX_WORKERS); athird copy in the test reads the constant.
4. Three drifted doc facts
docs/insights-rigor-matrix.mddeclaredrigor.pyits source of truth and thenhand-wrote 11 of 13 contracts, omitting
command_shapes/tool_episodesandnaming
threadsaswork_threads— an insight type nothing answers to. Now agenerated surface under
render all --check.docs/provider-origin-identity.mdenumerated "every currentOrigintoken"inside the paragraph forbidding second token lists, and omitted
beads-issue;docs/data-model.mdcarried the same 11-of-12 list. Both copies deleted ratherthan corrected.
Anti-vacuity
test_configure_covers_every_declared_fts5_surfaceenumerates thebuilt schema's FTS5 tables and asserts each is at
automerge=0. Restoring thehand list goes red on
blocks_command_trigram— proven directly, not assumed.ARCHIVE_TIER_ORDER; theblocker test now asserts
missing_backup_required_tier:auditis emitted.Restoring the five-name literal goes red.
test_affected_width_never_exceeds_the_memory_ownerasserts the capis at or below
CORPUS_MAX_WORKERS; a literal above it goes red, and loweringthe slice moves the cap with no edit.
render all --checkreport itout of sync — a gate the hand-written matrix was never subject to.
Checked and agreeing, no change
pytest slice 12G ↔ Sinnix
runtime-defaults.nix(the sibling-repo drift is notpresent here); worker/controller peak constants;
polylogued14G/18G ↔memoryBudgetGiB; cloud worker width (4 copies);.agentctlpool names ↔ SinnixPOLICY_POOLS; version 0.3.0;requires-pythonacross 10 sites; the devtoolscatalog and
docs/devtools.md(genuinely generated); gate names; storage tierlists in
archive_identity.pyanddaemon/status.py;Origin↔ORIGIN_SPECS(import-time parity guard);
INSIGHT_REGISTRY↔_RIGOR_MATRIX.One false positive, deliberately not acted on: the agent manual's "ten-tool"
claim against a 12-tool registry is correct —
registry.pycarries atarget_visibleflag, the two event tools declare no transaction projection, andtest_tool_declarations.py:68already pins the partition. Coupling it would havecreated a false dependency.
Filed rather than derived
polylogue-xbg9e(P2) corpus width derives 3 while Sinnix provisioned 4 —headroom counted twice, a cross-repo decision.
polylogue-29naz(P2) MCP_INSIGHT_PROJECTIONShand list, including an already-visibletool-episodes/tool_episodesspelling split.polylogue-b1vr1(P3) ungatedsecond tier lists, plus two items flagged unsure rather than coupled:
migration_runner.py:1125vs:1210differingrequired_tiers, andmanifest_models.py's five-tier Literals.polylogue-mnwxy(P3) mypy 3.11 /ruff py310 vs
requires-python >=3.14.Verification
Residual:
config pathsoutput still has noaudit_database_pathkey or"Audit DB" line — a surface-contract change left out of the readiness fix
deliberately, noted in
polylogue-b1vr1.🤖 Generated with Claude Code
https://claude.ai/code/session_01DYUNBGoE652b3nfmq3CtqK