carlos / platform Public

provision: record-write census for instance restore (#658)

Layer instanceRestore658WriteCensusInventory on regionHAG2Fixes and wire
TestPlan9B8RecordWriteCensus to it. It re-pins three console units with
their classes and kinds unchanged: createRecordWithLifetimeLocked (Task
3: restore_origin from the mark step), retireRecordWithLifetimeLocked
and retirementStepsLocked (Task 4: SQL evidence columns; the same N1
tombstone write on the same captured ETag). Digests from censusProduction.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 6fdc6b1991a22019c4918a9dc017aecd2a712446 parent 5e78782
2 files changed, +42 −1
  • internal/provision/instance_restore_658_census_test.go +41 −0
  • internal/provision/plan9_b8_census_test.go +1 −1
diff --git a/internal/provision/instance_restore_658_census_test.go b/internal/provision/instance_restore_658_census_test.go
new file mode 100644
index 000000000..c2cf72f80
--- /dev/null
+++ b/internal/provision/instance_restore_658_census_test.go
@@ -0,0 +1,41 @@
+package provision
+
+// Record-write census entries for instance restore (#658), layered on
+// regionHAG2FixesWriteCensusInventory (the inventory TestPlan9B8RecordWriteCensus
+// used before this branch). Reviewed by the branch author and the
+// cross-model reviewer (Astra) with the branch. No record write is added and
+// no class or kind changes:
+// - Server.createRecordWithLifetimeLocked (Task 3): keeps the mark step's
+// observation (markForCreate now returns it) and sets the allocation's
+// restore_origin from it before BeginAllocation. A SQL column only; no
+// new bucket write. key-site / key:RecordKey, as before.
+// - Server.retireRecordWithLifetimeLocked (Task 4): passes the captured
+// body (obs.Raw at RecordETag; nil after a same-call migration) to
+// BeginRetirement as RecordBody. A SQL column only; the same record key.
+// key-site / key:RecordKey, as before.
+// - Server.retirementStepsLocked (Task 4): marks the row restorable
+// (MarkRetirementRestorable, SQL) when N1's write lands or a proven
+// tombstone is observed, before N2/N3, and is pending if that update
+// fails. Its one record write is the same N1 tombstone through
+// WriteRecord on the same captured ETag. record-writer /
+// key:RecordKey,key:WriteRecord, as before.
+func instanceRestore658WriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), regionHAG2FixesWriteCensusInventory()...)
+ replacements := []censusEntry{
+ {"internal/console/lifetimes_create.go", "Server.createRecordWithLifetimeLocked", "key-site", "key:RecordKey", "e05edd5868ab2ba17f7c7bed2669c846facff70d17ae5aaf80a62017dc3abdf8"},
+ {"internal/console/lifetimes_retire.go", "Server.retireRecordWithLifetimeLocked", "key-site", "key:RecordKey", "e5b8fe974a0c6c21e08e059ec6baab1c569766d90c8a84aff405f02cdc51ba37"},
+ {"internal/console/lifetimes_retire.go", "Server.retirementStepsLocked", "record-writer", "key:RecordKey,key:WriteRecord", "e5bc1a1ef3ddba02c75217b18a71155f5fdbb82c67494cb60c57021ef05f2252"},
+ }
+ 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("instance-restore-658 replacement of an unlisted unit " + r.File + ":" + r.Unit)
+ }
+ }
+ return entries
+}
diff --git a/internal/provision/plan9_b8_census_test.go b/internal/provision/plan9_b8_census_test.go
index 205059a69..dfe0b00df 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 := regionHAG2FixesWriteCensusInventory()
+ inventory := instanceRestore658WriteCensusInventory()
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 "))