host: test that landing clears only this box's verify record
TestLandingRemovesHostFromOwnVerifyRecord lands a move through production's RemoveVerifyEntry (armPhase1, box label from the fleet identity) and checks the host is gone from control/verify/<box>.json, the box's other verdicts stay, and no other control/verify/ key is written or changed (the source box's record, which names the same host, compares byte-equal). The landing harness gains a removeVerify override so the test can pass production's hook. Task 4 already wired the hook and updated the stubs; no production change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
internal/host/movesland_test.go+82 −0
CI failed — run details
Intent
<task-notification> <task-id>a2a3ac9c8d465c9b0</task-id> <tool-use-id>toolu_016vfZ1hJcLLdrgVq11BJEcq</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ab362fc0-f177-4a7f-a92e-4a29ea210aad/tasks/a2a3ac9c8d465c9b0.output</output-file> <status>completed</status> <summary>Agent "Implement slice 2a Task 6" finished</summary> <note>A task-notification fires each time this agent stops with no live background children of its own. The user can send it another message and resume it, so the same task-id may notify more than once.</note> <result>Status: DONE. The nightly drill timer is armed on every box; `carlos-restore-verify.timer` stays inert. Commit: b63ba33a "host: arm the nightly restore drill by default (#898)" (not pushed). Tests: RED then GREEN on `TestBootstrapPlanJSONNamesWhatALiveRunArms`. All other matched and plan tests pass, except `TestPlan14ActivationNamedUnitPreflight`, which already failed at HEAD ddfbd4df and is about claim assembly. Build and vet are clean. The tests needed TMPDIR=/tmp/g with the sandbox off, because the sandbox makes /tmp read-only. Concerns: - The root-read census (`TestPlan14RootReadCensus`) fails, left for Task 9 as instructed. This task adds the `internal/host/units` envelope and the `carlos-hibernate-verify.service:external` declaration (from the comment edit); the other entries come from Tasks 1-5. - Armed everywhere, a box with `CARLOS_HIBERNATE_BUCKET` set but no fresh `self.json` will exit 1 at 03:00 and show 'failed'. This is the intended NOT RUN signal, but expect it in fleet sweeps after the roll if any box is in that state. Report: /home/paulca/amadan.net/carlos/platform/.claude/worktrees/member-backups-2a/.superpowers/sdd/2026-11-11-member-backups-slice2a/task-6-report.md</result> <usage><subagent_tokens>82611</subagent_tokens><tool_uses>35</tool_uses><duration_ms>409649</duration_ms></usage> </task-notification>
<task-notification> <task-id>bgavw3f2p</task-id> <tool-use-id>toolu_01ApdrE7gwBNLkyDQmo2KLAi</tool-use-id> <output-file>/home/paulca/.cache/tmp/claude-1001/-home-paulca-amadan-net-carlos-platform/ab362fc0-f177-4a7f-a92e-4a29ea210aad/tasks/bgavw3f2p.output</output-file> <status>completed</status> <summary>Background command "Astra review of Task 6" completed (exit code 0)</summary> </task-notification>
Attributed to this commit: 59.3 g CO₂e (7,526,527 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on member-backups-2a, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.
diff --git a/internal/host/movesland_test.go b/internal/host/movesland_test.go| index 9890e863a..70de4c216 100644 |
| --- a/internal/host/movesland_test.go |
| +++ b/internal/host/movesland_test.go |
| @@ -9,6 +9,7 @@ import ( |
| "io" |
| "io/fs" |
| "log/slog" |
| + "maps" |
| "os" |
| "path/filepath" |
| "slices" |
| @@ -109,6 +110,9 @@ type landingHarness struct { |
| releaseNoop bool |
| // releaseErr makes ReleaseHeld fail. |
| releaseErr error |
| + // removeVerify, when set, is the target's RemoveVerifyEntry in place of |
| + // the harness's (slice 2a Task 7 passes production's, from armPhase1). |
| + removeVerify func(ctx context.Context, s release.Store, host string) error |
| // ownAuthorize drops the park authorizer the target would inherit from |
| // the source's configuration (the finalization harness sets one), so |
| // the target's parks use the allowing fake behind their own checks |
| @@ -420,6 +424,9 @@ func (h *landingHarness) landingCfg(t *testing.T) moveCfg { |
| c.RemoveVerifyEntry = func(ctx context.Context, s release.Store, host string) error { |
| return dbverify.RemoveHost(ctx, s, h.dstBox, host) |
| } |
| + if h.removeVerify != nil { |
| + c.RemoveVerifyEntry = h.removeVerify |
| + } |
| c.WriteGen = hostbox.WriteGenerationMarker |
| if h.probe != nil { |
| c.Probe = h.probe |
| @@ -1700,6 +1707,81 @@ func TestLocalWritesNoFilesManifestBeforeItsStep(t *testing.T) { |
| } |
| } |
| +// Slice 2a Task 7: the landing clears the host's verdict from this box's |
| +// own restore-drill record, control/verify/<box>.json, through production's |
| +// RemoveVerifyEntry (armPhase1, under the box label the drill publishes |
| +// under), and writes no other control/verify/ key: the source's verdict |
| +// for the host leaves at the source's next run, when Merge drops it. |
| +func TestLandingRemovesHostFromOwnVerifyRecord(t *testing.T) { |
| + t.Parallel() |
| + ctx := context.Background() |
| + h := newLandingHarness(t) |
| + // The harness seeded this box's record with the host and other.example; |
| + // the source box's record names the host too. |
| + now := h.clock.Now() |
| + if err := dbverify.Publish(ctx, h.s, &dbverify.Record{V: 2, Box: h.srcBox, CheckedAt: now, |
| + Hosts: map[string]dbverify.Verdict{p1Host: {Result: dbverify.ResultPassed, VerifiedAt: now}}}); err != nil { |
| + t.Fatal(err) |
| + } |
| + h.flip(t) |
| + // Production's wiring, with this box's label from its fleet identity. |
| + env := map[string]string{"CARLOS_FLEET": "kass", "CARLOS_FLEET_BOX": h.dstBox} |
| + var prod moveCfg |
| + hib := activator.Config{Bucket: h.dstBucket, Region: h.dstAWS, Prefix: "instances"} |
| + armPhase1(&prod, &movesWorker{mirrors: map[string]lease.MirrorStore{}}, hib, h.tdir, nil, nil, nil, hostwrite.Config{}, func(k string) string { return env[k] }) |
| + if prod.Box != h.dstBox || prod.RemoveVerifyEntry == nil { |
| + t.Fatalf("production wiring: box %q, RemoveVerifyEntry set %v", prod.Box, prod.RemoveVerifyEntry != nil) |
| + } |
| + h.removeVerify = prod.RemoveVerifyEntry |
| + own := dbverify.KeyFor(h.dstBox) |
| + verifyObjects := func() map[string]string { |
| + keys, err := h.s.List(ctx, "control/verify/") |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + out := map[string]string{} |
| + for _, k := range keys { |
| + body, _, err := h.s.Get(ctx, k) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + out[k] = string(body) |
| + } |
| + return out |
| + } |
| + before := verifyObjects() |
| + if _, ok := before[dbverify.KeyFor(h.srcBox)]; !ok || len(before) != 2 { |
| + t.Fatalf("the seeded records: %v", slices.Sorted(maps.Keys(before))) |
| + } |
| + h.landAt = "after-verify" |
| + h.crashLand(t) |
| + if !h.landJournal(t).Done(landStepVerify) { |
| + t.Fatal("the landing did not record its verify step") |
| + } |
| + after := verifyObjects() |
| + for k, body := range after { |
| + if k == own { |
| + continue |
| + } |
| + if was, ok := before[k]; !ok || was != body { |
| + t.Fatalf("the landing wrote %s: before %q, after %q", k, was, body) |
| + } |
| + } |
| + if len(after) != len(before) { |
| + t.Fatalf("control/verify/ keys before %v, after %v", slices.Sorted(maps.Keys(before)), slices.Sorted(maps.Keys(after))) |
| + } |
| + dv, err := dbverify.Load(ctx, h.s, h.dstBox) |
| + if err != nil || dv == nil { |
| + t.Fatalf("this box's record: %+v %v", dv, err) |
| + } |
| + if _, ok := dv.Hosts[p1Host]; ok { |
| + t.Fatalf("the landed host is still in %s: %+v", own, dv.Hosts) |
| + } |
| + if _, ok := dv.Hosts["other.example"]; !ok || len(dv.Hosts) != 1 { |
| + t.Fatalf("this box's other verdicts: %+v", dv.Hosts) |
| + } |
| +} |
| + |
| // Ruling G17: with the park engine's hooks unwired, as armPhase1 leaves |
| // them, the landing is not armed: the pass logs and writes nothing. |
| func TestLandingWaitsUnarmedInProduction(t *testing.T) { |