own-VPS finish leg: ourcloud-control-plane.service never composed on a full-install gateway — restart fails "Unit not found" (GOTCHAS #18 recurrence, sig 8d0cd71d20a2) #443

Closed
opened 2026-08-11 20:51:18 +00:00 by ben · 1 comment
Owner

Failure: drive 20260811T204058Z, red at the finish leg. journey.droplet.spec.ts:240 (expect(faultFrame).toHaveCount(0)) reds because the stand-up faults instead of reaching hand-off. state/founding-state.json's standup.fault:

founding: hand over authority: founding: hand the ledger into the fleet: fleetwire: restart the control plane on the seeded state: fleetwire: ssh: exit status 5 — Failed to restart ourcloud-control-plane.service: Unit ourcloud-control-plane.service not found.

Root cause: Fleet.SeedLedger (internal/fleetwire/fleet.go:138-140) runs systemctl restart ourcloud-control-plane on the gateway. That unit is declared only inside renderGatewayGuest (internal/clan/vmguest.go:261-302), whose output gateway-guest.nix is written only on the VM/LAN-join path — internal/clan/enrollment.go:397-403 (the s.NodeConfig == nil branch). This drive is own-VPS full-install (state/founding-state.json: access.kind: "own-vps", ip 209.38.85.200), which takes the branch at enrollment.go:407-432: it writes networking.nix/disko.nix/platform.nix/access.nix but never gateway-guest.nix (confirmed by the comment at enrollment.go:417-420). So the composed configuration.nix for a real droplet never imports gateway-guest.nix, and systemd.services.ourcloud-control-plane (plus services.kanidm and ourcloud-self-trust, all defined in the same file) simply does not exist on the box — confirmed: grep -rn systemd.services.ourcloud-control-plane across the repo hits only vmguest.go and its test.

The earlier deploying log line "gateway deploy complete — the control plane is live" (internal/founding/deploy.go:346) is a false positive: applyControlPlane (deploy.go:357-379) only checks that the clan/NixOS activation itself succeeded (dep.Run returning no error) — with no unit referencing the nonexistent control-plane service, the activation has nothing to fail on, so it reports success while nothing is actually running server-side.

This is docs/GOTCHAS.md #18 ("Gateway config in renderGatewayGuest never reaches the own-VPS gateway"), which explicitly predicts this class of recurrence. The prior commit 3762a67 (issue #442) fixed only the /var/lib/ourcloud tmpfiles rule for this exact divergence, by moving it into ledger.nix (internal/clan/gateway_attach.go:337-349, renderLedgerDir), written and imported on every gateway via AttachGateway/baseMachineModules (gateway_attach.go:79, 269-275). GOTCHAS #18's own "Rule" section says the config both shapes need must ride that same composition point, "NOT renderGatewayGuest" — but the actual ourcloud-control-plane unit, services.kanidm (+ its kanidm-tls/kanidm-admins generators), ourcloud-self-trust, the IdP loopback bridge, the kanidm brand-push blocks, and gatewayAssertions() were all left behind in the VM-only render (vmguest.go:106-369).

Suspected layer: internal/clan gateway composition (Nix render layer), specifically the VM/full-install divergence between vmguest.go and enrollment.go/gateway_attach.go.

What plugging it needs: extend the ledger.nix pattern to the rest of the gateway service surface — extract systemd.services.ourcloud-control-plane, services.kanidm + its two generators, ourcloud-self-trust, idpLoopbackBridge, the kanidm brand-push blocks, and gatewayAssertions() out of renderGatewayGuest into a module AttachGateway writes/imports on every gateway (VM and full-install alike), keeping only host-baseline concerns (boot/network/qemu-guest profile) in the VM-only renderVMGuestBaseline/renderGatewayGuest. Needs a seam test at the composed OWN-VPS assembly (front door + acme-dns, no gateway-guest.nix) asserting the control-plane unit is present, matching TestAttachGateway_LedgerHomeReachesOwnVPSGateway's shape (gateway_attach_test.go). This is a multi-file, design-bearing extraction (how the new module coexists with full-install's networking.nix/disko.nix/platform.nix/access.nix, and avoiding duplicate-attrpath collisions on the VM path once the inline definition is removed from vmguest.go) — out of scope for a healer self-fix. Advances #378.

drive 20260811T204058Z red at finish: `mexpect(mmlocatormm).mtoHaveCountm(mmexpectedmm)m failed

Locator: locator('[data-status="journey-fault"]')
Expected: mNm
Received: mNm
Timeout: Nms

Call log:
m - Expect "toHaveCount" with timeout Nmsm
m - waiting for locator('[data-status="journey-fault"]')m
m N × locator resolved to N elementm
m - unexpected value "N"mevidence:test-results/…/20260811T204058Z/` on matou-workstation (legs.json, droplet-journal.txt, trace)


RULED (Ben, 2026-08-11): STRUCTURAL fix — full-install emits the baseline — + fold in the deploy real-check

This is the 6th recurrence of GOTCHAS #12 (full-install bakes no baseline): the own-VPS FullInstall assembles machines/gateway/*.nix piecemeal and never emits gateway-guest.nix (renderGatewayGuest, vmguest.go), so every capability that baseline carries has been re-ported one at a time — hostPlatform (#399), SSH identity (#410), trust (#432), loopback target (#436), ledger dir (#442), and now ourcloud-control-plane.service itself (vmguest.go:264). Stop porting pieces.

Do NOT just add the one service. Make the own-VPS FullInstall path emit the gateway baseline — the cleanest shape: have the FullInstall configure stage write gateway-guest.nix (via renderGatewayGuest, the same render VM mode uses) into the machine dir and import it from configuration.nix, so the WHOLE baseline (control-plane service + whatever else it declares) crosses in one piece and this divergence stops generating teeth. Reconcile against what the FullInstall path already renders separately (front-door.nix, acme-dns.nix, kanidm in front-door, networking/disko/platform, ledger.nix from #442) so nothing double-declares — where the baseline and a standalone module overlap, one must win (the strip-line precedent renderGatewayGuest already uses for the VM baseline's allowedTCPPorts is the pattern). The acceptance bar: the own-VPS gateway's rendered config carries ourcloud-control-plane.service, and a seam test asserts the FULL-INSTALL assembly (not just gateway-guest.nix) contains it — the assertion that would have caught all six.

Fold in the deploy real-check (Ben): internal/founding/deploy.go's "the control plane is live" comes from controlPlaneComponents(), a STATIC label list — it never checks the unit is running, which is exactly why a gateway with no control-plane service still logged "live" and the gap hid until the finish-leg restart. The deploy leg must verify ourcloud-control-plane.service is actually active (systemctl is-active over the clan connection) before logging live / advancing — a real probe, fail-loud (ADR 0100), not a fabricated success. Add GOTCHAS #12 a line noting the control-plane service was the 6th port and the baseline-emit is the structural close.

Scope is bigger than a one-liner but convergent — after this, the own-VPS gateway IS a gateway, not a hand-assembled subset. Stays priority/ready-for-agent.

**Failure:** drive `20260811T204058Z`, red at the `finish` leg. `journey.droplet.spec.ts:240` (`expect(faultFrame).toHaveCount(0)`) reds because the stand-up faults instead of reaching hand-off. `state/founding-state.json`'s `standup.fault`: ``` founding: hand over authority: founding: hand the ledger into the fleet: fleetwire: restart the control plane on the seeded state: fleetwire: ssh: exit status 5 — Failed to restart ourcloud-control-plane.service: Unit ourcloud-control-plane.service not found. ``` **Root cause:** `Fleet.SeedLedger` (`internal/fleetwire/fleet.go:138-140`) runs `systemctl restart ourcloud-control-plane` on the gateway. That unit is declared **only** inside `renderGatewayGuest` (`internal/clan/vmguest.go:261-302`), whose output `gateway-guest.nix` is written **only** on the VM/LAN-join path — `internal/clan/enrollment.go:397-403` (the `s.NodeConfig == nil` branch). This drive is own-VPS full-install (`state/founding-state.json`: `access.kind: "own-vps"`, ip `209.38.85.200`), which takes the branch at `enrollment.go:407-432`: it writes `networking.nix`/`disko.nix`/`platform.nix`/`access.nix` but never `gateway-guest.nix` (confirmed by the comment at `enrollment.go:417-420`). So the composed `configuration.nix` for a real droplet never imports `gateway-guest.nix`, and `systemd.services.ourcloud-control-plane` (plus `services.kanidm` and `ourcloud-self-trust`, all defined in the same file) simply does not exist on the box — confirmed: `grep -rn systemd.services.ourcloud-control-plane` across the repo hits only `vmguest.go` and its test. The earlier `deploying` log line `"gateway deploy complete — the control plane is live"` (`internal/founding/deploy.go:346`) is a false positive: `applyControlPlane` (`deploy.go:357-379`) only checks that the clan/NixOS activation itself succeeded (`dep.Run` returning no error) — with no unit referencing the nonexistent control-plane service, the activation has nothing to fail on, so it reports success while nothing is actually running server-side. **This is `docs/GOTCHAS.md` #18** ("Gateway config in `renderGatewayGuest` never reaches the own-VPS gateway"), which explicitly predicts this class of recurrence. The prior commit `3762a67` (issue #442) fixed only the `/var/lib/ourcloud` tmpfiles rule for this exact divergence, by moving it into `ledger.nix` (`internal/clan/gateway_attach.go:337-349`, `renderLedgerDir`), written and imported on every gateway via `AttachGateway`/`baseMachineModules` (`gateway_attach.go:79`, `269-275`). GOTCHAS #18's own "Rule" section says the config *both shapes need* must ride that same composition point, "NOT `renderGatewayGuest`" — but the actual `ourcloud-control-plane` unit, `services.kanidm` (+ its `kanidm-tls`/`kanidm-admins` generators), `ourcloud-self-trust`, the IdP loopback bridge, the kanidm brand-push blocks, and `gatewayAssertions()` were all left behind in the VM-only render (`vmguest.go:106-369`). **Suspected layer:** `internal/clan` gateway composition (Nix render layer), specifically the VM/full-install divergence between `vmguest.go` and `enrollment.go`/`gateway_attach.go`. **What plugging it needs:** extend the `ledger.nix` pattern to the rest of the gateway service surface — extract `systemd.services.ourcloud-control-plane`, `services.kanidm` + its two generators, `ourcloud-self-trust`, `idpLoopbackBridge`, the kanidm brand-push blocks, and `gatewayAssertions()` out of `renderGatewayGuest` into a module `AttachGateway` writes/imports on every gateway (VM and full-install alike), keeping only host-baseline concerns (boot/network/qemu-guest profile) in the VM-only `renderVMGuestBaseline`/`renderGatewayGuest`. Needs a seam test at the composed OWN-VPS assembly (front door + acme-dns, no `gateway-guest.nix`) asserting the control-plane unit is present, matching `TestAttachGateway_LedgerHomeReachesOwnVPSGateway`'s shape (`gateway_attach_test.go`). This is a multi-file, design-bearing extraction (how the new module coexists with full-install's `networking.nix`/`disko.nix`/`platform.nix`/`access.nix`, and avoiding duplicate-attrpath collisions on the VM path once the inline definition is removed from `vmguest.go`) — out of scope for a healer self-fix. Advances #378. drive `20260811T204058Z` red at `finish`: `mexpect(mmlocatormm).mtoHaveCountm(mmexpectedmm)m failed Locator: locator('[data-status="journey-fault"]') Expected: mNm Received: mNm Timeout: Nms Call log: m - Expect "toHaveCount" with timeout Nmsm m - waiting for locator('[data-status="journey-fault"]')m m N × locator resolved to N elementm m - unexpected value "N"m` evidence: `test-results/…/20260811T204058Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) <!-- rehearsal-sig: 8d0cd71d20a2 --> --- ## RULED (Ben, 2026-08-11): STRUCTURAL fix — full-install emits the baseline — + fold in the deploy real-check This is the 6th recurrence of GOTCHAS #12 (full-install bakes no baseline): the own-VPS FullInstall assembles `machines/gateway/*.nix` piecemeal and never emits `gateway-guest.nix` (renderGatewayGuest, vmguest.go), so every capability that baseline carries has been re-ported one at a time — hostPlatform (#399), SSH identity (#410), trust (#432), loopback target (#436), ledger dir (#442), and now `ourcloud-control-plane.service` itself (vmguest.go:264). Stop porting pieces. **Do NOT just add the one service.** Make the own-VPS FullInstall path **emit the gateway baseline** — the cleanest shape: have the FullInstall configure stage write `gateway-guest.nix` (via `renderGatewayGuest`, the same render VM mode uses) into the machine dir and import it from `configuration.nix`, so the WHOLE baseline (control-plane service + whatever else it declares) crosses in one piece and this divergence stops generating teeth. Reconcile against what the FullInstall path already renders separately (front-door.nix, acme-dns.nix, kanidm in front-door, networking/disko/platform, ledger.nix from #442) so nothing double-declares — where the baseline and a standalone module overlap, one must win (the strip-line precedent renderGatewayGuest already uses for the VM baseline's allowedTCPPorts is the pattern). The acceptance bar: the own-VPS gateway's rendered config carries `ourcloud-control-plane.service`, and a seam test asserts the FULL-INSTALL assembly (not just gateway-guest.nix) contains it — the assertion that would have caught all six. **Fold in the deploy real-check (Ben):** `internal/founding/deploy.go`'s "the control plane is live" comes from `controlPlaneComponents()`, a STATIC label list — it never checks the unit is running, which is exactly why a gateway with no control-plane service still logged "live" and the gap hid until the finish-leg restart. The deploy leg must verify `ourcloud-control-plane.service` is actually `active` (systemctl is-active over the clan connection) before logging live / advancing — a real probe, fail-loud (ADR 0100), not a fabricated success. Add GOTCHAS #12 a line noting the control-plane service was the 6th port and the baseline-emit is the structural close. Scope is bigger than a one-liner but convergent — after this, the own-VPS gateway IS a gateway, not a hand-assembled subset. Stays priority/ready-for-agent.
Author
Owner

Landed on origin/main as 56875af (sandcastle: #443 …).

Structural close (Ben's ruling), not a 7th port. The own-VPS full-install gateway now EMITS the control-plane surface as its own module control-plane.nix (renderControlPlaneSurface, internal/clan/vmguest.go): the ourcloud-control-plane unit + ourcloud-self-trust + the kanidm-tls/kanidm-admins generators + the /etc secret pointers. writeNodeConfig's full-install branch bakes it and AttachGateway imports it via baseMachineModules — the same composition point as #442's ledger.nix. The VM path keeps the whole surface inline (renderGatewayGuest is proven byte-identical — a pure extraction into shared block helpers), so it never double-imports.

It deliberately omits what the full-install gateway gets elsewhere so nothing double-declares: services.kanidm (front-door.nix owns the public kanidm — origin id.<apex>, bound behind Caddy), the host baseline (networking/disko/platform/access), and the VM-only idp bridge / brand / build-time assertions. The generators here DECLARE the sealed paths front-door's kanidm already references at /run/secrets/vars/kanidm-tls — completing the public kanidm, not colliding.

Deploy real-check folded in. clan.UnitActive probes systemctl is-active ourcloud-control-plane.service over the clan connection; internal/founding/deploy.go runs it before reporting the control plane live and fails loud otherwise (ADR 0100) — the static-label fabricated "live" can never recur.

Verification. TestAttachGateway_ControlPlaneReachesOwnVPSGateway pins the unit against the FULL-INSTALL assembly (the assertion that would have caught all six ports). TestOwnVPSGateway_EvalSmoke now bakes + evaluates control-plane.nix under real nix — passed, no double-declaration (drvPath 7lf9vdg…). TestDeploy_FailsLoudWhenControlPlaneNotRunning proves the probe. drvPath baseline re-recorded; the seed-community/fleetgw row also moved — an incidental clan-core lock advance the smoke re-locked (render proven byte-identical), noted in the commit. GOTCHAS #12 carries the 6th-port + structural-close note. Advances #378.

Landed on `origin/main` as `56875af` (`sandcastle: #443 …`). **Structural close (Ben's ruling), not a 7th port.** The own-VPS full-install gateway now EMITS the control-plane surface as its own module `control-plane.nix` (`renderControlPlaneSurface`, `internal/clan/vmguest.go`): the `ourcloud-control-plane` unit + `ourcloud-self-trust` + the kanidm-tls/kanidm-admins generators + the `/etc` secret pointers. `writeNodeConfig`'s full-install branch bakes it and `AttachGateway` imports it via `baseMachineModules` — the same composition point as #442's `ledger.nix`. The VM path keeps the whole surface inline (`renderGatewayGuest` is proven **byte-identical** — a pure extraction into shared block helpers), so it never double-imports. It deliberately omits what the full-install gateway gets elsewhere so nothing double-declares: `services.kanidm` (front-door.nix owns the public kanidm — origin `id.<apex>`, bound behind Caddy), the host baseline (networking/disko/platform/access), and the VM-only idp bridge / brand / build-time assertions. The generators here DECLARE the sealed paths front-door's kanidm already references at `/run/secrets/vars/kanidm-tls` — completing the public kanidm, not colliding. **Deploy real-check folded in.** `clan.UnitActive` probes `systemctl is-active ourcloud-control-plane.service` over the clan connection; `internal/founding/deploy.go` runs it before reporting the control plane live and fails loud otherwise (ADR 0100) — the static-label fabricated "live" can never recur. **Verification.** `TestAttachGateway_ControlPlaneReachesOwnVPSGateway` pins the unit against the FULL-INSTALL assembly (the assertion that would have caught all six ports). `TestOwnVPSGateway_EvalSmoke` now bakes + evaluates `control-plane.nix` under real nix — **passed, no double-declaration** (drvPath `7lf9vdg…`). `TestDeploy_FailsLoudWhenControlPlaneNotRunning` proves the probe. drvPath baseline re-recorded; the `seed-community/fleetgw` row also moved — an incidental clan-core lock advance the smoke re-locked (render proven byte-identical), noted in the commit. GOTCHAS #12 carries the 6th-port + structural-close note. Advances #378.
ben closed this issue 2026-08-11 22:08:01 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/idss#443
No description provided.