Skip to content

fix(storage): make below-floor durable trains applicable and probeable - #4227

Merged
Sinity merged 1 commit into
masterfrom
fix/user-v11-train
Aug 26, 2026
Merged

Sinity merged 1 commit into
masterfrom
fix/user-v11-train

Conversation

@Sinity

@Sinity Sinity commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the corpus-red durable-migration route: archives below a tier's adoption floor could never apply the new numbered trains (user v11 from #4200, source v37 from #4185) through the production migrate-tier route.

Problem (evidence)

Two defects, both introduced with recently landed trains:

  1. Stale-manifest authorization: with an archive below the adoption floor (e.g. user v3), execute_durable_change_train runs the legacy climb to the floor — mutating the live tier — then hands the same backup manifest to train backup authorization, which re-fingerprints the live tier and dies with the misleading migration backup receipt live tier size mismatch (corpus failure test_backup_verify_then_migrate_tier_cli_applies_user_migration_with_receipt).
  2. Missing probe adapters: the v11 user train declares runtime consumers promote_query / apply_query_excision, and the v37 source train declares publish_source_generation / source_generation_census — none had a durable probe adapter, so even with a fresh backup the trains failed at the proof stage with no durable probe adapter (also red: test_continuity_migrations_have_a_deployable_cross_tier_compatibility_window[order0|order1]).

A dispatched fix lane originally "fixed" this by deleting _checkpoint_live_tier from migrate_archive_tier and rewriting the CLI test to assert the migration fails; that was rejected at harvest (see #4226's exclusion note).

Solution

  • The executor now stops with a typed, actionable error after the legacy climb when a next train exists: the climb is committed and safe, and the operator is told to take a fresh verified backup of the migrated tier and rerun. This keeps backup authorization's exact-live-bytes binding strong instead of weakening recovery to restore-and-replay.
  • Added four probe adapters following the existing in-memory projected-tier idiom: query promotion under a complete privacy contract, query excision into the non-resurrection ledger, source-generation publication of every manifest coordinate, and reconciliation census (pending manifests report unsealable).
  • Rewrote the CLI test as the honest two-step route: v3 → climb to floor + typed instruction (tier intact at v10) → fresh backup → train applies v11, query_excision_ledger present.

Verification

  • devtools test tests/unit/cli/test_archive_maintenance_cli.py tests/unit/storage/test_query_objects.py tests/unit/storage/test_durable_migrations.py → 197 passed.
  • devtools test tests/unit/storage/test_durable_change_train.py tests/unit/storage/test_source_items.py → 107 passed (both continuity-window params were red before the source probes).
  • devtools verify --quick → all 15 gates ok.

Residuals

  • The below-floor route is deliberately two invocations (climb, then train with a fresh backup). Single-invocation UX would need a new authorization mode binding pre-climb evidence; not taken here to keep the recovery contract byte-exact.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA

@Sinity
Sinity enabled auto-merge (squash) August 26, 2026 07:37
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: ff558115-12ba-4908-bf21-87682002e17a


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.

@Sinity
Sinity merged commit 87cd837 into master Aug 26, 2026
2 of 3 checks passed
@Sinity
Sinity deleted the fix/user-v11-train branch August 26, 2026 07:38
Sinity added a commit that referenced this pull request Aug 26, 2026
## Summary
Round-2 corpus-fix lane (rest cluster): closes out the remaining corpus
run `2b00a953` failures — lineage/MCP/storage/daemon — and repairs the
MCP alias regression that #4226 introduced.

## Problem (evidence)
31 corpus failures across the rest cluster, classified per-failure:
- **Real regressions**: the daemon's `/api/operation` route had no
`RouteContract` entry (contract census red); MCP query alias lowering
(`_mcp_aliases` mapping every declared name to its dataclass
`spec_attr`) broke list pagination, provider/tag filters, cross-adapter
query parity, and retrieval readiness; the startup recovery read path
opened SQLite outside the controlled interruptible reader.
- **Stale expectations**: lineage validation (index v73), model runtime
(#4173), blob-GC v33 (schema evolution through v37 — test now pins
`target_version=35`, the version its DDL snapshot proves), hook carrier
identity (#4171), continuity capability catalogue (#4190), dev-loop
worker count (#4222), and others per the lane report.
- Additionally, #4226's `normalized = dict(params)` skipped
normalization entirely, silently dropping the three genuine MCP-only
alias spellings (`has_tool_use`, `has_thinking`, `has_paste_evidence`) —
`SessionQuerySpec.from_params` only reads the `filter_has_*` names.
Restored `normalize_query_params` with the alias map narrowed to exactly
those three.

## Verification
- All 40 nodeids from the corpus failure set
(`/realm/tmp/work/corpus5-failed.txt`) → **40 passed** on this branch
(rebased on master with #4226 + #4227 in).
- `devtools test tests/unit/mcp/test_query_request_contracts.py
tests/unit/test_cross_surface_agreement.py
tests/unit/storage/test_retrieval_readiness_laws.py
tests/integration/test_mcp.py` → 26 passed.
- `devtools verify --quick` → all 15 gates ok.

## Residuals
- One listed failure
(`test_submit_failure_cleans_every_admitted_future_and_reservation`) was
not reproducible in-lane and is unchanged; if it reappears in the corpus
rerun it needs its own investigation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
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