carlos / platform Public

census: record-write re-pins for member backups 2a (#898)

memberBackups2aWriteCensusInventory layers on the linked deployments
slice 1 inventory and re-digests dbverify.Publish, dbverify.RemoveHost
(per-box control/verify/<ref>.json key, ErrInvalidRef refusal) and
moves.OfflineManifest (row text names the new key). No record write
added; no class or kind changes. TestPlan9B8RecordWriteCensus uses it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 0e60df823bce8a48096fa0bb64eef234fb025ba6 parent 3bf932b
2 files changed, +47 −1
  • internal/provision/member_backups_2a_census_test.go +46 −0
  • internal/provision/plan9_b8_census_test.go +1 −1

Intent

diff --git a/internal/provision/member_backups_2a_census_test.go b/internal/provision/member_backups_2a_census_test.go
new file mode 100644
index 000000000..81887bf6c
--- /dev/null
+++ b/internal/provision/member_backups_2a_census_test.go
@@ -0,0 +1,46 @@
+package provision
+
+// memberBackups2aWriteCensusInventory is the member backups slice 2a
+// (#898) review of the record-write census, layered on
+// linkedDeploymentsSlice1WriteCensusInventory. Slice 2a moves the restore
+// drill's record from the one shared control/restore-verify.json to one
+// record per box, control/verify/<ref>.json, written only by that box.
+//
+// Three units are re-digested; no record write is added and no class or
+// kind changes. None of them touches an instance record or a sidecar:
+// - dbverify.Publish: writes rec at dbverify.KeyFor(rec.Box), refusing a
+// ref boxself.ValidRef refuses (ErrInvalidRef, nothing written), instead
+// of the fixed control/restore-verify.json. The same Get-then-CAS Put,
+// three attempts. A control/ key, not a record path. nonrecord /
+// sel:Put, as before.
+// - dbverify.RemoveHost: takes the box ref and edits only that box's
+// record at KeyFor(ref), with the same refusal; other boxes' records
+// are never touched. The load, delete and CAS Put inside each attempt
+// are unchanged. nonrecord / sel:Put, as before.
+// - moves.OfflineManifest: the restore-verify row's description names
+// control/verify/<ref>.json instead of control/restore-verify.json.
+// Text in a table literal; no write. reference / lit:instances, as
+// before.
+func memberBackups2aWriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), linkedDeploymentsSlice1WriteCensusInventory()...)
+ repins := []censusEntry{
+ {"internal/dbverify/dbverify.go", "Publish", "nonrecord", "sel:Put", "93f858f1d635ea8104777ca1700f7b643a98704a11291562f4c2e043bf027ddb"},
+ {"internal/dbverify/dbverify.go", "RemoveHost", "nonrecord", "sel:Put", "a1fff3088189aaa9df862da3f2bc2a41acedbc51a17fbcf62ae0fd2f675d8394"},
+ {"internal/moves/offline.go", "var OfflineManifest", "reference", "lit:instances", "523d76fbb204f07a151772117a7e5bb2c9b25a81ca7aaff417231e9b205abc43"},
+ }
+ for _, r := range repins {
+ found := false
+ for i, e := range entries {
+ if e.File == r.File && e.Unit == r.Unit {
+ if e.Class != r.Class || e.Kinds != r.Kinds {
+ panic("member-backups-2a census: classification changed for " + r.File + ":" + r.Unit)
+ }
+ entries[i], found = r, true
+ }
+ }
+ if !found {
+ panic("member-backups-2a census: re-pin 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 9f059ae49..5070f0d32 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 := linkedDeploymentsSlice1WriteCensusInventory()
+ inventory := memberBackups2aWriteCensusInventory()
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 "))