retire-window-415: witness reads the right frames; record-write census overlay; review brief
- The deletion witness walks past a test wrapper's own Delete or DeleteIfMatch only; a wrapper's Get or List that deletes is the test's doing (three CI false positives). A delete inside deleteRecordIfMatch is noted by construction, on whichever server made it: tests that build a second console (restart) note on that server, which the fixture's witness cannot read. - Record-write census (9B8): retire_window_415_census_test.go re-pins the six lifetime units whose deletes now go through deleteRecordIfMatch (same keys, same ETag deletes, classes unchanged). - CODEX-REVIEW-BRIEF-RETIRE-WINDOW-415.md for the Astra branch review.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 files changed,
+155
−11
docs/superpowers/specs/CODEX-REVIEW-BRIEF-RETIRE-WINDOW-415.md+94 −0internal/console/deletion_evidence_test.go+15 −10internal/provision/plan9_b8_census_test.go+1 −1internal/provision/retire_window_415_census_test.go+45 −0
CI failed — run details
diff --git a/docs/superpowers/specs/CODEX-REVIEW-BRIEF-RETIRE-WINDOW-415.md b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-RETIRE-WINDOW-415.md| new file mode 100644 |
| index 000000000..3967d3925 |
| --- /dev/null |
| +++ b/docs/superpowers/specs/CODEX-REVIEW-BRIEF-RETIRE-WINDOW-415.md |
| @@ -0,0 +1,94 @@ |
| +# Review brief: branch retire-window-all-deletes-415, round 1 of 3 |
| + |
| +Repo carlos/platform, branch `retire-window-all-deletes-415`, commit named |
| +in the prompt (the tip that adds this brief). |
| +Under review: the diff `origin/main...HEAD` (console-only: internal/console). |
| +Authorities: discussion #415 (the gap), the canary-retire guard as merged on |
| +main (`retireUnsettled`, `recentRecordDeletion`, `noteRecordDeletion` in |
| +`internal/console/remoteinstances.go`; `channelHosts` and |
| +`handleRetireCanary` in `internal/console/server.go`), and the lifetime |
| +retirement protocol as merged (`internal/console/lifetimes_retire.go`, |
| +`lifetimes_create.go`, `lifetimes_recovery.go`, `lifetimes_migrate.go`). |
| +Do not review against unmerged branches; if this work needs one, say so as |
| +a P1 and stop. A sibling branch, `retire-app-lock-407`, is NOT an authority |
| +here. |
| + |
| +You are an independent reviewer. Read the diff, then the code it names, |
| +and check every claim against that code. |
| + |
| +## Fixed: do not re-argue |
| + |
| +- Paul accepted the canary-retire guard's shape and its 15-minute window |
| + (`channelSettle`) on 2026-10-25 (#280, #407). The guard refuses while any |
| + record of the app changed or was deleted within the window. Report only |
| + mechanisms that fail to honour it. |
| +- The deletion evidence is in-process memory (`deletions`) plus the audit |
| + log for another console process. "One console per deployment bucket" is |
| + the deployment assumption (`applocks.go`). Do not ask for a persisted |
| + deletion ledger. |
| +- Over-refusing a retire (holding one that had nothing to wait for) is |
| + acceptable; letting one through early is not. |
| + |
| +## What to check |
| + |
| +1. **Coverage.** Every console path that deletes an instance or sidecar |
| + record, or turns one into a tombstone, now notes the deletion for the |
| + record's own account and app before the bucket sees it. Name any path |
| + that still does not, with file:line: detach (`detachRetireLocked`), |
| + recovery (`lifetimeRecoveryIteration` and its `recover*Locked`), the |
| + allocation's previous-owner cleanup (`allocCleanLocked`, |
| + `allocPrevOwnerCleanLocked`), `deleteUnderRetiredSlot`, `retireStaleLocked`, |
| + the migration's corrupt-body delete, and anything outside the lifetime |
| + files (claims are shelved and inert; say so if you rely on that). |
| +2. **The right app.** `deleteRecordIfMatch` notes `(acct, app)` as passed. |
| + Check every call passes the key's own account and app, in particular |
| + the previous owner's (`plan.ownerAccount/ownerApp`, and the parsed |
| + `PrevOwnerKey`). |
| +3. **The audit half.** `recentRecordDeletion` now also treats a |
| + `domain-detach` audit row inside the window as a deletion. Confirm that |
| + only adds refusals and cannot let a retire through. |
| +4. **The witness** (`internal/console/deletion_evidence_test.go`, installed |
| + by `newConsoleFixtureWith`): does it really fail a test whose console |
| + code deletes a record key without a fresh note? Can its caller |
| + classification (`deletingCaller`, `isStoreMethod`) skip a console-made |
| + delete, so that a missing note would go unseen? Is it safe with |
| + background goroutines that outlive a test? |
| +5. **The record-write census (9B8).** `internal/provision/retire_window_415_census_test.go` |
| + re-pins six console units with the classes they had. You decide it (AGENTS.md, |
| + "The census", and #280 2026-10-26: the reviewer decides every class). |
| + Give a verdict per unit, approve or reject, citing the lines: same key, |
| + same ETag-conditional delete, no new write, class unchanged. The |
| + root-read census does not apply: `internal/console` is outside its |
| + scope since C2 (7c9e9d6a), and `TestPlan14RootReadCensus` passes. |
| +6. **The new tests** (`TestRetireWaitsAfterLifetimeDetach` and |
| + `...OnAnotherConsole`): do they fail on main's code for the stated |
| + reason, and pass on this branch for the right one? |
| + |
| +## Severity |
| + |
| +- **P1**: unsafe, would not compile, a test fails, or it would not work. |
| + Blocks merge. |
| +- **P2**: wrong or missing. Fixed without reopening this review. (The |
| + census, and review of any newly changed security, root, termination |
| + or production-storage behaviour, still check the fix; see AGENTS.md, |
| + "Stopping rules".) |
| +- **P3**: clarity or polish. Goes on a follow-up list; never a reason for |
| + another round. |
| + |
| +A P1 states its failure scenario and the evidence (file:line). Do not |
| +raise a P2 to P1 to keep the review open. |
| + |
| +## Output |
| + |
| +Findings ranked P1, P2, P3. Each gives the section or task, the problem, |
| +the evidence (file:line, verified), the failure scenario, a concrete |
| +fix and the invariant or trust boundary it breaks (that is its fault |
| +family). End with exactly one verdict: |
| + |
| +- **READY**: no P1 and no P2. |
| +- **READY AFTER FIXES**: no P1. The listed P2s are fixed without another |
| + round. |
| +- **NOT READY**: one or more P1s, listed. |
| + |
| +Do not edit files. Do not spawn Anthropic-model reviewers or subagents of |
| +your own. Do not run the full test suites. |
diff --git a/internal/console/deletion_evidence_test.go b/internal/console/deletion_evidence_test.go| index a2cac9b74..3077249f4 100644 |
| --- a/internal/console/deletion_evidence_test.go |
| +++ b/internal/console/deletion_evidence_test.go |
| @@ -39,8 +39,8 @@ func witnessDeletionEvidence(t *testing.T, srv *Server, rel release.Store) { |
| if !ok { |
| return |
| } |
| - caller, console := deletingCaller() |
| - if !console { |
| + caller, console, helper := deletingCaller() |
| + if !console || helper { |
| return |
| } |
| if srv.recentlyDeleted(acct, app, time.Now()) { |
| @@ -78,8 +78,12 @@ func recordOwnerOfKey(key string) (acct, app string, ok bool) { |
| // other package (release, provision, hostops), to the first frame in |
| // internal/console, and reports its function and whether it is console code. |
| // A _test.go frame reached first is the test deleting behind the console's |
| -// back. |
| -func deletingCaller() (string, bool) { |
| +// back; a test wrapper's own Delete or DeleteIfMatch passes the console's |
| +// delete on and is walked past. helper is a delete made inside |
| +// deleteRecordIfMatch, which notes on its own server before it deletes: the |
| +// server may be a second console a test built (restart), whose notes this |
| +// fixture's witness cannot read. |
| +func deletingCaller() (caller string, console, helper bool) { |
| pcs := make([]uintptr, 64) |
| n := runtime.Callers(3, pcs) |
| frames := runtime.CallersFrames(pcs[:n]) |
| @@ -91,25 +95,26 @@ func deletingCaller() (string, bool) { |
| case strings.HasSuffix(f.File, "_test.go") && isStoreMethod(f.Function): |
| // A test's store wrapper passing the console's delete on. |
| case strings.HasSuffix(f.File, "_test.go"): |
| - return f.Function, false |
| + return f.Function, false, false |
| case strings.Contains(f.File, "/internal/console/"): |
| - return f.Function, true |
| + return f.Function, true, strings.HasSuffix(f.Function, ".(*Server).deleteRecordIfMatch") |
| } |
| if !more { |
| - return "", false |
| + return "", false, false |
| } |
| } |
| } |
| -// isStoreMethod reports whether fn is a release.Store method of some type |
| -// (a test's wrapper around the fixture's bucket). |
| +// isStoreMethod reports whether fn is a delete method of some type (a |
| +// test's wrapper around the fixture's bucket). Only the deletes: a |
| +// wrapper's Get or List that deletes something is the test's own doing. |
| func isStoreMethod(fn string) bool { |
| parts := strings.Split(fn[strings.LastIndex(fn, "/")+1:], ".") |
| if len(parts) < 3 { |
| return false // a plain function, not a method |
| } |
| switch parts[len(parts)-1] { |
| - case "Delete", "DeleteIfMatch", "Put", "Get", "List", "ListMod": |
| + case "Delete", "DeleteIfMatch": |
| return true |
| } |
| return false |
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go| index e3496027a..c96e00e55 100644 |
| --- a/internal/provision/plan9_b8_census_test.go |
| +++ b/internal/provision/plan9_b8_census_test.go |
| @@ -366,7 +366,7 @@ func TestPlan9B8RecordWriteCensus(t *testing.T) { |
| if len(got) < 100 { |
| t.Fatalf("census found only %d units under %s; the walk is broken", len(got), root) |
| } |
| - inventory := nearestRegionAWriteCensusInventory() |
| + inventory := retireWindow415WriteCensusInventory() |
| problems := append(censusDiff(inventory, got), censusPolicy(inventory)...) |
| if len(problems) > 0 { |
| t.Fatalf("record-write census rejected %d site(s); update the explicit inventory only after reviewing the source:\n %s", len(problems), strings.Join(problems, "\n ")) |
diff --git a/internal/provision/retire_window_415_census_test.go b/internal/provision/retire_window_415_census_test.go| new file mode 100644 |
| index 000000000..5edf65362 |
| --- /dev/null |
| +++ b/internal/provision/retire_window_415_census_test.go |
| @@ -0,0 +1,45 @@ |
| +package provision |
| + |
| +// Record-write census entries for retire-window-all-deletes-415 (#415: every |
| +// console record delete marks the canary-retire guard's window), layered on |
| +// nearestRegionAWriteCensusInventory (main's newest at f7644a9c). Reviewed by |
| +// the branch author and the cross-model reviewer (Astra) with the branch. |
| +// No record write is added and no class changes: each unit below deletes |
| +// the same key on the same ETag as before, now through |
| +// Server.deleteRecordIfMatch, which first notes the record's account and |
| +// app in the console's in-memory deletion log (noteRecordDeletion), then |
| +// calls release.DeleteIfMatch exactly as the unit did. |
| +// - Server.allocCleanLocked: both stale bodies (its own key, and the |
| +// previous owner's under plan.ownerAccount/ownerApp) through |
| +// deleteRecordIfMatch; the inline note it had is folded into it. |
| +// - Server.allocPrevOwnerCleanLocked: the previous owner's stale body, |
| +// noted under the account and app parsed from PrevOwnerKey. |
| +// - Server.deleteUnderRetiredSlot, Server.retireStaleLocked and |
| +// Server.migrationStepsLocked (the corrupt body): the same deletes, |
| +// through deleteRecordIfMatch. |
| +// - Server.retirementStepsLocked notes the deletion at entry (its N1 |
| +// tombstone write, which detach and recovery both reach); its writes |
| +// are unchanged: record-writer through WriteRecord, as before. |
| +func retireWindow415WriteCensusInventory() []censusEntry { |
| + entries := append([]censusEntry(nil), nearestRegionAWriteCensusInventory()...) |
| + replacements := []censusEntry{ |
| + {"internal/console/lifetimes_create.go", "Server.allocCleanLocked", "key-site", "key:RecordKey", "cc587263d87180aad2bbef56f4a4bd94fcf15e57689a56af349cc25e11d6cfd0"}, |
| + {"internal/console/lifetimes_create.go", "Server.allocPrevOwnerCleanLocked", "key-site", "key:ParseRecordKey", "a7234b19c973c64cf871b28bbb7919ea551424b02f54c2ac8ddb5fcb87ef16c3"}, |
| + {"internal/console/lifetimes_create.go", "Server.deleteUnderRetiredSlot", "key-site", "key:RecordKey", "3e98113f58a05931ad03589092b21c6950f8cb40fd2fe5797dea8d0bb7cd6305"}, |
| + {"internal/console/lifetimes_migrate.go", "Server.migrationStepsLocked", "key-site", "key:RecordKey", "4170f91be275bbc4d3d146e432636d53f28dbaf9fe6fb11c46607f9d6de1a224"}, |
| + {"internal/console/lifetimes_retire.go", "Server.retireStaleLocked", "key-site", "key:RecordKey", "3282374a0741dc30178ce64592d80484f6795890c2fb4fc3e6a84a54c7316f5a"}, |
| + {"internal/console/lifetimes_retire.go", "Server.retirementStepsLocked", "record-writer", "key:RecordKey,key:WriteRecord", "6b5e6a9f75006a111b926f8cc96c014c77a1814db7451df49c9a932c8a506d8d"}, |
| + } |
| + for _, r := range replacements { |
| + found := false |
| + for i, e := range entries { |
| + if e.File == r.File && e.Unit == r.Unit { |
| + entries[i], found = r, true |
| + } |
| + } |
| + if !found { |
| + panic("retire-window-415 replacement of an unlisted unit " + r.File + ":" + r.Unit) |
| + } |
| + } |
| + return entries |
| +} |