carlos / platform Public

census: record-write re-pin of claimLaunchFor for bounded systemctl

TestPlan9B8RecordWriteCensus failed on d1b1303d: claimLaunchFor's source
differs from its reviewed digest. A new layer,
boundedSystemctlWriteCensusInventory, sits on c855db5's
consoleRequestCtxWriteCensusInventory and re-pins that one unit with
class (key-site) and kinds (lit:instances) unchanged; it panics on any
class or kinds change, as the layer below does. The test reads it.

The diff of internal/host/claimlaunch_production.go against main
(c855db56) is the systemctl runner wiring only: line 95, in the
instancectl.ClaimUnits Systemctl closure, exec.CommandContext(ctx,
"systemctl", args...).CombinedOutput() became
systemd.Command(systemd.Systemctl, args...).CombinedOutput(ctx), and
the imports swap os/exec for internal/systemd. Same program, arguments,
context and output; the instances literal, every guard ahead of it and
every write are unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev ab6576e398059e3d1697a07c515fcc2f1def742e parent d1b1303
2 files changed, +36 −1
  • internal/provision/bounded_systemctl_census_test.go +35 −0
  • internal/provision/plan9_b8_census_test.go +1 −1

CI passed — run details

diff --git a/internal/provision/bounded_systemctl_census_test.go b/internal/provision/bounded_systemctl_census_test.go
new file mode 100644
index 000000000..08d7aa57b
--- /dev/null
+++ b/internal/provision/bounded_systemctl_census_test.go
@@ -0,0 +1,35 @@
+package provision
+
+// Record-write census re-pin for bounded systemctl (code-health batch 3,
+// branch bounded-systemctl), layered on consoleRequestCtxWriteCensusInventory.
+// No record write is added, moved or reclassified, and no unit writes
+// anything new. One unit changed only in a systemctl runner it wires:
+// - claimLaunchFor (host): the instancectl.ClaimUnits Systemctl closure
+// runs systemd.Command(systemd.Systemctl, args...).CombinedOutput(ctx)
+// instead of exec.CommandContext(ctx, "systemctl", args...)
+// .CombinedOutput(): the same program, arguments, context and output,
+// plus internal/systemd's 30 s bound on a query verb (a mutating verb
+// keeps the caller's context alone). Every other line of the body, the
+// instances literal and the guards ahead of it, is unchanged. Kinds
+// unchanged: lit:instances.
+func boundedSystemctlWriteCensusInventory() []censusEntry {
+ entries := append([]censusEntry(nil), consoleRequestCtxWriteCensusInventory()...)
+ repins := []censusEntry{
+ {"internal/host/claimlaunch_production.go", "claimLaunchFor", "key-site", "lit:instances", "d3bf3b9fe12a445ecef2dfc73b2ac9533cd661c538dfee3ebe8c821481cde601"},
+ }
+ 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("bounded-systemctl re-pin changes the class or kinds of " + r.File + ":" + r.Unit)
+ }
+ entries[i], found = r, true
+ }
+ }
+ if !found {
+ panic("bounded-systemctl 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 8cf02f418..9a7c36ecf 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 := consoleRequestCtxWriteCensusInventory()
+ inventory := boundedSystemctlWriteCensusInventory()
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 "))