Skip to content

fix(storage): Delete the vestigial durable tier constants and free the floor - #5369

Merged
Sinity merged 1 commit into
masterfrom
fix/durable-tier-floor
Sep 21, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/durable-tier-floor

Conversation

@Sinity

@Sinity Sinity commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Summary

The floor is the design; the three constants are vestigial. Deletes
SOURCE_SCHEMA_VERSION = 47, USER_SCHEMA_VERSION = 11 and
AUDIT_SCHEMA_VERSION = 3, fixes the production defect that still consumed one of
them, 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_TIER was literally
ArchiveTier.SOURCE: SOURCE_SCHEMA_VERSION before that commit, which deliberately
replaced all three durable entries with ARCHIVE_FORMAT_FLOOR_VERSION and removed
the three imports
— leaving the constants defined but orphaned.

git show 232c43689 (#5290) then deleted every numbered source/user/audit migration
and 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_VERSION had the
identical 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.py compared user_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_unversioned forever.

Now compares for equality against the stamped version. Equality rather than >=
because user_version was renumbered from one by the format floor and no longer
orders 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=47 foreign tier as current_versioned with
legacy_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_lineage already admitted a live tier above the floor, so
forward-migrating an existing archive always worked.

The refusal was at the line requiring the marker's recorded tier_versions to
equal 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=2 and refuses the marker it
just 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-lineage
discrimination 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 002 from floor 1 to
2 through the production ops maintenance migrate-tier CLI — was red at base and is
now green.

37t.2.4 remains blocked for reasons it names itself: two undecided design questions,
verification_commands naming a file that does not exist, and the user tier's own
migration test path still red.

Anti-vacuity — six mutations executed, tree verified clean after each

Reinstating the constants → "…archive_tiers.source declares
{'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 foreign
lineage admitted. Re-pinning tier_versions → "archive format marker has an
incomplete six-tier floor"
from a fresh archive refusing its own marker. Rebinding
the fingerprint to the floor → DID NOT RAISE on a transplanted foreign tier. And
stamping from 47 → assert 47 == 1, proving the stamps test is not circular against
the 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, which
for 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.py all IN;
blob_integrity.py out. All three AST fingerprints move, index identity
231dfa77 → 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 the archive_plan change only relaxes an
admission predicate for marker values nothing currently produces
. Classification:
metadata-only. An existing archive is not stranded — its user_version stays 1, its
marker stays {'source': 1, …}, and the relaxed lower bound still admits it.

Verification

devtools verify --quick exit 0 (22 static gates, zero FAILED) · render all --check
exit 0, grep -c 'out of sync' = 0 · new test_durable_tier_version_authority.py
10/10 · test_durable_change_train.py 57 passed / 42 failed identical before and
after
, proving that family inherited and untouched.

Also corrected the same staleness in docs/schema.md (its table cited
SOURCE_SCHEMA_VERSION = 29, already wrong before this change),
docs/archive-backup.md, docs/data-model.md, and docs/security.md (which cited a
deleted migration file).

Residuals

  • The >= → == narrowing is a deliberate semantic change, not a retarget. Under
    the 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_unversioned and falls back to the catalog
    probe — conservative, not wrong, but a future migration author should know.
  • The largest remaining coherent red group is the pre-floor-fixture family, sharing
    one root with the 42 in test_durable_change_train.py: tests seeding durable tiers
    at 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.
  • 13 inherited reds remain in the cluster, each with its cause compared before and
    after: the daemon TimeoutError/fd-leak family, the pre-floor _create_user_v3
    fixtures, the known -wal/-shm sidecar cause, and one ontology-grain mismatch with
    a version-shaped name.
  • No full-corpus run, per the targeted-verification rule.

Closes polylogue-rwcq2. Partially unblocks polylogue-37t.2.4.

🤖 Generated with Claude Code

https://claude.ai/code/session_015WCh9YW3cRfsg3CZBKU7Fq

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
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: ae82c3ba-f481-47c5-8d52-cacc579e7b2e

📥 Commits

Reviewing files that changed from the base of the PR and between 3e926b0 and 52d0103.

📒 Files selected for processing (26)
  • docs/archive-backup.md
  • docs/atlas/00-core.md
  • docs/atlas/storage.md
  • docs/data-model.md
  • docs/internals.md
  • docs/schema.md
  • docs/security.md
  • polylogue/storage/blob_integrity.py
  • polylogue/storage/sqlite/archive_tiers/__init__.py
  • polylogue/storage/sqlite/archive_tiers/archive_plan.py
  • polylogue/storage/sqlite/archive_tiers/audit.py
  • polylogue/storage/sqlite/archive_tiers/source.py
  • polylogue/storage/sqlite/archive_tiers/user.py
  • tests/unit/annotations/test_seed_ontology.py
  • tests/unit/cli/test_archive_maintenance_cli.py
  • tests/unit/context/test_hermes_delivery_correlation.py
  • tests/unit/daemon/test_daemon_cli.py
  • tests/unit/daemon/test_metrics_endpoint.py
  • tests/unit/maintenance/test_archive_verification.py
  • tests/unit/storage/test_archive_readiness.py
  • tests/unit/storage/test_archive_tiers_assertions.py
  • tests/unit/storage/test_connection_profile.py
  • tests/unit/storage/test_context_delivery_write.py
  • tests/unit/storage/test_durable_fresh_ddl_parity_retirement.py
  • tests/unit/storage/test_durable_tier_version_authority.py
  • tests/unit/storage/test_user_settings_write.py

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-21T20:07:56.502303Z 52d0103 PR opened
🔒 Security Review ✅ Completed 2026-09-21T20:06:39.984890Z 52d0103 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Sinity
Sinity enabled auto-merge (squash) September 21, 2026 19:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread polylogue/storage/blob_integrity.py Resolved
@Sinity
Sinity merged commit f0c3e26 into master Sep 21, 2026
3 checks passed
@Sinity
Sinity deleted the fix/durable-tier-floor branch September 21, 2026 20:09
@Sinity

Sinity commented Sep 29, 2026

Copy link
Copy Markdown
Owner Author

Closing out open Codex review threads on this PR (evidence checked against master at 64a9bd0):

  • P1 polylogue/storage/sqlite/archive_tiers/archive_plan.py:193: Fixed on master (checked at 64a9bd0): The lineage check now fingerprints any tier whose live version is at or below its recorded birth version (version <= versions[tier.value], archive_plan.py:165). A transplanted version-1 file under a version-2 birth record is therefore compared against the recorded fingerprint and refused.

Resolving every thread listed; confirmed defects are fixed under the named bead.

@Sinity

Sinity commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

Historical Codex triage: evidence checked at 5ebcfe5. This records that source revision; it does not claim a fresh review of current master.

  • 72.F058 / P1: refuted at the checked revision: The requested fallback reads a pre-reset source database with a colliding v1 stamp. AGENTS.md:75-76 forbids prior Polylogue state readback, and :192-194 rejects compatibility fallbacks; the old raw_sessions carrier is not a supported fresh-format input.

Only the rows listed above are dispositioned. Held findings remain open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant