adopt retire test: assert the disable was attempted (Astra R1 P2)
Astra round 1 (READY AFTER FIXES, census approved): the disable-failure test passed even if retirement were skipped. It now asserts the exact disable --now call before checking the unit was kept. Watched both retire tests fail with the retire call disabled. Findings committed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2 files changed,
+32
−0
docs/superpowers/reviews/ASTRA-FINDINGS-retire-join-units-on-adopt-R1.md+26 −0internal/host/systemunits_test.go+6 −0
CI passed — run details
diff --git a/docs/superpowers/reviews/ASTRA-FINDINGS-retire-join-units-on-adopt-R1.md b/docs/superpowers/reviews/ASTRA-FINDINGS-retire-join-units-on-adopt-R1.md| new file mode 100644 |
| index 000000000..f6a31fc96 |
| --- /dev/null |
| +++ b/docs/superpowers/reviews/ASTRA-FINDINGS-retire-join-units-on-adopt-R1.md |
| @@ -0,0 +1,26 @@ |
| +| Part A: unit / envelope | Change | Decision | Lines read and basis | |
| +|---|---|---|---| |
| +| `ensureSystemUnits` | Body | **APPROVE** | [systemunits.go:53–195](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/retire-join-units-on-adopt/internal/host/systemunits.go:53): retirement follows lock acquisition and responsive probes, precedes the armed return, and logs errors without stopping arming. | |
| +| `retireUnitsIn` | New; accepted legacy | **APPROVE** | [retiredunits.go:17–83](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/retire-join-units-on-adopt/internal/host/retiredunits.go:17): existing reads moved intact; production callers supply compiled-in exact names under `/etc/systemd/system`. Removal unlinks leaf symlinks. No new tenant-controlled input. | |
| +| `retireUnits` | Quiet | **APPROVE** | [retiredunits.go:32–38](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/retire-join-units-on-adopt/internal/host/retiredunits.go:32): wrapper contains no direct reads; moved reads are recorded under `retireUnitsIn`. Live-root selection is unchanged. | |
| +| `internal/host` | Re-pinned envelope | **APPROVE** | Above changes and [systemunits_test.go:215–333](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/retire-join-units-on-adopt/internal/host/systemunits_test.go:215), checked against bootstrap, adopt and apply callers. No additional authority expansion found. | |
| + |
| +P1: none. |
| + |
| +**P2 — Part B §6: the disable-failure test does not establish that disabling was attempted.** |
| + |
| +At [systemunits_test.go:279–303](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/retire-join-units-on-adopt/internal/host/systemunits_test.go:279), the mock records calls and injects a disable error, but assertions only check that the old files remain and arming continues. Those assertions also pass when retirement is skipped entirely. |
| + |
| +A regression that skips retirement on an unarmed box would therefore pass this test; the successful-retirement test exercises an already-armed box. This conclusion follows from source inspection; execution was blocked. |
| + |
| +Fix: assert that the exact `disable --now carlos-system-join.path` call occurred before checking preservation and continued arming. |
| + |
| +Fault family: **retirement failure handling must be exercised before its recovery behavior is asserted.** |
| + |
| +P3: none. |
| + |
| +Reviewed `origin/main...e240a15df521fd96d85d17dd1e73f7b9cdae5862`, merge base `6c4dccc3`. Exact-name scope, apply-lock exclusion, bootstrap staging behavior and portable API usage check out by inspection. The successful-retirement test would fail without the change; the lock-exclusion test appropriately checks a negative case. |
| + |
| +`git diff --check` passed. Targeted Go tests could not start because the read-only sandbox denied creation of `/var/tmp/go-build…`; census tests and cross-compilation remain unverified. No files were edited and no full suites were run. |
| + |
| +**READY AFTER FIXES** |
| \ No newline at end of file |
diff --git a/internal/host/systemunits_test.go b/internal/host/systemunits_test.go| index f39fec989..fe5fc01f3 100644 |
| --- a/internal/host/systemunits_test.go |
| +++ b/internal/host/systemunits_test.go |
| @@ -5,6 +5,7 @@ import ( |
| "fmt" |
| "os" |
| "path/filepath" |
| + "slices" |
| "strings" |
| "testing" |
| ) |
| @@ -293,6 +294,11 @@ func TestEnsureSystemUnitsKeepsARetiredUnitItCannotDisable(t *testing.T) { |
| return "", nil |
| } |
| ensureSystemUnits(etc, lockPath, systemctl, probe, t.Logf) |
| + // The retire was attempted, on an unarmed box too; only then does the |
| + // unit still being there mean the failure kept it. |
| + if !slices.Contains(calls, "disable --now carlos-system-join.path") { |
| + t.Fatalf("retirement never tried to disable the join unit: %v", calls) |
| + } |
| for _, p := range []string{"carlos-system-join.path", filepath.Join("multi-user.target.wants", "carlos-system-join.path")} { |
| if _, err := os.Lstat(filepath.Join(unitDir, p)); err != nil { |
| t.Errorf("%s removed although disable failed (%v)", p, err) |