Install real executors after seeding cold-placement migration
Match lifecycle fixture ordering so migration placeholders cannot replace the executor or its signed identity before guard arming. Validate guard inputs and both image hashes before entering the production command.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 file changed,
+15
−2
internal/host/haplacement_root_linux_test.go+15 −2
diff --git a/internal/host/haplacement_root_linux_test.go b/internal/host/haplacement_root_linux_test.go| index 994368f44..03e8f1a65 100644 |
| --- a/internal/host/haplacement_root_linux_test.go |
| +++ b/internal/host/haplacement_root_linux_test.go |
| @@ -331,7 +331,7 @@ func TestColdPlacementRootRunner(t *testing.T) { |
| v, err = lease.ReadLock(t.Context(), "data", "instances/"+lifecycleHost, "eu-west-1") |
| lifecycleCheck(t, "recovered writer", err) |
| owner, ok := hafresh.ParseOwner(v.Lock.Owner) |
| - if !ok || owner.Ref != "leo" { |
| + if !ok || !owner.HA || owner.Ref != "leo" { |
| t.Fatalf("wrong recovered writer: %+v", owner) |
| } |
| out, err = ctl("stop", "carlos-edge.service") |
| @@ -432,6 +432,17 @@ func coldRootArmGuard(t *testing.T, store release.Store, key ed25519.PrivateKey, |
| previous := version.Build |
| version.Build = "v2.0.0" |
| defer func() { version.Build = previous }() |
| + disk, err := floorDisk(release.OptDir()) |
| + lifecycleCheck(t, "guard disk", err) |
| + hash, err := hostfloor.ExecutingHash() |
| + lifecycleCheck(t, "guard executing hash", err) |
| + _, verified, err := guardArmInputs(policy, identity, disk.PublicKey, disk.Bucket, version.Build, runtime.GOOS+"-"+runtime.GOARCH, hash) |
| + lifecycleCheck(t, "guard inputs", err) |
| + for _, path := range []string{"/opt/carlos/carlos", "/opt/carlos/carlos.prev"} { |
| + raw, err := os.ReadFile(path) |
| + lifecycleCheck(t, "guard executor bytes", err) |
| + lifecycleCheck(t, "guard executor identity "+path, hostfloor.CheckImage(disk.PublicKey, verified, identity, version.Build, runtime.GOOS+"-"+runtime.GOARCH, hostfloor.Digest(raw))) |
| + } |
| RunSystemGuardArm([]string{"--policy", "/etc/carlos/policy.json", "--identity", "/etc/carlos/identity.json", "--enrollment", "/etc/carlos/enrollment.json"}) |
| }) |
| raw, err := os.ReadFile("/etc/systemd/system/carlos-edge.service.d/90-host-floor.conf") |
| @@ -506,6 +517,9 @@ func newColdRootHarness(t *testing.T, mode string) *coldRootHarness { |
| identity.HomeRegion = "ie" |
| actor, err := identity.Verify(t.Context()) |
| lifecycleCheck(t, "guard fixture identity", err) |
| + // Migration fixtures seed placeholder executors. Install the real binary |
| + // and its signed identity afterwards, as the lifecycle root fixture does. |
| + filesSeedConstructionMigration(t, "/opt/carlos", actor.ControlBucket, actor.Box, actor.Enrollment) |
| binary, err := os.Executable() |
| lifecycleCheck(t, "binary", err) |
| image, err := os.ReadFile(binary) |
| @@ -528,7 +542,6 @@ func newColdRootHarness(t *testing.T, mode string) *coldRootHarness { |
| lifecycleCheck(t, "guard roster", err) |
| _, err = store.Put(t.Context(), hostactors.Key, rosterBytes, "") |
| lifecycleCheck(t, "guard roster persistence", err) |
| - filesSeedConstructionMigration(t, "/opt/carlos", actor.ControlBucket, actor.Box, actor.Enrollment) |
| coldRootArmGuard(t, store, key, actor, pointer) |
| censusState, err := rootstate.Open(rootparticipation.Namespace, true, false) |
| lifecycleCheck(t, "census store", err) |