Repository navigation
fix: align CLI surface corpus contracts - #4226
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: df1e0fecf0
ℹ️ 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".
#4227) ## 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.com/claude-code) https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA
## 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
|
Closing out open Codex review threads on this PR (evidence checked against master at ef10e59):
Resolving the fixed, stale and refuted threads; tracked threads stay open. |
|
Closing out open Codex review threads on this PR (evidence checked against master at bf68918):
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
Round-2 corpus-fix lane (surface cluster): fixes the MCP structured-filter regression and updates genuinely stale CLI expectations from the corpus run
2b00a953failure set.Problem
devtools verify --all(corpus run 2b00a953) failed 9 surface-cluster tests. One was a real regression:build_query_specpassed descriptor-internal parameter names throughnormalize_query_paramsintoSessionQuerySpec.from_params, which consumes the public query vocabulary — every structured MCP filter was silently discarded (caught bytest_query_cases_agree_across_public_adapters). The rest were stale expectations (unified row fields, basename display, relative time, priced/exact cost status precedence, embed activation fixture hashes, plain-snapshot merged fields).Solution
polylogue/mcp/query_contracts.py: stop converting public names to internal names beforefrom_params; validation still runs on the public vocabulary.test_select,test_insights,test_embed_activation, and the plain CLI snapshot.Deliberately excluded from the lane's original output: a
migration_runner.pychange that removed_checkpoint_live_tierand rewrotetest_backup_verify_then_migrate_tier_cli_applies_user_migration_with_receiptto assert the migration fails. That corpus failure is a real regression from #4200 (user v11 train declares runtime consumers with no durable probe adapter) and is being fixed properly in a follow-up, not enshrined.Verification
devtools test tests/unit/cli/test_select.py tests/unit/cli/test_insights.py tests/unit/cli/test_embed_activation.py tests/unit/test_cross_surface_agreement.py tests/unit/mcp/test_query_request_contracts.py→ 110 passed, 1 failed — the failure istest_mcp_query_boundary_rejects_unknown_and_allows_only_declared_paste_alias, a pre-existing corpus failure assigned to the rest-cluster lane (untouched by this diff).devtools verify --quickgreen in-lane.Residuals
🤖 Generated with Claude Code
https://claude.ai/code/session_014BQsaB1NBY8mTR6yZByfMA