carlos / platform Public

region HA P1a: CI fix (the unit census classifies the retired join units)

P0 Task 2 removed carlos-system-join.path and .service from the embedded
unit set, so the census no longer classified them, but a box bootstrapped
by an earlier build (leo) still carries both files and the .path's
multi-user.target.wants link until a live bootstrap retires them. The
unit census now classifies each retired unit's file and the exact link
its [Install] section made (retiredUnitLinks), as box-wide leftovers.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 5f90012faf829bb4aaeb36bc462dd01048298734 parent 7766bfb
2 files changed, +20 −0
  • internal/host/claimcensus.go +12 −0
  • internal/host/retiredunits.go +8 −0
diff --git a/internal/host/claimcensus.go b/internal/host/claimcensus.go
index 71bb2cebb..5081d0dba 100644
--- a/internal/host/claimcensus.go
+++ b/internal/host/claimcensus.go
@@ -195,6 +195,18 @@ func claimUnitCensus(unitsDir string) []string {
entries = append(entries, hostbox.CensusLink(link, target))
}
}
+ // Units an earlier build installed and this one no longer ships
+ // (retiredUnits): a box bootstrapped by that build, leo among them,
+ // keeps each file and its enablement link until a live bootstrap
+ // retires them (retireUnits). They are box-wide leftovers, never a
+ // host's, so they are classified exactly: the file and the link its
+ // [Install] section made, nothing else.
+ for _, unit := range retiredUnits {
+ entries = append(entries, hostbox.CensusFile(unit))
+ for _, link := range retiredUnitLinks[unit] {
+ entries = append(entries, hostbox.CensusLink(link, filepath.Join(unitsDir, unit)))
+ }
+ }
if hostwrite.Enabled(os.Getenv) && slices.Contains(names, claimControlUnit) {
// Claim rollout uses add-wants to start the static root service at
// boot. Its unit has no [Install] metadata to derive this link from.
diff --git a/internal/host/retiredunits.go b/internal/host/retiredunits.go
index 67b084420..59af9bd67 100644
--- a/internal/host/retiredunits.go
+++ b/internal/host/retiredunits.go
@@ -13,6 +13,14 @@ import (
// not keep them installed and enabled.
var retiredUnits = []string{"carlos-system-join.path", "carlos-system-join.service"}
+// retiredUnitLinks are the links `systemctl enable` made for a retired unit,
+// relative to the unit directory, from the [Install] section of the last
+// build that shipped it: carlos-system-join.path was WantedBy
+// multi-user.target; carlos-system-join.service had no [Install] section.
+var retiredUnitLinks = map[string][]string{
+ "carlos-system-join.path": {"multi-user.target.wants/carlos-system-join.path"},
+}
+
// retireUnits disables, stops and removes each unit under
// <root>/etc/systemd/system. A unit that is not installed is no error. On
// the live root ("/") the unit is disabled and stopped through systemctl