| index 447e69f7c..2d2da2d40 100644 |
| --- a/docs/superpowers/plans/2026-11-08-instance-restore-658.md |
| +++ b/docs/superpowers/plans/2026-11-08-instance-restore-658.md |
| @@ -10,7 +10,7 @@ |
| |
| **Spec:** `docs/superpowers/specs/2026-11-07-instance-restore-658-design.md` (rev 5, approved by Paul 2026-11-08). Read it first; this plan argues from it and does not repeat its reasoning. |
| |
| -**Plan rev 2** (2026-11-08) answers Astra plan round 1 (`CODEX-FINDINGS-instance-restore-658-plan-R1.md`, NOT READY: P1 1-3, P2 4-8); dispositions at the end. |
| +**Plan rev 3** (2026-11-08). Rev 2 answered Astra plan round 1; round 2 (`CODEX-FINDINGS-instance-restore-658-plan-R2.md`, NOT READY) triggered stopping rule 2 in the refusal-precedence family, and Paul chose the cut on #658 (2026-11-08): the admission rule is stated once, as the precedence table below, enforced in `restoreProof` alone and checked against an independent oracle. Dispositions at the end. |
| |
| ## Global Constraints |
| |
| @@ -24,6 +24,28 @@ |
| - Commit subjects under 80 characters, body after a blank line, ending `Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>`. |
| - One amadan task per plan task on the branch. |
| |
| +## The admission table |
| + |
| +`restoreProof` returns the first row that applies, in this order, and nothing else decides a restore. The table test (Task 5) and the simulation's oracle (Task 7) each encode this table independently. |
| + |
| +| # | Condition | Answer | |
| +|---|---|---| |
| +| 1 | any source it reads cannot be read (mark, slot, store, record, staging list) | R1, 503 | |
| +| 2 | the mark or the slot does not name the account and app (including an inventory mark with no owner) | S1, 409 | |
| +| 3 | any allocation, retirement or migration for the host is pending (`PendingForHost`) | R1, 503 | |
| +| 4 | a valid record of this account and app stands under the key | `instance <host> already exists`, 409 | |
| +| 5 | `@mode` not `active`, or lifetimes off, or claims on | R2, 409 | |
| +| 6 | the slot is not `retired` | R8, 409 | |
| +| 7 | a lineage row bound to another app lifetime | R4, 409 | |
| +| 8 | no origin, a row with neither flag, the lowest row not the origin, or no row at the slot's incarnation | R8, 409 | |
| +| 9 | the newest retirement (by incarnation, then `created_at`, then `rowid`, all descending) is not the slot's incarnation, names someone else, or is not restorable | R8, 409 | |
| +| 10 | the stored body, the requested kind and fields, the app's placement or pool, or the built record (deciding call) is not plain | R7, 409 (or 422; see Task 5) | |
| +| 11 | the stored body's region is not the console's own, or the request names another region | R5, 409 | |
| +| 12 | any object under `moves/<host>/` | R6, 409 | |
| +| 13 | otherwise | eligible | |
| + |
| +Rows 1 and 3 both answer R1; row 1 can fire at any row's read. Row 2 always precedes any detailed answer, so another owner sees only S1 (or R1 on a read failure). |
| + |
| ## Review Focus |
| |
| 1. A restore and an ordinary create of the same hostname at the same moment: one wins, the other answers its normal refusal; never two records. (Task 6, `TestRestoreRacesOrdinaryCreate`.) |
| @@ -69,11 +91,11 @@ Tasks 3, 4, 5 and 6 touch a security gate (the hostname history and the create d |
| - `Allocation` gains `RestoreOrigin bool` and `RestoreOf string`; `BeginAllocation` writes them. |
| - `Retirement` gains `RecordBody []byte`; `BeginRetirement` writes it (nil allowed). |
| - `func (s *Store) HostLineage(host string) ([]Allocation, error)`: every non-`void` allocation row for host, ascending by incarnation, all columns. |
| - - `func (s *Store) NewestRetirement(host string) (*RetirementEvidence, error)`: the row with the highest incarnation (ties: latest `created_at`), or nil. |
| + - `func (s *Store) NewestRetirement(host string) (*RetirementEvidence, error)`: ordered by incarnation, then `created_at`, then `rowid`, all descending; the first row, or nil. |
| - `type RetirementEvidence struct { Retirement; RecordBody []byte; Restorable bool }` |
| - `func (s *Store) MarkRetirementRestorable(opID string) error`: sets `restorable = 1` on a `normal` row only; errors on any other kind or a missing row; idempotent. |
| |
| -- [ ] **Step 1: Write the failing tests** `TestAllocationRestoreColumns` (round-trip `RestoreOrigin`, `RestoreOf` through `BeginAllocation` and `HostLineage`; a `void` row is excluded; order is by incarnation), `TestRetirementEvidence` (round-trip `RecordBody`; `NewestRetirement` picks the highest incarnation; `MarkRetirementRestorable` on a cleanup or orphan row errors and leaves `Restorable` false; twice on a normal row is nil), `TestRestoreColumnsMigrateOldRows` (a database created by the previous schema opens; old rows read `RestoreOrigin=false`, `RestoreOf=""`, `RecordBody=nil`, `Restorable=false`). |
| +- [ ] **Step 1: Write the failing tests** `TestAllocationRestoreColumns` (round-trip `RestoreOrigin`, `RestoreOf` through `BeginAllocation` and `HostLineage`; a `void` row is excluded; order is by incarnation), `TestRetirementEvidence` (round-trip `RecordBody`; `NewestRetirement` picks the highest incarnation; two rows with the same incarnation and `created_at` and opposite `restorable`, inserted in both orders: the later insert wins; `MarkRetirementRestorable` on a cleanup or orphan row errors and leaves `Restorable` false; twice on a normal row is nil), `TestRestoreColumnsMigrateOldRows` (a database created by the previous schema opens; old rows read `RestoreOrigin=false`, `RestoreOf=""`, `RecordBody=nil`, `Restorable=false`). |
| - [ ] **Step 2:** Run `go test ./internal/console -run 'TestAllocationRestoreColumns|TestRetirementEvidence|TestRestoreColumnsMigrateOldRows'`. Expected: FAIL (fields undefined). |
| - [ ] **Step 3:** Add the migrations: `ALTER TABLE host_allocations ADD COLUMN restore_origin INTEGER NOT NULL DEFAULT 0;`, `ALTER TABLE host_allocations ADD COLUMN restore_of TEXT NOT NULL DEFAULT '';`, `ALTER TABLE record_retirements ADD COLUMN record_body BLOB;`, `ALTER TABLE record_retirements ADD COLUMN restorable INTEGER NOT NULL DEFAULT 0;`. Implement the accessors; extend `retirementInsert` and every SELECT that scans these tables. |
| - [ ] **Step 4:** Run the same tests, then `go test ./internal/console -run 'Lifetime|Retire|Allocation'`. Expected: PASS. |
| @@ -135,9 +157,10 @@ Tasks 3, 4, 5 and 6 touch a security gate (the hostname history and the create d |
| - `Owner` false: the door answers S1 (`msgHostUsed`, 409), unless `Refusal` is R1. |
| - `Duplicate` true (owner, and a valid record of this account and app stands under the key): the door answers `instance <host> already exists` (409), as an ordinary create would. Checked right after stage 1, before any eligibility item. |
| - `Refusal` nil with `Owner` true and `Duplicate` false: eligible; `Region` is the record region to write (the stored body's, "" for home). |
| - - `func (s *Server) restoreProof(ctx context.Context, ask restoreAsk) restoreVerdict`, in this order: stage 1 (mark and slot name the account and app, compared as Task 1 Step 3 says); the duplicate check; stage 2 items 1 to 4 (pending work by `PendingForHost` answers R1); item 5 on the stored body and on `ask.From`/`ask.Import`, and on `ask.Shape` when non-nil; region (the stored body's region must be the console's own, and `ask.Region`, if not "", must equal it: R5); then `hostHasStaging` (any object R6, error R1). Refusals use Task 0's strings: R1 503, R2 409, R4 409, R5 409, R6 409, R7 409, R8 409 (422 for R7 if the door already uses it for shape refusals; say so in the commit). |
| + - `func (s *Server) restoreProof(ctx context.Context, ask restoreAsk) restoreVerdict`, implementing the admission table row by row, in its order. Row 2 compares identifiers as Task 1 Step 3 says. Row 10 checks `ask.Kind`, `ask.Addrs`, `ask.Role`, `ask.From`, `ask.Import`, `ask.Placement` and `ask.Pool` at every call, and `ask.Shape` when non-nil. Strings from Task 0. R7 is 409, or 422 if the door already answers shape refusals with 422 (say which in the commit). |
| + - `restoreAsk` gains `Kind, Role, Placement, Pool string; Addrs []string`: the request's kind, role and addrs, `appPlacement`'s answer and the manifest pool, all known before the region block. |
| |
| -- [ ] **Step 1: Write the failing table test** `TestRestoreProof` over a fixture that creates `shop.example.com` with lifetimes on and the history active, deletes it, then mutates one input per row: foreign account mark (Owner false), foreign app slot (Owner false), inventory mark with no owner (Owner false), unreadable mark (R1), a valid record of the owner under the key (Duplicate), mode incomplete (R2), lifetimes off (R2), claims on (R2), slot live with no valid record (R8), no origin row (R8), a lineage row with neither flag (R8), a lineage row on another app lifetime (R4), no row at the slot's incarnation (R8), newest retirement not restorable (R8), stored body seeded (R7), `ask.From` (R7), `ask.Shape` with a pool (R7), `ask.Shape` with HA (R7), stored body in another region (R5), request region different (R5), request naming the home region explicitly (eligible), `moves/<host>/build-state.json` present (R6), staging list error (R1), all good (eligible, `Region` equal to the stored body's, `Body` equal to the deleted record). Plus `TestRestoreProofPendingRetirement` (Review Focus 3: R1 while pending, eligible after the retirement settles) and `TestRestoreProofTakesNoLocks` (call it while holding the app lock and the hostname exclusion for the same host; it returns within 1 s). |
| +- [ ] **Step 1: Write the failing table test** `TestRestoreProof` over a fixture that creates `shop.example.com` with lifetimes on and the history active, deletes it, then mutates one input per row: foreign account mark (Owner false), foreign app slot (Owner false), inventory mark with no owner (Owner false), unreadable mark (R1), a valid record of the owner under the key and nothing pending (Duplicate), mode incomplete (R2), lifetimes off (R2), claims on (R2), slot live with no valid record (R8), no origin row (R8), a lineage row with neither flag (R8), a lineage row on another app lifetime (R4), no row at the slot's incarnation (R8), newest retirement not restorable (R8), stored body seeded (R7), `ask.From` (R7), `ask.Shape` with a pool (R7), `ask.Shape` with HA (R7), stored body in another region (R5), request region different (R5), request naming the home region explicitly (eligible), `moves/<host>/build-state.json` present (R6), staging list error (R1), all good (eligible, `Region` equal to the stored body's, `Body` equal to the deleted record). Plus `TestRestoreProofPendingRetirement` (Review Focus 3: a delete pending before N1 with the record still valid, after N1, and after N2: R1 each time, never `Duplicate`; eligible once recovery settles it), `TestRestoreProofPrecedence` (for every pair of rows i < j in the table, a state where both apply answers row i; generated from the table, not hand-listed), `TestRestoreProofStaticKind` (`ask.Kind` static or service: R7 at the early call) and `TestRestoreProofTakesNoLocks` (call it while holding the app lock and the hostname exclusion for the same host; it returns within 1 s). |
| - [ ] **Step 2:** Run `go test ./internal/console -run 'TestRestoreProof'`. Expected: FAIL. |
| - [ ] **Step 3:** Implement. |
| - [ ] **Step 4:** Run. Expected: PASS. |
| @@ -155,13 +178,13 @@ Tasks 3, 4, 5 and 6 touch a security gate (the hostname history and the create d |
| - Produces: |
| - Body field `Restore bool` with tag `json:"restore"`. |
| - The restore intent travels to the core as `withRestore(ctx, restoreAsk) context.Context` / `restoreFrom(ctx) (restoreAsk, bool)`, set only by `handleAPIInstanceCreate`. |
| - - At the mark step in `createRecordWithLifetimeLocked`, under the locks it holds: if `restoreFrom(ctx)`, re-run `restoreProof` with `Shape: &rec` (the record about to be written) and act on that verdict alone: eligible makes a `markConflict` a pass and sets `a.RestoreOf = verdict.RetirementOp`; `Duplicate` returns `release.ErrCASConflict` (the core's existing duplicate answer); any other verdict returns its refusal as a `hostsUsedError`. |
| + - In `createRecordWithLifetimeLocked`, under the locks it holds, before and independent of the `rec.DataKind()` mark block (so a static or service record cannot skip it): if `restoreFrom(ctx)`, re-run `restoreProof` with `Shape: &rec` (the record about to be written) and act on that verdict alone: eligible makes a `markConflict` a pass and sets `a.RestoreOf = verdict.RetirementOp`; `Duplicate` returns `release.ErrCASConflict` (the core's existing duplicate answer); any other verdict returns its refusal as a `hostsUsedError`. |
| - C2: in the same core, when an ordinary create's mark step answers S1, run `restoreProof` with `Shape: &rec`; if eligible, the refusal message is C2 instead of S1. (`markForCreate` only sees `HostUse`, so the hint is decided here, where the record is.) |
| - Response gains `"restore": true` on a restore. |
| |
| -- [ ] **Step 1: Write the failing door tests** through the real door (production-wired: real handler, store, `ltStore` bucket): `TestRestoreRoundTrip` (create, write a row to the replica prefix, delete, restore: 201 with `restore: true`, the record's host and region match, incarnation is N+1, the allocation carries `RestoreOf`), `TestRestoreTwice` (Review Focus 4), `TestRestoreRetriedAfterSuccess` (Review Focus 2: the first restore's response is dropped, the retry answers `instance <host> already exists`, no second allocation), `TestRestoreRecordAppearsBetweenEvaluations` (a record lands after the early proof, paused with `pauseGate`: the locked evaluation answers the duplicate), `TestRestoreRegion` (Review Focus 5: none, the home region named explicitly, and the console's own region all pass; another region is R5; with the app's default region set to another region, a restore still writes the stored body's region), `TestRestoreIgnoresPlacement` (the app gains a fleet placement or manifest pool after the delete: the locked evaluation sees the built record and answers R7), `TestRestoreStagingRefused` (any object under `moves/<host>/`, including only `build-state.json`: R6; a listing error: R1; staging appearing between the evaluations, via `pauseGate`: R6 from the locked one), `TestRestoreSkipsLeftoverRailOnlyForOwnReplica` (a restore over `instances/<host>` passes; an ordinary create over the same leftovers still gets the rail's refusal), `TestRestoreForeignOwnerSeesOnlyS1` (another account, and another app, each with a conflicting region, staging, missing body and older app lifetime: the response bytes equal an ordinary create's S1), `TestRestoreOwnerSeesDetail` (the rightful owner gets R2, R4, R5, R6, R7, R8 for the same setups), `TestOrdinaryCreateHintsRestore` (C2 for the owner; S1 for anyone else; S1, not C2, for the owner when staging holds only `build-state.json` or the staging list fails), `TestRestoreRacesOrdinaryCreate` (Review Focus 1), `TestRestoreAfterLegacyLineageRefused` (spec §8: create with lifetimes off after activation, cut over, delete, purge the app and recreate it under the same name, restore: R4 or R8, never 201), `TestRestoreAfterManagedEnrolment` (create, run `admitManagedHistory` so `@mode.At` moves, delete, restore: 201), `TestCreateWithoutRestoreUnchanged` (existing S1, S4, S5, leftover-rail and lock-order witnesses still pass unmodified; run them by name in Step 4). |
| +- [ ] **Step 1: Write the failing door tests** through the real door (production-wired: real handler, store, `ltStore` bucket): `TestRestoreRoundTrip` (create, write a row to the replica prefix, delete, restore: 201 with `restore: true`, the record's host and region match, incarnation is N+1, the allocation carries `RestoreOf`), `TestRestoreTwice` (Review Focus 4), `TestRestoreRetriedAfterSuccess` (Review Focus 2: the first restore's response is dropped, the retry answers `instance <host> already exists`, no second allocation), `TestRestoreRecordAppearsBetweenEvaluations` (a record lands after the early proof, paused with `pauseGate`: the locked evaluation answers the duplicate), `TestRestoreRegion` (Review Focus 5: none, the home region named explicitly, and the console's own region all pass; another region is R5; with the app's default region set to another region, a restore still writes the stored body's region), `TestRestoreRefusesPlacedApp` (after the delete, the app gains a fleet placement written with `s.store.SetAppPlacement` directly, since the placement door refuses changes under an active history, fleets.go:816-828: R7; and separately a manifest pool: R7), `TestRestoreKeepsRegionPolicy` (after the delete, the manifest's `Regions` no longer includes the home region: the ordinary region refusal, as an ordinary create gets), `TestRestoreStaticKindRefused` (a restore request with kind static or service: R7, and no record written), `TestRestoreStagingRefused` (any object under `moves/<host>/`, including only `build-state.json`: R6; a listing error: R1; staging appearing between the evaluations, via `pauseGate`: R6 from the locked one), `TestRestoreSkipsLeftoverRailOnlyForOwnReplica` (a restore over `instances/<host>` passes; an ordinary create over the same leftovers still gets the rail's refusal), `TestRestoreForeignOwnerSeesOnlyS1` (another account, and another app, each with a conflicting region, staging, missing body and older app lifetime: the response bytes equal an ordinary create's S1), `TestRestoreOwnerSeesDetail` (the rightful owner gets R2, R4, R5, R6, R7, R8 for the same setups), `TestOrdinaryCreateHintsRestore` (C2 for the owner; S1 for anyone else; S1, not C2, for the owner when staging holds only `build-state.json` or the staging list fails), `TestRestoreRacesOrdinaryCreate` (Review Focus 1), `TestRestoreAfterLegacyLineageRefused` (spec §8: create with lifetimes off after activation, cut over, delete, purge the app and recreate it under the same name, restore: R4 or R8, never 201), `TestRestoreAfterManagedEnrolment` (create, run `admitManagedHistory` so `@mode.At` moves, delete, restore: 201), `TestCreateWithoutRestoreUnchanged` (existing S1, S4, S5, leftover-rail and lock-order witnesses still pass unmodified; run them by name in Step 4). |
| - [ ] **Step 2:** Run `go test ./internal/console -run 'TestRestore|TestOrdinaryCreateHintsRestore'`. Expected: FAIL. |
| -- [ ] **Step 3:** Implement. Order inside the handler: decode, validate host, then if `Restore`: the early `restoreProof` with `Shape: nil` (S1, duplicate or detail), then skip the region-resolution block (:1796-1933) entirely and set `region = verdict.Region`, keeping `checkPlacement` and every later check; no app-region, nearest-region or fleet placement is consulted. The leftover rail skips its `instances/<host>` test for a restore only. Then the existing path to the core, where the deciding evaluation runs. |
| +- [ ] **Step 3:** Implement. Order inside the handler: decode, validate host, read `appPlacement` (:1796) and the manifest pool, then if `Restore`: the early `restoreProof` with `Shape: nil` (S1, R1, duplicate or detail; a placed app is R7 there). In the region block, a restore chooses but does not skip: `raw` is the verdict's region name (the stored body's), the app-region default branch (:1815-1826) is not taken, and everything after it runs unchanged: home-name normalization, `checkReplicaCreate`, the `ValidRegion` and manifest `Regions` allow-list check (:1923-1929), the armed-placement gate and `checkPlacement`. The leftover rail skips its `instances/<host>` test for a restore only. Then the existing path to the core, where the deciding evaluation runs. |
| - [ ] **Step 4:** Run the Step 2 tests, then `go test ./internal/console -run 'HostsUsed|Leftover|LifetimeCreate|InstanceCreate|LockOrder'`. Expected: PASS. |
| - [ ] **Step 5:** Commit `console: restore a deleted instance through the create door (#658)`. |
| |
| @@ -175,8 +198,9 @@ Tasks 3, 4, 5 and 6 touch a security gate (the hostname history and the create d |
| - Produces (test-only): `type stampStore struct{ release.Store; next func() time.Time }`, a release-store wrapper that, on a `Put` under `provision.HostsUsedPrefix` (marks and `@mode`), rewrites the body's `at` field to `next()` before passing the write through unchanged otherwise (create-only and CAS semantics kept). The mark and mode writers stamp with `time.Now()` (hostsused.go:613, hostsused_activate.go:441, managedhistory.go:60), which the cutover fixture clock does not reach; this wrapper is how the trace controls those stamps. |
| |
| - [ ] **Step 1: Write `TestRestoreRefusesUnmarkedPredecessor`** (spec §4 Guard's fixed trace) on `stampStore`: fixture with app Q's warm database at the host's derived path on an inventoried box and no mark, slot or allocation, Q recorded as the writer in the data oracle; P creates the host with lifetimes on in incomplete mode without a wake (mark stamped T=110); activation runs with a listing that includes Q's file (stamped T=100); P deletes normally; P restores: R8. Before the restore, assert the stored stamps (mark 110, mode 100), P's surviving mark, P's slot, and no origin on P's allocation. Then evaluate rev 3's rule (mark `Source == "create"`, names P, `At > @mode.At`) on that state and assert it would admit P, so the trace discriminates. |
| -- [ ] **Step 2: Write `TestRestoreProvenanceSimulation`:** a seeded generator over the actions of spec §4 Guard (including `stampStore` steps backwards and forwards, and managed enrolment), starting each seed from either an empty store or the Q fixture of Step 1. A data oracle records which (account, app, app lifetime) wrote each hostname's data. Assertions: (a) safety, a restore answers 201 only when every write under that hostname came from the restoring triple; (b) liveness, a restore of a host whose only writer is the restoring triple, created by a plain create after activation with lifetimes on and deleted through a normal retirement with no pending work, answers 201. Bounds: `-short` 50 seeds x 30 steps; otherwise 200 x 40, under 60 s on one core. Print the seed on failure. |
| -- [ ] **Step 3:** Run `nice go test ./internal/console -run 'TestRestoreRefusesUnmarkedPredecessor|TestRestoreProvenanceSimulation'` and time it. Expected: PASS within the bound. Then break `restoreProof` stage 2 item 3 locally (drop the origin requirement) and confirm the fixed trace or the simulation fails; then break it the other way (refuse whenever `@mode.At` moved after the origin) and confirm liveness fails. Restore both. |
| +- [ ] **Step 2: Write `TestRestoreProvenanceSimulation`:** a seeded generator over the actions of spec §4 Guard (including `stampStore` steps backwards and forwards, and managed enrolment), starting each seed from either an empty store or the Q fixture of Step 1. A data oracle records which (account, app, app lifetime) wrote each hostname's data, and its own model of the admission table (re-encoded in the test from its own state, never by calling `restoreProof`, the store accessors or the bucket). Assertions: (a) safety, a restore answers 201 only when every write under that hostname came from the restoring triple; (b) agreement, every restore's answer equals the oracle's row, which covers liveness: when the oracle's model says eligible (mode active now, lifetimes on, claims off, no pending work, origin and lineage clean, a restorable newest retirement, plain, home region, no staging), the answer is 201, and after an invalidation it is R2. Add the deterministic trace activation, create, delete, invalidate, restore (R2), reactivate, restore (201). Bounds: `-short` 50 seeds x 30 steps; otherwise 200 x 40, under 60 s on one core. Print the seed on failure. |
| +- [ ] **Step 2b: Reduced priority in CI.** The simulation test re-executes its own test binary as a child (`os.Args[0] -test.run '^TestRestoreProvenanceSimulation$' -test.v` with `RESTORE_SIM_CHILD=1`) under `nice -n 10`, streams its output, and fails with the child's exit status; when `RESTORE_SIM_CHILD=1` it runs the simulation directly. If `nice` is not on PATH the parent fails rather than running un-niced. The child asserts its own priority with `syscall.Getpriority` (linux; skip the assertion on other GOOS) and fails if it is not at least 10. Nothing else in the shard changes. |
| +- [ ] **Step 3:** Run `nice go test ./internal/console -run 'TestRestoreRefusesUnmarkedPredecessor|TestRestoreProvenanceSimulation'` and time it. Expected: PASS within the bound. Then break `restoreProof` locally three ways and confirm each fails: drop the origin requirement (fixed trace or safety fails); refuse whenever `@mode.At` moved after the origin (agreement fails on the managed-enrolment case); swap table rows 3 and 4 (agreement and `TestRestoreProofPrecedence` fail). Restore them. |
| - [ ] **Step 4:** Commit `console: simulate restore provenance (#658)`. |
| |
| ### Task 8: Docs, census, handoff |
| @@ -202,3 +226,12 @@ All accepted. |
| 6. P2 conversion keeps evidence: `ConvertRetirementKind` clears it (Task 4). |
| 7. P2 clock: `stampStore` controls mark and mode stamps (Task 7). |
| 8. P2 required traces: the legacy-lineage and managed-enrolment witnesses are named door tests (Task 6); the Q fixture is a generator start state; liveness is asserted; the full run is bounded in code (Task 7). |
| + |
| +## Plan round 2 dispositions |
| + |
| +Stopping rule 2 applied (refusal precedence, rounds 1 and 2); Paul chose the cut (#658, 2026-11-08): one admission table, enforced in `restoreProof`, pinned by a generated precedence test and an independent oracle. |
| +1. P1 duplicate before pending: table rows 3 then 4; `TestRestoreProofPendingRetirement` covers before N1, after N1 and after N2. |
| +2. P1 liveness after invalidation: the oracle's model includes the current mode; the invalidate, restore, reactivate, restore trace is deterministic. |
| +3. P2 region block: a restore chooses the region but keeps every validation; placement and pool are row 10 inputs; the deciding call runs outside the `DataKind()` block; static and service are refused. |
| +4. P2 CI priority: Task 7 Step 2b's niced child process with a priority assertion. |
| +5. P2 tie-break: `rowid` after `created_at`. |