Repository navigation
fix(storage): Give the ops tier a retirement route - #5391
Conversation
An ops table removed from `OPS_DDL` survived in every already-bootstrapped archive forever. `CREATE TABLE IF NOT EXISTS` never drops, the disposable ops tier has no migration chain, and `OPS_BENIGN_DDL_CONVERGENCE_PLAN` -- the one same-version convergence hook bootstrap applies to an existing ops.db -- held only two `CREATE INDEX` statements. Removing a declaration stopped fresh bootstraps from creating the table and did nothing else. index.db already has the retirement half (`INDEX_BENIGN_DDL_REGISTRY`, whose own docstring credits the ops tier with proving the additive pattern) and the durable source tier has a numbered migration chain plus `RETIRED_SOURCE_SCHEMA_OBJECTS`. ops had neither. Four tables show the consequence. Each was deleted from `OPS_DDL` by a named commit -- slo_samples (#5373), query_runs (#3694, subject "drop write-only query_runs table"), otlp_spans and otlp_telemetry (#3665) -- and each is still present, with its indexes, in an ops.db bootstrapped before that commit. `OPS_BENIGN_DDL_CONVERGENCE_PLAN` becomes a `BenignDDLEntry` tuple, matching the index registry, so each entry carries the zero-consumer audit that justifies it. `devtools gate schema-manifest` already validated this plan's entries for idempotent shape and data-non-transformation; it now names them `ops:<entry>` instead of `ops[N]`. Retirement is a declared list, not a structural "drop whatever OPS_DDL omits" sweep: `polylogue_ops_schema_state` is live bootstrap-internal state that canonical DDL also does not declare, and a sweep would take it. Verification - devtools test tests/unit/storage/test_archive_tiers_ops_write.py -> 23/23 - devtools verify --quick -> exit 0, 25 gates - devtools render all --check -> exit 0, 0 "out of sync" - gate schema-manifest / schema-closure / durable-enum-checks -> exit 0 each Anti-vacuity, executed twice against the production bootstrap route: - removing the four drop entries: 21 passed / 2 failed ("canonical DDL no longer declares these tables"; "the guard is vacuous while the plan retires nothing") - adding drop_context_injection_ledger (a still-declared table): 22 passed / 1 failed on `not dropped & declared` Schema identity: ops.py and bootstrap.py are closure IN, membership unchanged (gate schema-closure passed with no --update). INDEX 54804b5d5d00e88753... -> 34e0c29d5ddd1e6bd4...; OPS unchanged at 868662352a182527e6... -- the convergence plan is not part of OPS_DDL, so the retirement converges on the next open rather than raising SchemaSkew, which is the benign-DDL regime's point. Must land before a fresh rebuild starts. Refs polylogue-pnxl6 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
|
Warning Review limit reachedNext included review available in 45 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. |
Summary
polylogue-pnxl6asks to shrinkops.db. Measurement refutes the plan and uncovers why every previous attempt silently failed: removing a table fromOPS_DDLnever removed it from an existing archive. Four merged PRs believed they deleted tables. All four tables are still in the liveops.dbtoday.The blocker, and the evidence that it has been failing for months
CREATE TABLE IF NOT EXISTSdoes not drop. The disposable ops tier has no migration chain, andOPS_BENIGN_DDL_CONVERGENCE_PLANheld only twoCREATE INDEXstatements. So a deletion could be merged, pass review, and never reach an archive.Still present in the live
ops.db, with their indexes:slo_samplesquery_runsotlp_spans,otlp_telemetryindex.dbalready has the retirement half (INDEX_BENIGN_DDL_REGISTRY) andsource.dbhas migrations plusRETIRED_SOURCE_SCHEMA_OBJECTS. Ops had neither. This gives ops that route and retires exactly those four zero-consumer tables.Proven to reach real archives, not just cold bootstraps. An already-current archive takes bootstrap's cheap convergence-only path; the retirement fires there too —
cached digest present: True / digest unchanged: True / slo_samples still present: False.The bead's diet targets ~0% of the file
Read-only
dbstatagainst the liveops.db(91.7 MB file, 83.35 MiB content):daemon_stage_events+ 2 idxingest_cursor+ 2 idxdaemon_events+ 4 idxingest_attempts+ 4 idxEleven of the thirteen tables the bead wants deleted or moved are jointly ~0% of
ops.db, while the one table that is 62% is the hardest to remove. The bead also pins 18 tables from454808b25; canonicalOPS_DDLdeclares 17 + the identity stamp, andslo_sampleshas no reference anywhere at head.Important caveat recorded rather than glossed: a 0-row table means the feature is unexercised on this archive, not that it is dead.
judgment_scheduler_receiptshas 0 rows and a fully live path (daemon/events.py:221writes →operations/judgment_scheduler.read_latest→api/archive.py:1933→cli/commands/status.py:1120reads). A reader census of all 17 confirms nothing in the bead's delete list is reader-free.AC3's audit move is refused, on three independent grounds
Moving the MCP call log into audit
machine_requestsdoes not work:machine_request_parts.preview_refisTEXT NOT NULL REFERENCES operation_previews(preview_id); a read-only MCP tool call has no preview and no authorization.machine_requestscarries nofinished_at, duration, success or error column.machine_requestsis the mutation idempotency/authority ledger, not latency evidence. The bead's own addendum agrees: "operational latency samples are not that evidence".McpCallLogRecordRejectedError,records_dropped). A table that sheds cannot live in a continuity-chained durable tier.Anti-vacuity — two mutations executed
drop_*entries →canonical DDL no longer declares these tables, plusthe guard is vacuous while the plan retires nothing.drop_context_injection_ledger(a tableOPS_DDLstill declares) → guard fails. A third variant (drop_ingest_cursor) fails harder and earlier withno such table: ingest_cursorfrom bootstrap, so it never reaches the guard — recorded in the test docstring.Verification
Closure: both edited production files are IN; membership unchanged (557 = 557), no
--update. INDEX54804b5d… → 34e0c29d…, OPS unchanged — the convergence plan is not part ofOPS_DDL, so the retirement converges on next open rather than raisingSchemaSkew.Filed as residuals, not silently dropped
daemon_stage_eventsis the entire diet and has no owner-deletion rule. 47,023 rows narrate 2,173 attempts (~21.6 rows/attempt). Measured 0 orphans, 0 NULLattempt_id, every attempt terminal. Nothing anywhere DELETEs from it, and it carries no FK toingest_attempts.convergence_stages.py:177already names the defect. Per the operator's no-retention ruling the fix is an ownership rule, not a time window — needs a deletion event that does not exist.payload_json, only 14.6 MiB is key values; the rest is ~25 fixed key names re-serialized 47k times. Largest:current_path3.59 MiB,cgroup_path3.40 MiB (near-constant per process).ops_write.py:21 MCP_CALL_LOG_RETENTION_MS = 90 daysis a time-based retention window, which the operator's no-retention ruling forbids. Removing it without an ownership deletion would make the table grow forever, so it was left — needs an owner decision.OPS_DDLomits" sweep would takepolylogue_ops_schema_stateand two bootstrap-created indexes.test_ops_convergence_drops_retired_tablespins that.AC1/AC2/AC4 are not attempted;
pnxl6stays open on them.🤖 Generated with Claude Code
https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy