Repository navigation
refactor: collapse duplicate implementations, dead shims, and split vocabularies - #3458
Conversation
…rrect its CLAUDE.md claim
Problem: CLAUDE.md documented literal_check("status", *get_args(RunStatus))
as the mechanism keeping typing.Literal vocabularies and SQL CHECK lists in
lockstep, but the helper has zero call sites (bead polylogue-u6tl audit) —
the doc pointed every reader at a protection that never runs, while the
real, running mechanism is check()/nullable_check() over PolylogueStrEnum.
What changed: literal_check removed (surgical renewal — no exported,
documented, uncalled helpers); order_check docstring cross-ref updated;
CLAUDE.md now describes the enum-backed generator that actually runs and
warns that many CHECK lists remain hand-written.
Ref polylogue-u6tl.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
…iter and one column source
Problem: two independent same-named embedding_catchup_runs tables existed
(ops-tier DDL in archive_tiers/ops.py vs a second full writer stack in
storage/embeddings/progress.py) with divergent shapes and status
vocabularies ('cancelled' vs 'stopped'/'interrupted'), held together by a
hand translation at the embed.py write boundary. The progress.py writer
half had zero production callers — only tests exercised it. A third copy
of the column set (bootstrap's _ensure_ops_embedding_catchup_run_columns)
had already drifted: it lacked skipped_sessions, so a freshly bootstrapped
never-written ops.db under-provisioned the table.
What changed:
- progress.py keeps only the pre-split monolith READ path
(latest_embedding_catchup_run + payload type); the dead writer stack
(CatchupRunStatus/Start/Delta, start/record/finish, table DDL) is gone.
- ops.py DDL gains skipped_sessions and documents the status-vocabulary
boundary; embed.py documents the translation at the sole write site.
- One ensure helper: bootstrap now calls ops_write's
ensure_embedding_catchup_run_outcome_columns (3 columns) instead of its
own drifted 2-column copy.
- Tests seeding via the dead writers now seed the legacy table shape
directly; reader behavior assertions unchanged.
Ref polylogue-u6tl.
Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
…d names Problem: the repo's stated policy is hard renames with no compat shims, yet a sweep found surviving renamed-name wrappers and aliases — each one a second spelling of a concept that queries/greps against the canonical name silently miss. Two were live split-vocabulary hazards: VERB_NAMES was exported under three names (VERB_NAMES / QUERY_VERB_NAMES / QUERY_VERBS) and parser_diagnostics tested membership against two of them as if they were different sets; cli/verb_names.QUERY_VERBS collided with an unrelated, also-unreferenced cli/query_verbs.QUERY_VERBS tuple. Deleted (all verified zero production callers by two grep spellings each): - cli/query.py execute_query + async_execute_query param-shims (test-only; tests now drive async_execute_query_request directly) - rendering build_rendered_message_payload wrapper + its core.py re-export - rendering card_kind_for_tool wrapper (tests use classify_tool().card_kind) - cli JudgeCandidateRow.from_claim compat constructor - cli verb-name aliases QUERY_VERB_NAMES/QUERY_VERBS (callers on VERB_NAMES) and the dead query_verbs.QUERY_VERBS tuple - cli/query_output dead aliases _output_summary_list/_open_result - mcp/payloads stillborn MCP*-prefixed aliases (4, zero adopters) - operations OperationStatus back-compat re-export (importers repointed to operations.operation_status, its real home) Verification: devtools test on the five affected test files (302 passed); devtools verify --quick exit 0. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
Filed: table-exists 25-copy divergence (polylogue-grdt), timestamp-coercion re-fork with 1000x unit disagreement, surface CHECK vocabulary split, dead 'interrupted' lifecycle value, readonly-connection bypasses, pre-split embedding-status read fallback, and the skip-stale-replace triple policy. Closed polylogue-u6tl (literal_check + CLAUDE.md + catchup vocabulary pair) with the hand-written CHECK inventory in the close reason. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reached
Next review available in: 24 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (24)
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 |
# Conflicts: # .beads/issues.jsonl # CLAUDE.md # polylogue/storage/embeddings/progress.py # polylogue/storage/sqlite/archive_tiers/ops.py
…sites (#3464) ## Summary Restores `literal_check` in `polylogue/storage/sqlite/archive_tiers/common.py`, deleted by #3458 as a supposed zero-call-site dead shim. It has real call sites and master's HEAD currently fails to import `archive_tiers/index.py` at all. ## Problem #3458 (5798b3d, "collapse duplicate implementations, dead shims, and split vocabularies") deleted `literal_check` from `common.py` on the strength of a "zero call sites" grep (bead polylogue-u6tl). But #3451 (42bafb0, "wire literal_check into DDL, fix a drift CHECK gap") had already landed *earlier the same day* and wired it into `archive_tiers/index.py`'s `delegation_facts` DDL for `DelegationMappingState`/`DelegationResultStatus` CHECK constraints. #3458's grep predated #3451's merge and was never re-run against the merged tree. Net effect on current `master`: every module that imports `archive_tiers/index.py` (i.e. essentially the whole storage substrate, and by extension most of `tests/`) fails at collection with `ImportError: cannot import name 'literal_check' from 'polylogue.storage.sqlite.archive_tiers.common'`. Discovered while running `devtools test` for unrelated work on polylogue-cgfy — a fresh `devtools test` on any file failed at conftest import. ## Solution Restore `literal_check` verbatim (matching #3451's usage and `CLAUDE.md`'s still-accurate description of it as real machinery for the ~20 enum-backed columns "and the handful of `literal_check` call sites wired so far"), rather than migrating the two real call sites to `check()`/`nullable_check()` — those only accept `PolylogueStrEnum`, not the `typing.Literal` aliases `DelegationMappingState`/`DelegationResultStatus` actually are. No other part of #3458 touched. ## Verification - `devtools test tests/unit/sources/test_parsers_claude_code_artifacts.py tests/unit/storage/test_archive_tiers_common.py` — 38 passed (previously failed at collection with `ImportError`) - `devtools verify --quick` — exit 0 (format, lint, mypy, render all --check, schema-versioning policy) — ran automatically via the pre-push hook
…#3465) ## Summary Closes out the remainder of polylogue-cgfy's disposition work now that PR #3442 landed the flagship consumption gap (structuredPatch/originalFile/oldString -> file_edits, reachable via API + MCP + CLI `read --view file-edits`). Adds the two remaining genuinely-unread, real-value wire keys (`requestId`, `thinkingMetadata.maxThinkingTokens`) and records the full disposition (read / measured-negative / deliberately-dropped-duplicate) for the rest of the bead's "other unread keys of substance" list in the Claude Code OriginSpec's `fidelity_notes`, satisfying AC1. ## Problem polylogue-cgfy's 2026-07-29 corpus enumeration found 34 of the 70 most common Claude Code wire keys with zero references in `polylogue/sources/`. The structuredPatch/originalFile/oldString cluster (105K/92K/86K rows) and most of the "other keys of substance" list (`stop_reason`, `stop_sequence`, `cache_creation`, `ttftMs`, `todos`, `toolUseResult.sandbox`/`filenames`/`numFiles`, `slug`) were captured by prior sessions on this bead and PR #3442, but two items remained genuinely unread with no recorded disposition either way: `requestId` (1,171 sampled occurrences -- the Anthropic API's per-call request id) and `thinkingMetadata.maxThinkingTokens` (34 occurrences -- the extended-thinking token budget). The bead's remaining lower-value items (`userType`, `sourceToolAssistantUUID`, `hookCount`/`hookInfos`, `toolUseID`) also had no recorded disposition, so AC1 ("every key... classified... recorded in the Claude Code OriginSpec fidelity declaration") was incomplete. Verified each of those lower-value items directly against a real ~/.claude/projects corpus before classifying: - `userType` is the literal string `"external"` on every sampled record (measured negative, same class as the bead's own `usage.service_tier` finding). - `sourceToolAssistantUUID` equals that same record's own `parentUuid`, already captured as `ParsedMessage.parent_message_provider_id` -- a duplicate spelling, not new evidence. - `hookCount`/`hookInfos` describe hook firings already tracked durably (with outcome, which `hookInfos` lacks) in `source.db`'s `raw_hook_events`. - `toolUseID` is already consumed for its real signal (the `progress`/`agent_progress` delegation-edge disposition documented in `code_parser.py`'s module docstring). Also discovered en route: `master` HEAD (5798b3d) failed to import at all (`ImportError: cannot import name 'literal_check'`) -- #3458 deleted it as a supposed zero-call-site dead shim, but #3451 had wired real call sites into it earlier the same day. Fixed and merged separately as #3464 so this branch could even run tests; this branch is rebased on top of that fix. ## Solution - `polylogue/sources/parsers/claude/code_parser.py`: `_message_usage_event_payload` gains a `record` parameter (the top-level record `item`, since `requestId`/`thinkingMetadata` live there, not inside `message`); the sole call site now passes `record=item`. Both new keys ride the existing `message_usage` session-event payload as `request_id`/`max_thinking_tokens`. - **Production callers exercising the new fields**: `Session.session_events` -> CLI `read --view events` (`polylogue/cli/read_views/events.py` -> `run_session_events`, `polylogue/cli/messages.py`) and MCP `get(ref, projection="events")` (`polylogue/mcp/server_cutover.py:905`) already render every `session_events` row generically regardless of `event_type` -- no new consumer code needed, verified by reading both call chains before writing this PR (the generic `events` projection was wired by prior work, not this PR). - `polylogue/sources/origin_specs.py`: new `fidelity_notes` entry on the Claude Code `OriginSpec` recording the full disposition table above. ## Verification - `devtools test tests/unit/sources/test_claude_code_unread_wire_fields.py tests/unit/sources/test_parsers_claude_code_artifacts.py tests/unit/sources/test_origin_specs.py` -> 57 passed - `devtools verify --quick` -> exit 0 (format, lint, mypy, render all --check, schema-versioning policy) - Anti-vacuity: each new field has a paired "field absent" test asserting the key is omitted from the payload, not fabricated Ref polylogue-cgfy <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Enhancements** - Claude Code usage events now capture available request identifiers and maximum thinking-token settings. - Missing metadata continues to be omitted, keeping usage records clean and accurate. - **Quality Improvements** - Added coverage to verify that these Claude Code fields are preserved and handled consistently. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
… select (#3466) ## Summary Fixes the raw-authority-quarantine absorbing state (polylogue-u19l) by making its root cause (polylogue-w32w) structurally unrepresentable: a frontier item's actuator must have a real apply() handler only if its state is in the executability gate's admitted set. ## Problem Audit 2026-07-31 (live `source.db`, read-only) found: 4,147 open `raw_authority_blockers` rows all reading "accepted raw authority remains quarantined pending exact refinement proof"; 15,205/17,384 frontier plans residual (87%); `fixed_point=0` on all 256 retained censuses; total gap count that only ever grew (16,874 -> 17,384, never shrinking). Root cause: a quarantined raw whose refinement proof came back "ineligible" got no strategy override, so `_classify_frontier`'s default fallback assigned it `state=UNRESOLVED_PROVENANCE, actuator=REFINE_QUARANTINE`. But `REFINE_QUARANTINE` has a real apply() dispatch branch that only ever runs for `_EXECUTABLE_STATES = {SAFELY_REKEYABLE, DUPLICATE_ALIAS}` — both the daemon and the operator break-glass path (`apply_raw_authority_frontier`, which raises `RuntimeError` on any non-executable selected item) select only executable items. The handler at `raw_reconciler.py:1297` was unreachable through every path that exists. Two corrections from the audit preserved unchanged: - `unresolved_raw_replay_blockers()` already deliberately excludes frontier plan blockers from starving unrelated work. - `REFINE_QUARANTINE` is not entirely dead — the strategy override for eligible/already_repaired quarantined raws (promoting to `SAFELY_REKEYABLE`) is the real, executable 2,179-plan lane draining at 8/pass. Only the ineligible complement was absorbing. ## Solution - `_strategy_overrides` now records an override for "ineligible" quarantine proofs too: state stays `UNRESOLVED_PROVENANCE` (still tracked in `state_counts` and `raw_authority_blockers` — still an operator-visible obligation), actuator becomes `NONE` with the real ineligibility reason folded into the item's `reason` text. The ineligibility reasons enumerated in `_inspect_quarantined_accepted_raw` (missing rows, mismatched hashes, competing authority, incompatible typed envelopes) are permanent structural facts about a raw's own data, not transient states — matching the existing apply()-time code comment ("not transiently"). This is the "record a terminal, countable, operator-visible state" branch of the two legitimate options the bead named, chosen over building a refinement-proof actuator that cannot exist for permanently mismatched bytes. - Same fix applied to two more `classify_frontier` call sites with the identical shape: the no-`logical_source_key` `REFINE_QUARANTINE` fallback, and `REPLAY` on a logical-source-key mismatch (confirmed 0 live rows today via the `raw_authority_blockers` reason distribution; `REPLAY` has no apply() handler at all, fixed pre-emptively). - `polylogue-w32w`'s invariant, made structurally enforceable: `RawAuthorityFrontierItem.__post_init__` now rejects constructing an item whose actuator has a real apply() dispatch branch (`_APPLY_DISPATCHED_ACTUATORS`) paired with a non-executable state. Fires on every construction path (`_item()`, `dataclasses.replace()` in `_apply_judgment_dispositions`). `REACQUIRE`/`REQUEST_JUDGMENT` are deliberately exempt — both resolve out-of-band (ordinary re-acquisition; an operator judgment assertion promoted by `_apply_judgment_dispositions`). - `test_apply_dispatched_actuators_match_apply_branches` regex-parses the actual apply() dispatch branches out of the module source and asserts they equal `_APPLY_DISPATCHED_ACTUATORS`, so the allowlist can't silently drift. - `test_quarantine_refinement_fanout_scopes_by_logical_source_key` previously asserted the now-fixed sibling's actuator as `REFINE_QUARANTINE` — it was the direct reproduction case for this defect, encoded as expected behavior. Updated to assert `NONE`. - Also restores `polylogue/storage/sqlite/archive_tiers/common.py`'s `literal_check()` helper, deleted by #3458 on stale "uncalled" evidence after #3451 had already wired it into `archive_tiers/index.py` — broke every import of `polylogue.storage` on `origin/master` HEAD. Discovered while setting up verification for this fix; restored as a prerequisite since nothing here (or in the wider suite) can import without it. **What this fix does NOT do**: it does not reduce the 4,147 existing blocker rows or shrink `raw_authority_census_plans`' ~709K carried_forward rows (polylogue-f4z9, tracked separately) — those are pre-existing durable rows from the old misclassification and need their own migration/backfill, out of scope here. Going forward, every new census records these raws with the honest `NONE` actuator instead of reproducing the false promise. **No index rebuild is required** (`polylogue ops reset --index && polylogued run`) — `source.db`'s `revision_authority` column is unaffected; only the derived frontier classification (an index-tier read model) changes on the next census. ## Verification - `devtools test tests/unit/storage/test_raw_authority_ledger.py tests/unit/storage/test_quarantined_accepted_raw_repair.py tests/unit/storage/test_duplicate_raw_identity_repair.py tests/unit/storage/test_browser_capture_origin_repair.py tests/unit/storage/test_archive_tiers_common.py` — 81 passed - `devtools verify --quick` — exit 0 (ruff format, ruff check, mypy --strict, render all --check, layering, closure-matrix, schema-versioning policy, and the rest of the quick-tier gates) - Not run: full suite / testmon (fresh unseeded worktree); per-PR CI skips the heavy `test` suite by design. - Pre-existing, unrelated failure found and left alone (filed as polylogue-jsxj): `tests/unit/daemon/test_daemon_cli.py::test_maybe_run_raw_materialization_whale_pass_*` (`TypeError: lambda got unexpected keyword '_bootstrap'`) — introduced by #3455's `load_polylogue_config()` signature change, touches neither `raw_reconciler.py` nor `common.py`; reproduces identically on `origin/master` HEAD before this branch's changes. Ref polylogue-u19l Ref polylogue-w32w --------- Co-authored-by: Claude <[email protected]>
## Summary Wires the previously-unused `prepare_session_rows`/`PreparedSessionRows` (polylogue-623q, #3219) into the offline/CLI bulk-rebuild path so row-tuple construction (message/block hashing, JSON encoding, enum lookups) runs on a background thread concurrently with the single SQLite writer's own work, instead of inline inside the writer's hold. ## Problem polylogue-fpid: this was the last unexplored performance lever for a full index rebuild, which the archive needs to run to pick up 5,300 misclassified sessions and every parser fix landed today. Concurrency (#p0pw/#8249), FTS-trigger deferral, and delete-cascade skip (#3460) were already measured and closed off; the remaining diagnosis was that bulk-build is INSERT-bound and `prepare_session_rows`/`PreparedSessionRows` existed complete, tested, and wired nowhere. Instrumenting the real rebuild engine (`tests/infra/rebuild_cost_model.py`'s `_run_one_rebuild_pass`, not a microbenchmark) against the two largest population strata (codex-session/d9: 7508 raws, claude-code-session/d9: 15954 raws — 57% of the 41,363-raw corpus by count) showed `index.full_replace.field_path_union`'s timer wrapping `_union_with_existing_rows`'s call expression — whose arguments (`_build_message_rows`/`_build_block_rows`) evaluate before the function body's own early return. On a from-empty bulk build (`existing_raw_id is None`, always the early-return branch for this stratum shape) the entire measured cost of that stage is pure row construction, not the union it's named for: 0.355s/40 raws (42% of `full_replace`) on codex-d9, 0.072s/40 (11%) on claude-code-d9. ## Solution - `polylogue/storage/sqlite/archive_tiers/revision_governance.py`: threads `PreparedSessionRows`/`Future[PreparedSessionRows]` through `apply_raw_revision_replay` → `_index_parsed_for_retained_raw` → `_write_parsed_precedence_result` → `write_parsed_session_to_archive`'s existing (previously unwired) `prepared` parameter. Only ever resolved at chain position 0 (the sole full-replace write — every later position is `merge_append`, which never accepts prepared rows). - `polylogue/sources/revision_backfill.py`: `backfill_historical_revision_ evidence`'s byte-proven replay loop submits `prepare_session_rows` for position 0's session to a one-worker `ThreadPoolExecutor` right when `parsed_by_raw_id` is built, so it runs concurrently with `apply_raw_revision_replay`'s own attachment-preacquisition/blob-flush/ head-lookup preamble on the calling thread. Gated on `parallel_threads_effective()` (same guard the existing parse-thread pool uses) — a GIL build gets `prepare_pool=None` and is byte-for-byte unchanged. - `polylogue/storage/sqlite/archive_tiers/archive.py`: threads the new parameter through `ArchiveStore.apply_raw_revision_replay`'s wrapper. - Correctness: `write_parsed_session_to_archive`'s existing validity gate (content-hash match, not `merge_append`, not prefix-sharing) already made a stale/wrong `prepared` argument always safe to pass — this change adds no new gating logic, only a new supplier. - Also restores `literal_check` (deleted by #3458 despite live call sites #3451 added the same day — polylogue-7qfq, already fixed on another branch as `3fc622ecb`, cherry-picked here to unblock local verification on this worktree's `origin/master` base) and fixes a test double (`test_live_cursor_persistence.py`'s `_lock_first_index_persistence` fixture, which re-declares `_write_parsed_precedence_result`'s signature) to accept and forward the new `prepared` parameter. ## Verification Re-instrumented after wiring, same two strata, 4 repeated runs each under host load 14–17 (contended, hence the repeats): `field_path_union` collapsed from 0.355s/0.072s to a consistent ~0.0002s (99.9%+ eliminated) in every run. `full_replace` dropped 25–45% (codex-d9: 0.85s → 0.46–0.63s; claude-code-d9: 0.64s → 0.45–0.48s). `index_parsed_write` (the full per-session writer hold) dropped 19–22%. Weighted by raw count across the two dominant strata (57% of the corpus), this projects to roughly a 10–15% cut of writer apply time on the majority of a full rebuild — an estimated **25–40 minutes off the calibrated 4h20m baseline**. Did not run the full ~40-pass population projection benchmark (`test_full_population_projection`) — a concurrent instance of the same benchmark was already running in another worktree on this host when this was measured; the per-stratum stage-level measurement above uses the same real rebuild engine, just without the two-point regression's fixed-cost stripping. - `devtools test tests/unit/sources/test_revision_backfill.py tests/unit/storage/test_revision_replay.py tests/unit/storage/test_raw_retention.py tests/unit/storage/test_prepared_session_rows.py tests/unit/storage/test_archive_tiers_write.py tests/unit/sources/test_live_cursor_persistence.py` — 228 passed, 1 failed (`test_parse_one_still_replays_real_claude_code_sessions_with_no_path_rule`, confirmed pre-existing on unmodified `origin/master` via a diff-free byte-for-byte rerun; filed as polylogue-6mpy, unrelated to this change). - `devtools verify --quick` — exit 0 (ran twice: once pre-commit, once via the pre-push hook). - `mypy polylogue devtools` — Success, no issues found in 1277 source files. - Not run: full/testmon suite (per-PR CI skips it by design; the affected-surface `devtools test` selection above covers every touched call site). Ref polylogue-fpid, polylogue-623q, polylogue-7qfq --------- Co-authored-by: Claude Opus 5 <[email protected]>
Summary
Duplication-hunt lane: one concept, one representation. Deletes the uncalled
literal_checkgenerator CLAUDE.md falsely advertised as the CHECK-lockstep mechanism, collapses theembedding_catchup_runstwin (two same-named tables, three independently hand-held column/status vocabularies) onto the single ops-tier writer, and removes every verified-dead compat wrapper/alias found in a repo-wide shim sweep. Contested/large finds are filed as beads, each with file:line evidence.Problem
The operator's standing complaint: little inconsistencies that are individually defensible and collectively harmful. Concretely, this branch's targets were all live instances of one-concept-many-representations:
CLAUDE.mddocumentedliteral_check("status", *get_args(RunStatus))as the mechanism keepingtyping.Literaland SQL CHECK lists in lockstep — the helper had zero call sites (beadpolylogue-u6tl); the running mechanism ischeck()/nullable_check()overPolylogueStrEnum.embedding_catchup_runsexisted as two same-named tables: the ops-tier DDL (archive_tiers/ops.py, statuses…/cancelled) and a second full writer stack instorage/embeddings/progress.py(statuses…/stopped/interrupted) whose writers had zero production callers, glued by a hand translation inembed.py. A third copy of the column set (bootstrap.py's ensure helper) had already drifted — it lackedskipped_sessions, so a freshly bootstrapped, never-writtenops.dbunder-provisioned the table.VERB_NAMESwas exported under three names, andparser_diagnostics.py:110tested membership in two of them as if they were different sets (name in QUERY_VERB_NAMES or name in VERB_NAMES— the same frozenset object) — direct evidence that split spellings mislead even the code's own author.execute_query/async_execute_query,build_rendered_message_payload,card_kind_for_tool,JudgeCandidateRow.from_claim,OperationStatusre-export, four stillbornMCP*Payloadaliases, two deadquery_outputaliases) — each a second grep-invisible spelling, all with zero production callers, in a repo whose policy is hard renames with no shims.Solution
storage/sqlite/archive_tiers/common.py:literal_checkdeleted;CLAUDE.mdnow describes the enum-backed generator that actually runs and warns that many CHECK lists remain hand-written.storage/embeddings/progress.pyreduced to the pre-split monolith read path (latest_embedding_catchup_run+ payload type) thatdaemon/metrics.py/status_payload.pyfallbacks still serve; the dead writer stack is gone.ops.pyDDL gainsskipped_sessionsand documents the status-vocabulary boundary;embed.pydocuments the translation at the sole write site;bootstrap.pynow callsops_write.ensure_embedding_catchup_run_outcome_columns(the 3-column implementation) instead of its drifted 2-column copy. Ops tier is disposable/additive — no version bump needed;devtools lab policy schema-versioningpasses.async_execute_query_request/classify_tool(...).card_kinddirectly;OperationStatusimporters repointed tooperations.operation_status; verb-name callers unified onVERB_NAMES).Drift found between duplicates (each a live or latent bug), fixed or filed:
bootstrapvsops_writecatchup column sets — missingskipped_sessions(fixed here).cancelledvsstopped/interruptedstatus vocabularies for one table name (collapsed here).parser_diagnosticsdouble-membership test over aliased sets (fixed here)._timestamp_ms×7: two copies parse an all-digit string as raw ms, the core-delegating copies as epoch seconds — 1000× disagreement (bead filed).revision_governance.pylackswrite.py's message-derived freshness fallback, so timestamp-less sessions bypass its stale check (bead filed, verified in source).surfaceCHECK vocabularies:('cli','mcp','daemon-web','api','daemon-internal')vs('cli','mcp','daemon-http','daemon-internal','web')for the same concept in two ops tables (bead filed).sqlite_mastertype-sets (bead filed).raw_authority_censuses.lifecycle_status'interrupted'is unwritable yet filtered for in 5 read sites (bead filed).Also filed: readonly
sqlite3.connectbypasses ofopen_readonly_connection(noquery_onlyguard), and the pre-split embedding-status read fallback as a sibling ofpolylogue-oac5(user_corrections).Ref polylogue-u6tl (closed with the hand-written CHECK inventory in the close reason).
Verification
devtools test tests/unit/storage/test_embedding_contracts.py tests/unit/cli/test_embed_status_fast.py tests/unit/storage/test_archive_tiers_common.py— 80 passeddevtools test tests/unit/daemon/test_embedding_convergence_progress.py tests/unit/storage/test_vec_session_seed.py tests/unit/daemon/test_embedding_readiness.py— passeddevtools test tests/unit/cli/test_query_exec_laws.py tests/unit/rendering/test_semantic_cards.py tests/unit/core/test_readiness_capability.py tests/unit/cli/test_query_fmt.py tests/unit/cli/test_query_set_read.py— 302 passeddevtools test tests/unit/cli/test_click_app.py tests/unit/cli/test_click_app_main.py tests/unit/cli/test_judge_command.py tests/unit/operations/test_operation_contract.py tests/unit/operations/test_status_protocol.py tests/unit/rendering/test_rendering.py tests/unit/mcp/test_server_surfaces.py— 170 passeddevtools verify --quick— exit 0 (format, lint, mypy, render all --check, schema-versioning policy)🤖 Generated with Claude Code
https://claude.ai/code/session_01KAAzxpu1wNZLmuAb8Wgyso