provision: deploy writes a phantom clan-core inventory module — wire the service live-set orchestrator to the real Attach* renders #351

Closed
opened 2026-08-09 05:01:19 +00:00 by ben · 2 comments
Owner

Problem

The P4 provisioning journey completes end to end in the UI — Assess → Select → Review impact → Deploy → Active — but the ticked service never actually runs. The deploy path and the real per-service NixOS renders are two disconnected paths:

  • internal/provision/deploy.go:214 calls the generic Config().AttachService, which at internal/clan/config.go:84 writes an inventory instance invModule{Name: s.Service, Input: "clan-core"} — i.e. provisioning files declares a clan-core module literally named "files", which does not exist.
  • Meanwhile the real render exists and works: internal/clan/files.go RenderFiles(FilesConfig) emits files.nix (services.nextcloud, local Postgres, admin + DB secrets on clan-var paths, nextcloud-brand theming oneshot), applied by (*Adapter).AttachFiles in internal/clan/files_attach.go — but AttachFiles/FilesLiveSet have zero production callers (only their own tests).
  • The only production AttachGateway call is internal/clan/enrollment.go:265, with an empty live set — its own comment says the enrollment path assembles no service live set yet and composes the baseline alone.

STATUS.md (§ the gateway composition, ~line 404) names this as the open frontier:

STILL TO LAND: a production ORCHESTRATOR that assembles the real SERVICE live set (apex + service placement + secret paths) from the running fleet and passes it to AttachGateway — the per-service Attach* have no production caller yet; that assembly is the next slice.

What to build

The service live-set orchestrator: when provisioning deploys (and when enrollment re-composes the gateway), assemble the live set from the running fleet — which node holds which role/services, the community apex, and the secret paths the Attach* configs need — and drive the real Attach* renders instead of (or beneath) the phantom clan-core inventory write.

  • Provisioning files onto a helper node must call AttachFiles with a FilesConfig derived from the fleet (host, apex, secret paths), so the deployed machine actually gets services.nextcloud.
  • The gateway's GatewayLiveSet (internal/clan/gateway_attach.go:54-66: FrontDoor, AcmeDNS, Code, Mail) must be assembled from what is actually placed, not passed empty.
  • The existing health checks close the loop: control-plane/cmd/control-plane/servicehealth.go:401 nextcloudHealthCheck (/status.php) is already registered when deps.nextcloudURL derives (whole_composition.go:61-64), so P4-S4's health gate should go green for real.
  • Remove or subordinate the invModule{Input: "clan-core"} write for catalogue services that ship their own render — a deploy that "succeeds" while declaring a nonexistent module is a silent lie.

Acceptance

  • P4 deploy of files on a helper produces a machine config containing the rendered files.nix, with secrets on the declared clan-var paths — proven by tests at the adapter seam.
  • Enrollment/provisioning composes the gateway with the real live set assembled from fleet state (the enrollment.go:265 comment's placeholder is retired).
  • No deploy path writes an inventory module name that has no corresponding module.
  • The deferred clan-lab smoke (assign-files → deploy → health-pass, STATUS.md ~line 1810) becomes runnable; running it is a separate live-drive leg, not this ticket's gate.

Out of scope

Whether the gateway may co-host catalogue services (Nextcloud-on-gateway) is the sibling design ticket — this ticket wires the existing helper-role path. Landing this first is what makes any colocation ruling actionable.

(Sibling design ticket: #352.)

## Problem The P4 provisioning journey completes end to end in the UI — Assess → Select → Review impact → Deploy → Active — but the ticked service never actually runs. The deploy path and the real per-service NixOS renders are two disconnected paths: - `internal/provision/deploy.go:214` calls the generic `Config().AttachService`, which at `internal/clan/config.go:84` writes an inventory instance `invModule{Name: s.Service, Input: "clan-core"}` — i.e. provisioning `files` declares a clan-core module literally named `"files"`, **which does not exist**. - Meanwhile the real render exists and works: `internal/clan/files.go` `RenderFiles(FilesConfig)` emits `files.nix` (`services.nextcloud`, local Postgres, admin + DB secrets on clan-var paths, `nextcloud-brand` theming oneshot), applied by `(*Adapter).AttachFiles` in `internal/clan/files_attach.go` — but `AttachFiles`/`FilesLiveSet` have **zero production callers** (only their own tests). - The only production `AttachGateway` call is `internal/clan/enrollment.go:265`, with an **empty** live set — its own comment says the enrollment path assembles no service live set yet and composes the baseline alone. `STATUS.md` (§ the gateway composition, ~line 404) names this as the open frontier: > STILL TO LAND: a production ORCHESTRATOR that assembles the real SERVICE live set (apex + service placement + secret paths) from the running fleet and passes it to `AttachGateway` — the per-service `Attach*` have no production caller yet; that assembly is the next slice. ## What to build The service live-set orchestrator: when provisioning deploys (and when enrollment re-composes the gateway), assemble the live set from the running fleet — which node holds which role/services, the community apex, and the secret paths the `Attach*` configs need — and drive the real `Attach*` renders instead of (or beneath) the phantom `clan-core` inventory write. - Provisioning `files` onto a helper node must call `AttachFiles` with a `FilesConfig` derived from the fleet (host, apex, secret paths), so the deployed machine actually gets `services.nextcloud`. - The gateway's `GatewayLiveSet` (`internal/clan/gateway_attach.go:54-66`: FrontDoor, AcmeDNS, Code, Mail) must be assembled from what is actually placed, not passed empty. - The existing health checks close the loop: `control-plane/cmd/control-plane/servicehealth.go:401` `nextcloudHealthCheck` (`/status.php`) is already registered when `deps.nextcloudURL` derives (`whole_composition.go:61-64`), so P4-S4's health gate should go green for real. - Remove or subordinate the `invModule{Input: "clan-core"}` write for catalogue services that ship their own render — a deploy that "succeeds" while declaring a nonexistent module is a silent lie. ## Acceptance - P4 deploy of `files` on a helper produces a machine config containing the rendered `files.nix`, with secrets on the declared clan-var paths — proven by tests at the adapter seam. - Enrollment/provisioning composes the gateway with the real live set assembled from fleet state (the `enrollment.go:265` comment's placeholder is retired). - No deploy path writes an inventory module name that has no corresponding module. - The deferred clan-lab smoke (assign-files → deploy → health-pass, `STATUS.md` ~line 1810) becomes runnable; running it is a separate live-drive leg, not this ticket's gate. ## Out of scope Whether the **gateway** may co-host catalogue services (Nextcloud-on-gateway) is the sibling design ticket — this ticket wires the existing helper-role path. Landing this first is what makes any colocation ruling actionable. (Sibling design ticket: #352.)
Author
Owner

Helper-role half landed and pushed (origin/main e4c7970), and a scope decision on the remaining half needs a human.

What landed (AC1, AC3, AC4-enabling)

The service live-set orchestrator's helper-role path: the P4 deploy now drives the REAL AttachFiles render for the files service instead of the phantom invModule{Input:"clan-core"} inventory write.

  • internal/clan: AttachFiles joins the Clan interface; FilesSlug exported; deploy-time live-set conventions (NextcloudAdminUser, NextcloudAdminPassPath, NextcloudDBPassPath) get one home beside the render; the clan-testing Fake records AttachFiles and refuses an apex-less placement (ADR 0113).

  • internal/provision: Orchestrator.attachCatalogueService routes a self-rendering service (files) to AttachFiles, assembling the live set from the fleet (node + community apex + clan-var secret paths); a renderless service still lands as a declarative inventory placement. Both deploy paths (deployServicesOnly, deployTakeover) use it. New WithCommunityApex option, wired from deps.apex in whole_composition.go.

  • A files deploy with no apex is refused, never fabricated.

  • AC1 — P4 files deploy produces a machine config with the rendered files.nix + secrets on the declared clan-var paths ✅ (seam-tested: deploy_test.go routes to AttachFiles with the fleet-derived live set; files_attach_test.go proves the render).

  • AC3 — no deploy path writes an inventory module name with no corresponding module ✅ (proven: the deploy asserts no attach-service files inventory write; a no-apex deploy does not fall back to the phantom write).

  • AC4 — the deferred clan-lab assign-files → deploy → health-pass smoke is now runnable (the wiring half); running it is the separate live-drive leg.

go build/vet/test + gofmt + golangci-lint green. (The commit also cleared pre-existing whole-repo gate lint/gofmt debt — DDR 0145 idpbrand Css→CSS, a fleetwire test param, a frontdoor_attach.go alignment — the #142/#198 'never leave the gate wedged' precedent.)

What remains (AC2) — the decision

The GATEWAY half: assembling the real GatewayLiveSet (front-door/acme-dns/code/mail) from what is placed and passing it to AttachGateway, so enrollment.go:265's baseline-only placeholder retires. This is blocked on inputs the enrollment seam does not carry — the apex, mesh targets, IDP host, delegated zone and secret files are absent from EnrollRequest/GatewayFacts (the GatewayFacts doc itself notes 'Task 9 fills it from founding') — and it overlaps the gateway-colocation ruling (sibling #352). No production code assembles a FrontDoorLiveSet today (only tests do). So AC2 is a separate, larger slice that first needs the founding→enrollment seam threaded.

Decision needed: (A) close #351 — the helper-role path was the stated deliverable ('this ticket wires the existing helper-role path') — and split AC2 (gateway live-set assembly) into its own follow-up; or (B) keep #351 open until the gateway half also lands. Asked in chat; no reply within the window, so routing to ready-for-human. A maintainer: pick A (and I'll happily take the follow-up) or B (re-add ready-for-agent once the enrollment-seam inputs are available).

**Helper-role half landed and pushed** (origin/main `e4c7970`), and a scope decision on the remaining half needs a human. ### What landed (AC1, AC3, AC4-enabling) The service live-set orchestrator's helper-role path: the P4 deploy now drives the REAL `AttachFiles` render for the `files` service instead of the phantom `invModule{Input:"clan-core"}` inventory write. - `internal/clan`: `AttachFiles` joins the `Clan` interface; `FilesSlug` exported; deploy-time live-set conventions (`NextcloudAdminUser`, `NextcloudAdminPassPath`, `NextcloudDBPassPath`) get one home beside the render; the clan-testing `Fake` records AttachFiles and refuses an apex-less placement (ADR 0113). - `internal/provision`: `Orchestrator.attachCatalogueService` routes a self-rendering service (files) to `AttachFiles`, assembling the live set from the fleet (node + community apex + clan-var secret paths); a renderless service still lands as a declarative inventory placement. Both deploy paths (`deployServicesOnly`, `deployTakeover`) use it. New `WithCommunityApex` option, wired from `deps.apex` in `whole_composition.go`. - A files deploy with no apex is refused, never fabricated. - **AC1** — P4 files deploy produces a machine config with the rendered `files.nix` + secrets on the declared clan-var paths ✅ (seam-tested: `deploy_test.go` routes to AttachFiles with the fleet-derived live set; `files_attach_test.go` proves the render). - **AC3** — no deploy path writes an inventory module name with no corresponding module ✅ (proven: the deploy asserts no `attach-service files` inventory write; a no-apex deploy does not fall back to the phantom write). - **AC4** — the deferred clan-lab `assign-files → deploy → health-pass` smoke is now runnable (the wiring half); running it is the separate live-drive leg. `go build/vet/test` + gofmt + golangci-lint green. (The commit also cleared pre-existing whole-repo gate lint/gofmt debt — DDR 0145 `idpbrand` `Css→CSS`, a fleetwire test param, a `frontdoor_attach.go` alignment — the #142/#198 'never leave the gate wedged' precedent.) ### What remains (AC2) — the decision The GATEWAY half: assembling the real `GatewayLiveSet` (front-door/acme-dns/code/mail) from what is placed and passing it to `AttachGateway`, so `enrollment.go:265`'s baseline-only placeholder retires. This is blocked on inputs the enrollment seam does **not** carry — the apex, mesh targets, IDP host, delegated zone and secret files are absent from `EnrollRequest`/`GatewayFacts` (the `GatewayFacts` doc itself notes 'Task 9 fills it from founding') — and it overlaps the gateway-colocation ruling (sibling #352). No production code assembles a `FrontDoorLiveSet` today (only tests do). So AC2 is a separate, larger slice that first needs the founding→enrollment seam threaded. **Decision needed:** (A) close #351 — the helper-role path was the stated deliverable ('this ticket wires the existing helper-role path') — and split AC2 (gateway live-set assembly) into its own follow-up; or (B) keep #351 open until the gateway half also lands. Asked in chat; no reply within the window, so routing to `ready-for-human`. A maintainer: pick A (and I'll happily take the follow-up) or B (re-add `ready-for-agent` once the enrollment-seam inputs are available).
Author
Owner

Ben's ruling: option A. The helper-role path was this ticket's stated deliverable and it is landed, pushed (e4c7970) and seam-proven — closing. AC2 (gateway live-set assembly + the founding→enrollment seam threading it needs) is split out as #354 (ready-for-agent). #352's dependency edge is re-pointed from this ticket to #354 so the headroom gate still cannot land before the gateway assembly exists.

Ben's ruling: **option A**. The helper-role path was this ticket's stated deliverable and it is landed, pushed (`e4c7970`) and seam-proven — closing. AC2 (gateway live-set assembly + the founding→enrollment seam threading it needs) is split out as **#354** (`ready-for-agent`). #352's dependency edge is re-pointed from this ticket to #354 so the headroom gate still cannot land before the gateway assembly exists.
ben closed this issue 2026-08-09 13:28:14 +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.

Dependencies

No dependencies set.

Reference
Matou/idss#351
No description provided.