Repository navigation
fix(storage): Delete the vestigial durable tier constants and free the floor - #5369
Conversation
Every durable tier carried two versions. `ARCHIVE_VERSION_BY_TIER` stamped `ARCHIVE_FORMAT_FLOOR_VERSION = 1` for source, user and audit, while the tier modules still declared `SOURCE_SCHEMA_VERSION = 47`, `USER_SCHEMA_VERSION = 11` and `AUDIT_SCHEMA_VERSION = 3` -- the pre-reset lineage numbers. #5275 stopped consuming them and #5290 deleted every numbered migration behind them, but neither deleted the constants, so `blob_integrity._source_schema_capabilities` went on reading `user_version >= 47` as its authority threshold. No source tier this runtime writes reaches that number, so a fresh, fully current source tier classified as `current_unversioned` forever. Delete the three constants and point every reader at the one declaration. `blob_integrity` compares for equality with the stamped version, because `user_version` was renumbered from one and no longer orders across lineages: a pre-floor 29 is not "newer" than a current 1, and its legacy blob carriers must still be scanned. Separately, `assert_archive_format_lineage` required each durable entry in the marker's `tier_versions` to equal the floor exactly. That record is the version a tier was *born* at, so the first numbered migration -- which the floor comment and `DURABLE_MIGRATION_ADOPTION_FLOORS` both plan for -- would make every freshly bootstrapped archive refuse the marker it had just written. Treat the floor as the lower bound it is, and bind the birth-version fingerprint check to the recorded birth version so the historical-lineage discrimination survives the target moving above the floor. No migration is required: nothing stamped the deleted numbers, so no archive in any lineage carries them and no durable file changes shape. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq
|
Warning Review limit reachedNext included review available in 54 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 (26)
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: 52d01031f9
ℹ️ 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".
|
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. |
|
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
The floor is the design; the three constants are vestigial. Deletes
SOURCE_SCHEMA_VERSION = 47,USER_SCHEMA_VERSION = 11andAUDIT_SCHEMA_VERSION = 3, fixes the production defect that still consumed one ofthem, and relaxes a format-marker predicate that made the declared
durable-migration regime unexecutable for every freshly bootstrapped archive.
Nine reds cleared, zero newly red.
Which side is the defect — settled by history, not inference
git show b56699c80(#5275):ARCHIVE_VERSION_BY_TIERwas literallyArchiveTier.SOURCE: SOURCE_SCHEMA_VERSIONbefore that commit, which deliberatelyreplaced all three durable entries with
ARCHIVE_FORMAT_FLOOR_VERSIONand removedthe three imports — leaving the constants defined but orphaned.
git show 232c43689(#5290) then deleted every numbered source/user/audit migrationand reset the adoption floors, with the reason stated in-diff: "Numbering was reset
for the marker-identified archive lineage. A future train starts directly above this
floor; historical chains are not a bridge into the new format."
So #5275 stopped consuming the constants and #5290 deleted the migrations backing
them; neither deleted the constants themselves.
AUDIT_SCHEMA_VERSIONhad theidentical split and the bead did not mention it — leaving it would have made the
reconciliation two-thirds done and the anti-vacuity test unable to say "per durable
tier".
The production defect
blob_integrity.pycompareduser_version >= SOURCE_SCHEMA_VERSION— against 47,while every source tier this runtime writes stamps 1. The version clause was dead,
so a fully current fresh source tier classified as
current_unversionedforever.Now compares for equality against the stamped version. Equality rather than
>=because
user_versionwas renumbered from one by the format floor and no longerorders across lineages: a pre-floor 29 is not "newer" than a current 1, and
>=would grant authority to a foreign-lineage file with an incomplete catalog and
silently drop its legacy blob carriers. The mutation proves it — restoring
>=admits a
user_version=47foreign tier ascurrent_versionedwithlegacy_carriers=('raw_sessions',)unscanned.What this unblocks for polylogue-37t.2.4 — and the boundary, precisely
The probe showed the refusal was not "no durable migration can ever land".
assert_archive_format_lineagealready admitted a live tier above the floor, soforward-migrating an existing archive always worked.
The refusal was at the line requiring the marker's recorded
tier_versionstoequal the floor. That field is the archive's birth record, written from
ARCHIVE_VERSION_BY_TIER— so the moment a migration raises the durable target,every freshly bootstrapped archive records
source=2and refuses the marker itjust wrote. Fatal for every new archive, every test fixture, and the final rebuild.
Fixed: the floor is a lower bound, and the birth-version fingerprint check binds
to
versions[tier]rather than to the floor — so the historical-lineagediscrimination survives the target moving instead of silently switching off.
Executable proof:
test_migrate_tier_cli_executes_and_persists_a_future_change_train— the repo's only test driving a real numbered source migration
002from floor 1 to2 through the production
ops maintenance migrate-tierCLI — was red at base and isnow green.
37t.2.4remains blocked for reasons it names itself: two undecided design questions,verification_commandsnaming a file that does not exist, and the user tier's ownmigration test path still red.
Anti-vacuity — six mutations executed, tree verified clean after each
Reinstating the constants → "
…archive_tiers.sourcedeclares{'SOURCE_SCHEMA_VERSION': 47}, but the source tier stamps and compares 1" (×3).Restoring the threshold → the pre-existing baseline red reproduced exactly,
assert 'current_unversioned' == 'current_versioned'. Relaxing to>=→ the foreignlineage admitted. Re-pinning
tier_versions→ "archive format marker has anincomplete six-tier floor" from a fresh archive refusing its own marker. Rebinding
the fingerprint to the floor →
DID NOT RAISEon a transplanted foreign tier. Andstamping from 47 →
assert 47 == 1, proving the stamps test is not circular againstthe map alone.
Measured cluster movement
22 → 13 failures. Nine cleared, zero newly red, zero green→red. Before/after both
measured in this worktree (before, by checking out base content in place):
534 passed → 553 passed, and the arithmetic checks:
534 + 9 cleared + 10 new tests = 553.Five of the nine had a different root from the constants split and are classified
honestly: tests building a "stale" tier as
ARCHIVE_VERSION_BY_TIER[tier] - 1, whichfor a durable tier at the floor collapses onto 0 — the deliberately-admitted
never-provisioned sentinel, not a skew. Fixed by stepping above instead, the pattern
already documented in a sibling test.
Landing window
source.py,user.py,audit.py,__init__.py,archive_plan.pyall IN;blob_integrity.pyout. All three AST fingerprints move, index identity231dfa77 → a0620e74; ops unchanged. Must land before a fresh rebuild starts,never during one.
No migration required, with proof rather than assertion: nothing ever stamped
47/11/3 in this format lineage, no DDL byte changed in the three tier modules (only a
constant and an
__all__entry), and thearchive_planchange only relaxes anadmission predicate for marker values nothing currently produces. Classification:
metadata-only. An existing archive is not stranded — its
user_versionstays 1, itsmarker stays
{'source': 1, …}, and the relaxed lower bound still admits it.Verification
devtools verify --quickexit 0 (22 static gates, zero FAILED) ·render all --checkexit 0,
grep -c 'out of sync'= 0 · newtest_durable_tier_version_authority.py10/10 ·
test_durable_change_train.py57 passed / 42 failed identical before andafter, proving that family inherited and untouched.
Also corrected the same staleness in
docs/schema.md(its table citedSOURCE_SCHEMA_VERSION = 29, already wrong before this change),docs/archive-backup.md,docs/data-model.md, anddocs/security.md(which cited adeleted migration file).
Residuals
>=→==narrowing is a deliberate semantic change, not a retarget. Underthe old single monotone lineage
>=read as "at least as new as this runtime";post-reset that reading is unavailable. A tier sitting mid-chain (at 2 while the
runtime targets 3) now reports
current_unversionedand falls back to the catalogprobe — conservative, not wrong, but a future migration author should know.
one root with the 42 in
test_durable_change_train.py: tests seeding durable tiersat pre-floor versions and driving chains chore: Fresh schema floor: retire historical chains without confusing o… #5290 deleted. They need rewriting against
the reset floor, not test-by-test patching, so that was deliberately not mixed in
here. One retarget is flagged rather than hidden:
list(range(11, ARCHIVE_VERSION_BY_TIER[USER] + 1))now evaluates to the empty list —nonsense under the reset floor, red either way, and it should be rewritten.
after: the daemon
TimeoutError/fd-leak family, the pre-floor_create_user_v3fixtures, the known
-wal/-shmsidecar cause, and one ontology-grain mismatch witha version-shaped name.
Closes polylogue-rwcq2. Partially unblocks polylogue-37t.2.4.
🤖 Generated with Claude Code
https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq