Repository navigation
fix(storage): skip backup manifest requirement for additive-only migrations - #2905
Conversation
…ations Problem: `ops maintenance migrate-tier` required a verified backup manifest for every durable-tier migration, even ones that only add a new empty table (010_sinex_publication_obligations.sql, 011_excised_content.sql) and touch no existing column or row. That's unnecessary operator friction for migrations that carry zero data-loss risk. Solution: migration files can opt out via a leading `-- migration-safety: additive-no-backup` marker comment. migration_runner.py tracks `requires_backup` per loaded MigrationStep and only demands (and validates) a backup manifest when at least one step in the applied chain lacks the marker. `--backup-manifest` on `ops maintenance migrate-tier` is now optional, required only when the runner determines it's needed. Verification: devtools test tests/unit/storage/test_durable_migrations.py tests/unit/cli/test_archive_maintenance_cli.py -- 89 passed, 5 failed (all 5 pre-existing and unrelated, tracked in polylogue-p5li: assertion-export ordering, embedding-orphan reconciliation, and one trigger-already-exists failure, independently confirmed present on unmodified origin/master). mypy --strict clean, ruff clean. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GjyDHiwc5QfXGgDMGuFEB8
DisplayTitleTagsMixin imported SessionId from polylogue.types, a module that doesn't exist (the real path is polylogue.core.types). Because the module uses `from __future__ import annotations`, the broken import never raised at runtime -- annotations are lazily stored as strings -- but mypy couldn't resolve the name, silently typed `self.id` as Any, and flagged `display_title`'s `self.id[:8]` return as "Returning Any from function declared to return str". This was blocking the pre-push devtools verify --quick gate for unrelated pushes. Verification: mypy --strict polylogue/archive/session/display_mixin.py clean; devtools test tests/unit/core/test_session_semantics.py tests/unit/sources/test_null_guard_properties.py -- 56 passed. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GjyDHiwc5QfXGgDMGuFEB8
|
Warning Review limit reached
Next review available in: 11 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughMigration steps now identify whether backups are required, allowing marked additive source migrations to run without backup manifests. The CLI accepts optional manifests and emits null when omitted. A session display mixin also updates its ChangesMigration safety handling
Session type import correction
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Operator
participant MigrateTierCLI
participant MigrationRunner
participant SourceSQLite
Operator->>MigrateTierCLI: migrate-tier source
MigrateTierCLI->>MigrationRunner: migrate_archive_tier(backup_manifest=None)
MigrationRunner->>SourceSQLite: inspect version and migration chain
MigrationRunner->>MigrationRunner: detect additive-no-backup steps
MigrationRunner->>SourceSQLite: apply versions 10 and 11
MigrationRunner-->>MigrateTierCLI: MigrationResult with null backup receipt
MigrateTierCLI-->>Operator: JSON success payload
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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: a8a4d4d78b
ℹ️ 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".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@polylogue/storage/sqlite/migration_runner.py`:
- Line 75: Update the requires_backup calculation in the migration runner to
recognize _ADDITIVE_NO_BACKUP_MARKER only when it is an exact header directive,
not when it appears in explanatory text, SQL literals, later SQL content, or
with trailing text. Preserve backup requirements for all non-exact matches, and
add tests covering later occurrences and markers followed by trailing text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8ce30da8-7bb2-4546-9b0e-d6bbff25cf88
📒 Files selected for processing (7)
polylogue/archive/session/display_mixin.pypolylogue/cli/commands/maintenance/_migrate_tier.pypolylogue/storage/sqlite/migration_runner.pypolylogue/storage/sqlite/migrations/source/010_sinex_publication_obligations.sqlpolylogue/storage/sqlite/migrations/source/011_excised_content.sqltests/unit/cli/test_archive_maintenance_cli.pytests/unit/storage/test_durable_migrations.py
Two real issues from PR #2905's automated review: 1. Version/step selection was read once, before BEGIN IMMEDIATE, so a concurrent migrate_archive_tier call that advanced the tier between the read and the lock produced a confusing "expected version N, found M" instead of the correct no-op result. Extracted _pending_migration_steps() and call it both in the lock-free precheck (fast-fail on a missing backup manifest without wasting a write-lock acquisition) and again, authoritatively, right after BEGIN IMMEDIATE acquires the lock. 2. The additive-no-backup marker used substring matching (`_ADDITIVE_NO_BACKUP_MARKER not in sql`), which would waive the backup requirement if the marker text ever appeared in a comment, string literal, or later in the file. Added _requires_migration_backup(), requiring the marker to be the file's first non-blank line. Fixing (1) surfaced a real regression in my own earlier refactor: the original code called validate_migration_backup_manifest() twice -- once before BEGIN IMMEDIATE (establishing a WAL-empty baseline) and once after (re-validating with the same connection, so a nonempty WAL from an intervening write raises "changed before the migration lock" instead of migrating over data the verified backup never covered). My precheck/lock split had collapsed this to a single post-lock call, silently dropping that race protection -- test_migration_rejects_live_writes_committed_after_receipt_validation caught it immediately (turned into "database is locked" instead of the expected MigrationError, since the test's simulated concurrent writer now raced the migration's own transaction instead of the pre-lock read). Restored the paired pre-lock validation call. Verification: devtools test tests/unit/storage/test_durable_migrations.py tests/unit/cli/test_archive_maintenance_cli.py -- 90 passed, 5 failed (all 5 pre-existing and unrelated, tracked in polylogue-p5li, independently confirmed present on unmodified origin/master). mypy --strict clean across polylogue/ (992 files). ruff clean. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GjyDHiwc5QfXGgDMGuFEB8
## Problem `-- migration-safety: additive-no-backup` waives the verified-backup requirement for a numbered migration on an irreplaceable durable tier. It was a self-declaration nothing checked: `_requires_migration_backup` read the header line and never looked at the statements the file carries, so a migration containing `DELETE`, `DROP`, `ALTER` or `CREATE TABLE ... AS SELECT` could apply to `source.db`, `user.db` or `audit.db` with no recovery artifact. Raised by review against source slot 002. That classification is correct for slot 002 -- its whole statement set is one `CREATE TABLE IF NOT EXISTS` whose column list is identical to the write-path shape it adopts and to canonical `SOURCE_DDL`, and it writes, reads and moves no row -- and the class itself is the operator-ratified one shipped in #2905 with its own `additive-no-backup` authorization mode. What was missing is the proof, not the classification. ## Solution A file claiming the marker is validated at the discovery choke point every caller passes through: every statement must be a `CREATE TABLE`/`VIEW`/`INDEX` that is not `CREATE TABLE ... AS SELECT`. `CREATE TRIGGER` is deliberately excluded -- it destroys nothing when applied, but it arms future writes against existing rows, which is not what "additive" claims. ## Verification Seven false claims (row delete/update/insert, table drop, column add, create-as-select, trigger) are refused by name; an honest table/index/view migration still waives the backup; an unmarked migration still requires one; and the shipped source slot 002 still loads with `requires_backup=False`, so no shipped behaviour changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy
…tier (#5408) ## Summary Seventeen live P1 review findings closed across the storage tier, consolidating two review lanes that were dispatched over overlapping finding sets. Supersedes #5406, whose six non-overlapping fixes are cherry-picked here with `-x` attribution. ## Problem A `git blame` filter over the review backlog selected 80 storage P1 findings whose anchored line had not moved since review. Full triage at HEAD: **49 LIVE, 27 STALE, 4 WONTFIX** — the filter over-selects by ~34% in this area, with no detectable false negative. Its failure mode is exactly as predicted: heavy refactors move code without touching the anchored line (`bootstrap.py` was 6-for-6 stale after its rewrite), and the durable-lineage reset invalidated the whole v37/v40 migration family. Two lanes worked this set concurrently and independently fixed three of the same defects. Landing both would have meant a 12-commit rebase across three shared files, so they are consolidated here instead. ## Solution **Reads and cost** - `archive_query_reads.py` ranked the entire partition before applying `unit_rank <= ?`. Measured at base on seeded archives, one 201-row page: **427k / 813k / 1585k VDBE step units** over 2,000 / 4,000 / 8,000-message sessions — linear in partition size — against a flat 42k for the indexed read. `_bounded_partition_message_ids` now does one indexed `ORDER BY … LIMIT` per selected session over `idx_messages_session_position`, merges, orders and pages the candidates, then runs the expensive projection on the page alone. **After: flat 47k at all three sizes.** #5381's fairness contract is preserved — each session keeps the same allowance in its own transcript order — and its SKEWED fixture still passes. **Durable integrity** - The `additive-no-backup` marker was a self-declaration nothing checked: `_requires_migration_backup` read the header and never looked at the statements. The finding is **declined as filed** — that classification is operator-ratified from #2905 with its own authorization mode, and slot 002 is one `CREATE TABLE IF NOT EXISTS` that writes, reads and moves no row — but the unchecked claim is now proved: a file claiming the marker must contain only `CREATE TABLE/VIEW/INDEX`, refused by name otherwise. Slot 002 still loads `requires_backup=False`, so no shipped behaviour changed. - A durable tier below its recorded birth version was accepted. Bootstrap stamps `tier_versions.source = 2`; a transplanted version-1 database cleared the floor and skipped the fingerprint because `1 != 2`. The condition is now `version <= versions[tier]`, so the below-birth case is decided by the recorded fingerprint rather than bypassed. - `acquired_with_bytes_count` decided coverage with `BlobStore.exists`, so an object overwritten at the recorded hash's path counted as coverage with both debt counters zero and `ok` true. It now requires a re-hash, and a present-but-contradicted object lands in a new `acquired_corrupt_count` bucket kept **separate** from `acquired_missing_blob_count` — the object is present, so re-fetch is the wrong remedy. - `additional_blob_refs` bypassed the excision ledger. **Lineage** - `_record_lineage_prefix_debt` resolved `ops.db` via `PRAGMA database_list`, which SQLite answers with the *resolved* promotion symlink, so on a promoted generation it named a nonexistent file and returned silently. New `archive_root_for_index_path` unwinds the generation directory; `index_generation._is_generation_member` now delegates to it so the depth rule has one definition. - A witness-mismatched branch point was re-anchored onto different content. The re-anchor now applies only when the replacement's content address matches the stored witness; otherwise the edge stays dangling, is counted, and its child is named stranded with retryable debt. The repairable half still re-resolves in-write. - Recursive topology DFS hit `RecursionError` at the writer's own 1024 budget. The iterative walk handles an 1100-deep lineage, and **3000 random graphs produce identical cycle sets under both implementations**. - A relocated lineage anchor was not reported as resolved. **Saved views, frontier, misc** - View rename and delete both left `query_names.watch = 1`, so one saved view returned two watched definitions and a deleted view stayed watched. Both bindings are cleared in the same transaction as the upsert/tombstone. - A content-addressed `pass_id` made `INSERT … ON CONFLICT DO NOTHING` never reopen an acknowledged obligation whose evidence still reproduced. Reconciliation now mints a successor derived from the row it supersedes, so the operator's resolution receipt stays intact and repeated identical passes converge on the same successor. A chain beyond 64 is refused by name. - Source blob authority is earned from the catalog, not the stamp. The version-1 instance is stale (#5387 raised `SOURCE_TIER_VERSION` to 2), but the collision moved with the stamp: a pre-reset database stamped exactly 2 reproduces it today. - EOF after a short HTTP body persisted as `acquired` instead of `partial`; durable-writer lease checks used `self.archive_root` rather than the declared root; an unreadable schema identity became a non-transient skew instead of a retry. ## Conflict resolution The two lanes' frontier fixes **diverge semantically**. #5406 reopens the same row, keeping the original `blocker_id`; this branch mints a successor id. Its test asserting the id is unchanged is therefore true of its fix and false of this one, so it was deliberately **not** taken — only the topology half of that commit is cherry-picked, with the reasoning in the commit message. `tests/unit/storage/test_frontier_reopen.py` pins the behaviour that actually ships. ## Verification Rebased onto master `17566b048` and re-verified there. Two gate failures were found and fixed during the rebase, both described below. - `devtools verify --quick` → **25/25 gates green** at `03bc4b0f8` pre-rebase; re-run clean after each rebase fix. - `devtools gate layering` → **exit 0, 0 violations** (it was red mid-rebase; see below). - `devtools gate atlas` → **exit 0**, "Every atlas citation and declared owning gate resolves", 40 checkable symbol claims, **0 misaimed** (was 1). - `devtools render all --check` → exit 0, `grep -c 'out of sync'` = **0**, checked explicitly rather than inferred from the exit code. - Focused batch A (7 files) → **exit 0, 40/40**. Receipt `.cache/verify/runs/20260922T072851Z-focused-test-1387181-0795e112/`, `git_head dc2222cbb`, not dirty. - Focused batch B (7 files) → **exit 0, 62/62**. Receipt `.cache/verify/runs/20260922T072855Z-focused-test-1387396-15cfa190/`. - The delta from the tested SHA `dc2222cbb` to final head `9aa1a247b` is `docs/atlas/daemon.md` and `docs/plans/durable-write-census.yaml` only — both gate inputs that no test reads. Stated rather than claiming the receipts name the tip. - Pre-consolidation each lane established its own inherited-red baseline by detaching at `9f450db36` and diffing failing nodeid sets programmatically: `NEW = []`, `FIXED = []` on the durable-migration suites (44 inherited), and an identical two-nodeid inherited set on the daemon preflight suites. Neither absorbed nor fixed here. ### Two gates went red during the rebase **`gate layering`.** #5393 adjudicated the `query_names` watch entry to `lifecycle_transition` but kept the key on `register_query_watch`, which after this branch delegates rather than writing. The gate reported exactly that pair — `durable_write_census_stale` on the old key plus `durable_write_undeclared` on `clear_query_watch`. The key is moved to the owner that holds the statement; #5393's classification and reason are kept verbatim apart from naming that owner. Same statement, same guard `WHERE name = ? AND watch = 1`, one owner. **`gate atlas` is red on master, not on this branch.** Both cited files are byte-identical here to `17566b048`, and the gate reproduces the same single misaimed anchor at either head. #5407 moved `hook_carriers` in `intake_adapters.py` from the cited `1116-1132` to `1147-1165`, and the symbol check that notices this is recent enough that #5407's own verification predates it — a gate going red on master from two separately-green PRs. The prose is still true, so the anchor is re-aimed rather than rewritten: `FileIntakeAdapter(..., class_name="hook_carrier")` at `:1156` and the multiplexed registration at `:1165` still say what the sentence claims. ### Anti-vacuity, executed Every mutation was applied, run, and reverted — not asserted: - window rank → `allowance cost follows history: 330 -> 1199 step units for the same 201-row allowance` - watch bindings → `a deleted view's name is still watched` / `the previous name is still watched beside the new one` - ops.db root → the generation case went red while the plain-archive and no-ops-tier cases stayed green, proving the fix is not a blanket change - witness → `re-anchored onto a different message`, with `test_witness_agreement_still_repairs` green under the same mutation - attachment coverage → `a contradicted object was certified as coverage` - birth version → `DID NOT RAISE RuntimeError`, both opposite-direction cases green - source blob authority → only the `stamp_offset=0` parametrisation went red; the other two staying green **is** the evidence the finding as filed is stale - frontier reopen → `assert successor_id != original_id`, both opposite-direction cases green - additive claim → `DID NOT RAISE MigrationError` - excision ledger → both writers `ACCEPTED the excised sibling`, refs `0 → 4`; after, both refuse and an admissible sibling still writes - short body → `state=acquired retryable=False diag=''` → `state=partial retryable=True`; correct-length and undeclared-length stay `acquired` - topology → `RecursionError` over an 1100-deep accepted lineage - schema identity → `SchemaSkewError … found None` → `SchemaVersionMismatchError lifecycle_action=retry` Every test file also pins the opposite direction, so a blanket refusal or a no-op cannot pass. ## Schema closure Re-measured at the consolidated head, including the cherry-picked files the deeper lane never measured. **IN (13):** `archive_identity.py`, `index_generation.py`, `materials.py`, `derived/topology/derivation.py`, `sqlite/schema.py`, `sqlite/schema_bootstrap.py`, `sqlite/migration_runner.py`, `sqlite/query_watch.py`, `archive_tiers/{archive,archive_plan,archive_query_reads,source_write,write}.py` **out (4):** `maintenance/archive_verification.py`, `operations/ref_resolution.py`, `storage/blob_integrity.py`, `storage/raw_reconciler.py` Membership is unchanged, so `gate schema-closure` needed no `--update` and passes. - `DerivedTier.index`: `752d44b9ad5a2d0d08fdff7eababe6334575ea4223a44d60b05c41f9ea0eced2` (base `17566b048`, measured in a detached worktree at that exact SHA) → **`c284f2341743d8a8ac36009fe8281dfe206f04ad795c8221f3798ceb2bdd636b`** - `DerivedTier.ops`: `86866235…` **unchanged** The archive must reconverge. **This must land before a fresh rebuild starts, never during one.** Both values are measured at the current base rather than the stale one the lane first reported; re-measure again if master moves before merge. ## Scope expansion (declared) - `polylogue/maintenance/archive_verification.py` — the attachment-coverage fix is inert without it; the reviewer's complaint names the surface, so `acquired_corrupt_count` had to enter `debt_count`, `details` and the summary, and the green wording moved from "have bytes" to "re-hash to their recorded bytes". - `docs/plans/durable-write-census.yaml` — moving the `query_names` watch-clearing UPDATE into `clear_query_watch` made `gate layering` red with one `durable_write_undeclared` and one `durable_write_census_stale`. The commit renames exactly that one key (same statement, same table, one owner) and is isolated as `7e38022b6` so it can be reverted alone. - `tests/unit/storage/test_durable_change_train.py` — three rollback tests reached their mid-apply failure with `INSERT INTO table_that_does_not_exist` under an `additive-no-backup` header, which the new guard refuses at discovery. The fixture now fails additively (two conflicting `CREATE TABLE durable_items`), raising at the same point with an additive-only statement set and preserving every assertion. Isolated as `fa7965cf8`. - `polylogue/operations/ref_resolution.py` — the relocated-lineage finding is anchored in `storage/block_anchor.py`, but the resolver is correct; the consuming boundary that drops the state lives in `operations/`. ## Residuals - **Watch baseline** (#5375) reproduces and is **not** fixed. `save_view(watch=True)` writes `queries` + `query_names` only, and `_materialize_watch_evaluation` returns early when `baseline is None`, so the first archive change after creation is absorbed silently. The remedy needs scheduling the storage tier does not own: neither creation route carries a `CanonicalPlanEvaluator` (it is injected into the daemon stage by `make_standing_query_stage`), and calling a planner from the substrate is a substrate→surface import the ratchet forbids outright. `get_watched_query_baseline(...) is None` is already the durable "never evaluated" signal, so no migration is needed for the state — only something that drives an evaluation after creation. For the daemon/standing-query owner. - **FK-cascade deletion** — `_delete_sessions_without_fk_cascade` discovers only tables with a direct `REFERENCES sessions` FK. Five tables moved to `FOREIGN KEY(message_id, session_id) REFERENCES messages(...)`, so with FKs suspended during bulk ingest a session replacement commits orphaned attachment/paste/edit/web-content/action rows. Needs a transitive closure through `messages`/`blocks`; the fix site is in `pipeline/`. - **Readiness** still treats an absent blocker row as proof, and `inspect_raw_authority_frontier` has no daemon stage. This branch closes the reopen half only. - **Archive-root cluster** — root derived from the active index's physical directory rather than `archive_file_set_root` also affects blob GC, Drive catch-up, and two unleased bootstrap/adoption paths. Not fixed: each moves a refusal on a route not exercisable without a real daemon lease. - `scan_attachment_coverage` now re-hashes every acquired attachment blob on every call. `archive verify` already re-hashes the whole namespace, but other callers were not surveyed for a cost budget; a presence-only projection would need its own explicitly-named unverified term, never a silent fallback. - The `additive-no-backup` guard excludes `CREATE TRIGGER` deliberately — it destroys nothing at apply time but arms future writes against existing rows. A legitimately additive trigger migration is the decision to revisit; that is a judgement call, not a measurement. - `_iter_migration_statements` duplicates the statement-splitting logic of `_execute_migration_sql`; they should share one splitter, kept separate here to avoid touching the apply path in a review sweep. - `relink_orphaned_attachments` still has no production caller. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01ToWqpkXotr573DiQex5vcy <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Attachment verification now detects corrupted content instead of treating it as valid. - Incomplete downloads are marked retryable when fewer bytes arrive than declared. - Relocated references now report as resolved when valid. - Saved-view watches are correctly retired during rename and deletion. - Excised attachments can no longer be reintroduced through session imports. - Schema read failures now receive retryable handling instead of incorrect rebuild guidance. - **Performance** - Large per-session message queries use bounded reads to reduce unnecessary database work. - Deep lineage processing no longer risks recursion-limit failures. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
|
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
ops maintenance migrate-tierno longer forces a verified backup manifest when a durable-tier migration chain is entirely additive (new tables only, no existing data touched)-- migration-safety: additive-no-backupmarker comment;migration_runner.pyrequires (and validates) a backup manifest only when at least one applied step lacks the markerpolylogue.typesdoesn't exist; correct path ispolylogue.core.types) indisplay_mixin.pythat was silently typed asAnyby mypy and blocking the pre-push verify gate for any pushProblem
Every durable-tier migration required an operator to produce and verify a backup manifest before running, even for migrations that only add a new empty table with zero data-loss risk. That's unnecessary friction — evidenced by the two most recent source-tier migrations (010_sinex_publication_obligations.sql, 011_excised_content.sql), which are both purely additive.
Solution
MigrationStepnow carries arequires_backup: bool, computed from whether its SQL file contains the-- migration-safety: additive-no-backupmarker.migrate_archive_tieronly demands/validates a backup manifest when the applied migration chain contains at least one step without that marker.--backup-manifeston the CLI is now optional (required=False), required only when the runner determines it's actually needed.Verification
devtools test tests/unit/storage/test_durable_migrations.py tests/unit/cli/test_archive_maintenance_cli.py— 89 passed, 5 failed (all 5 pre-existing and unrelated, independently confirmed present on unmodifiedorigin/master, tracked inpolylogue-p5li: assertion-export ordering ×2, embedding-orphan reconciliation ×2, one trigger-already-exists collision)mypy --strictclean (including thedisplay_mixin.pyimport fix)ruff check/formatcleandevtools verify --quick(pre-push gate): exit 0, all 16 steps greenCo-Authored-By: Claude Sonnet 5 [email protected]
Summary by CodeRabbit
New Features
Bug Fixes