services-row: S11's services apply runs clan machines update on a revision declaring ungenerated Nextcloud vars — ADR 0126's unsandboxed pre-generate never runs, so Files never stands up #1496

Closed
opened 2026-09-15 16:15:33 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260915T155605Z (rented-services), leg services-row, red at 19 green / 1 red:

the founding's own S11 row says Files did not stand up — the files row is failed: the deploy did not hold — add Files & documents from the control panel

The community itself came up live (control plane, brand, admin, both public front doors over TLS). Only the placed Files & documents service failed, exactly as internal/founding/services.go:242-245 words a provisioned && applyFailed row.

What actually happened

S11 provisioned and committed the files module, then applied that revision — and the apply died in seconds without ever reaching the box.

1. The services commit landed. state/clan-config (harvested config repo), commits all at 2026-09-15 16:07:07:

e636e9b idss: recompose gateway machine dir on gateway          <- res.Revision
dcb5727 idss: wire the Nextcloud admin export into gateway's control-plane surface
02a12d3 idss: attach front door routes on gateway
f1c7b35 idss: attach files (Nextcloud) module on gateway        <- machines/gateway/files.nix, +323, NEW FILE
1ec3f77 idss: assign gateway the role gateway

2. That new files.nix declares two brand-new clan-vars generators. git show e636e9b:machines/gateway/files.nix:

clan.core.vars.generators.nextcloud-admin = { files.adminpass = {...}; script = ''openssl rand ...''; };
clan.core.vars.generators.nextcloud-db    = { files.dbpass    = {...}; script = ''openssl rand ...''; };

Neither existed at the enroll-configure revision, so the enrollment's vars generate at 16:00:4x never covered them.

3. Neither generator was ever generated. git ls-files | grep ^vars/ on the harvested repo lists gate-oidc, idss-claim-secret, idss-community-ca-*, kanidm-*, netbird-*, state-version — and no nextcloud-admin, no nextcloud-db.

4. The apply died before any build or switch. logs/founding-state.log → standup.deploy.log:

services  : provisioning the services you placed on the gateway over the community's own installer
preflight : eval preflight passed
update    : the operation failed          <- classify() default branch, internal/clan/errors.go:336 (FailUnknown)
services  : the services deploy did not hold — the community stays live
services  : Files & documents was set up but the deploy did not hold

logs/droplet-journal.txt corroborates: the last on-box switch is clan-switch-gateway-ad7e4909 at 16:07:05→16:07:07 (the control-plane apply, before the services commits). After 16:07:07 there is no further switching to system configuration line at all, and every switch in the run targets the SAME store path /nix/store/qrhaj78fzqbdphdwv9izlh1wmq11w8qb-nixos-system-gateway-… — i.e. no system carrying Nextcloud was ever built. logs/droplet-units.txt confirms the box end state: Unit phpfpm-nextcloud.service could not be found, systemctl --failed empty. The deploy-complete milestone is stamped 16:07:30.910, so the whole services apply took ~20s — far too fast to have built a Nextcloud closure.

The defect

internal/founding/services.go:198-204 goes straight from the provision commit to the apply:

if len(res.Provisioned) > 0 {
    if failure, aerr := o.applyControlPlane(ctx, clanNode, clan.Commit(res.Revision), log); aerr != nil || failure != nil {

applyControlPlane (internal/founding/deploy.go:807) → clan.Deploy → deploy.updateNode (internal/clan/adapter.go:626-648), whose only invocation is:

Args: []string{"machines", "update", string(n), "--flake", flakeRef(...), "--host-key-check", "none", "--build-host", "localhost"}

There is no vars generate anywhere on the deploy path. But that is precisely what ADR 0126 forbids relying on — internal/clan/enrollment.go:22-31 (package doc) and :1098-1107:

clan's machines update/install needs the machine's declared vars to already exist, and bwrap's unprivileged userns sandboxing is unavailable on a typical operator laptop … machines update died with "Cannot safely execute generator state-version: Sandboxing is not available on this system"

So the enrollment leg runs clan vars generate <node> --flake <flake> --no-sandbox ahead of every update (internal/clan/enrollment.go:1150). The S11 services apply — which is the first apply after new module-declared generators appear — does not, and the drive host has kernel.apparmor_restrict_unprivileged_userns=1 (Ubuntu 24.04), exactly the ADR 0126 condition. Every observable matches: fast death, no vars committed, no build, no switch, and an error text matching none of classify()'s cases so it lands in the FailUnknown default.

This is not founding-only: internal/provision/deploy.go:693 (applyRevision, the P4 control-panel path) has the same gap, so "add Files from the control panel" — the remedy the failed row offers the operator — should hit the same wall.

A second, compounding defect: the cause was thrown away

internal/founding/services.go:200-203 discards BOTH the returned *clan.Failure (its Summary, Detail log excerpt and Tail) and aerr, logging only a generic sentence. The sibling branch six lines up (services.go:190) carries err.Error(), so this is an inconsistency, not a policy. The consequence is that the run directory contains no copy of clan's actual output — I grepped the whole of 20260915T155605Z/ and the only trace of the apply is "the operation failed". The root cause above had to be re-derived from the config-repo tree and the box journal rather than read. Carry the failure's Summary/Detail into the S11 log line the way the commit-error branch already does.

Suspected layer

The deploy seam (internal/clan) and its two callers (internal/founding/services.go, internal/provision/deploy.go).

Why this needs a ruling (refusal rule 3)

The fix is a missing unsandboxed pre-generate step, but where it belongs is a design decision, not a mechanical repair:

  • Putting it in deploy.updateNode fixes founding and P4 in one place, but changes the shared deploy hot path for every apply in the system.
  • Putting it at the call sites duplicates ADR 0126's discipline a third time.
  • clan.Vars.Generate (internal/clan/vars.go:81) cannot be reused as-is: it iterates m.Vars from the .idss sidecar inventory (generators registered via SetVarSpec), so it structurally cannot see generators declared inside a nix module like files.nix. A node-wide generate is what is actually needed — and vars.go:73-76 documents node-wide as deliberately avoided because it "would run undeclared prompting generators". Squaring that is a ruling.
  • Exposing enrollment's private generate() as a seam method touches the clan.Clan interface (internal/clan/clan.go), the adapter, internal/clan/testing/fake.go and the call site(s) — over the healer's 3-file cap either way.

I refused rather than take the fast lane because I cannot write a test here that proves the fix: the failure only reproduces against the real pinned clan CLI on a sandbox-restricted host, i.e. a paid re-drive. The diagnosis above is derived entirely from harvested artifacts and repo source, both cited.

drive 20260915T155605Z red at services-row: the founding's own S11 row says Files did not stand up — the files row is failed: the deploy did not hold — add Files & documents from the control panel
evidence: /home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260915T155605Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## The failure Drive `20260915T155605Z` (rented-services), leg **services-row**, red at 19 green / 1 red: > the founding's own S11 row says Files did not stand up — the files row is failed: the deploy did not hold — add Files & documents from the control panel The community itself came up live (control plane, brand, admin, both public front doors over TLS). Only the placed **Files & documents** service failed, exactly as `internal/founding/services.go:242-245` words a `provisioned && applyFailed` row. ## What actually happened S11 provisioned and committed the files module, then applied that revision — and the apply died in seconds without ever reaching the box. **1. The services commit landed.** `state/clan-config` (harvested config repo), commits all at `2026-09-15 16:07:07`: ``` e636e9b idss: recompose gateway machine dir on gateway <- res.Revision dcb5727 idss: wire the Nextcloud admin export into gateway's control-plane surface 02a12d3 idss: attach front door routes on gateway f1c7b35 idss: attach files (Nextcloud) module on gateway <- machines/gateway/files.nix, +323, NEW FILE 1ec3f77 idss: assign gateway the role gateway ``` **2. That new `files.nix` declares two brand-new clan-vars generators.** `git show e636e9b:machines/gateway/files.nix`: ```nix clan.core.vars.generators.nextcloud-admin = { files.adminpass = {...}; script = ''openssl rand ...''; }; clan.core.vars.generators.nextcloud-db = { files.dbpass = {...}; script = ''openssl rand ...''; }; ``` Neither existed at the enroll-configure revision, so the enrollment's `vars generate` at 16:00:4x never covered them. **3. Neither generator was ever generated.** `git ls-files | grep ^vars/` on the harvested repo lists `gate-oidc`, `idss-claim-secret`, `idss-community-ca-*`, `kanidm-*`, `netbird-*`, `state-version` — and **no `nextcloud-admin`, no `nextcloud-db`**. **4. The apply died before any build or switch.** `logs/founding-state.log` → `standup.deploy.log`: ``` services : provisioning the services you placed on the gateway over the community's own installer preflight : eval preflight passed update : the operation failed <- classify() default branch, internal/clan/errors.go:336 (FailUnknown) services : the services deploy did not hold — the community stays live services : Files & documents was set up but the deploy did not hold ``` `logs/droplet-journal.txt` corroborates: the last on-box switch is `clan-switch-gateway-ad7e4909` at 16:07:05→16:07:07 (the *control-plane* apply, before the services commits). After 16:07:07 there is no further `switching to system configuration` line at all, and every switch in the run targets the SAME store path `/nix/store/qrhaj78fzqbdphdwv9izlh1wmq11w8qb-nixos-system-gateway-…` — i.e. no system carrying Nextcloud was ever built. `logs/droplet-units.txt` confirms the box end state: `Unit phpfpm-nextcloud.service could not be found`, `systemctl --failed` empty. The deploy-complete milestone is stamped `16:07:30.910`, so the whole services apply took ~20s — far too fast to have built a Nextcloud closure. ## The defect `internal/founding/services.go:198-204` goes straight from the provision commit to the apply: ```go if len(res.Provisioned) > 0 { if failure, aerr := o.applyControlPlane(ctx, clanNode, clan.Commit(res.Revision), log); aerr != nil || failure != nil { ``` `applyControlPlane` (`internal/founding/deploy.go:807`) → `clan.Deploy` → `deploy.updateNode` (`internal/clan/adapter.go:626-648`), whose only invocation is: ```go Args: []string{"machines", "update", string(n), "--flake", flakeRef(...), "--host-key-check", "none", "--build-host", "localhost"} ``` There is **no `vars generate` anywhere on the deploy path**. But that is precisely what ADR 0126 forbids relying on — `internal/clan/enrollment.go:22-31` (package doc) and `:1098-1107`: > clan's `machines update`/`install` needs the machine's declared vars to already exist, and bwrap's unprivileged userns sandboxing is unavailable on a typical operator laptop … `machines update` died with "Cannot safely execute generator state-version: Sandboxing is not available on this system" So the enrollment leg runs `clan vars generate <node> --flake <flake> --no-sandbox` ahead of every update (`internal/clan/enrollment.go:1150`). The S11 services apply — which is the *first* apply after new module-declared generators appear — does not, and the drive host has `kernel.apparmor_restrict_unprivileged_userns=1` (Ubuntu 24.04), exactly the ADR 0126 condition. Every observable matches: fast death, no vars committed, no build, no switch, and an error text matching none of `classify()`'s cases so it lands in the `FailUnknown` default. This is **not founding-only**: `internal/provision/deploy.go:693` (`applyRevision`, the P4 control-panel path) has the same gap, so "add Files from the control panel" — the remedy the failed row offers the operator — should hit the same wall. ## A second, compounding defect: the cause was thrown away `internal/founding/services.go:200-203` discards BOTH the returned `*clan.Failure` (its `Summary`, `Detail` log excerpt and `Tail`) and `aerr`, logging only a generic sentence. The sibling branch six lines up (`services.go:190`) carries `err.Error()`, so this is an inconsistency, not a policy. The consequence is that the run directory contains **no copy of clan's actual output** — I grepped the whole of `20260915T155605Z/` and the only trace of the apply is `"the operation failed"`. The root cause above had to be re-derived from the config-repo tree and the box journal rather than read. Carry the failure's `Summary`/`Detail` into the S11 log line the way the commit-error branch already does. ## Suspected layer The deploy seam (`internal/clan`) and its two callers (`internal/founding/services.go`, `internal/provision/deploy.go`). ## Why this needs a ruling (refusal rule 3) The fix is a missing unsandboxed pre-generate step, but *where it belongs* is a design decision, not a mechanical repair: - Putting it in `deploy.updateNode` fixes founding **and** P4 in one place, but changes the shared deploy hot path for every apply in the system. - Putting it at the call sites duplicates ADR 0126's discipline a third time. - `clan.Vars.Generate` (`internal/clan/vars.go:81`) **cannot** be reused as-is: it iterates `m.Vars` from the `.idss` sidecar inventory (generators registered via `SetVarSpec`), so it structurally cannot see generators declared inside a nix module like `files.nix`. A node-wide generate is what is actually needed — and `vars.go:73-76` documents node-wide as deliberately avoided because it "would run undeclared prompting generators". Squaring that is a ruling. - Exposing enrollment's private `generate()` as a seam method touches the `clan.Clan` interface (`internal/clan/clan.go`), the adapter, `internal/clan/testing/fake.go` and the call site(s) — over the healer's 3-file cap either way. I refused rather than take the fast lane because I cannot write a test here that proves the fix: the failure only reproduces against the real pinned clan CLI on a sandbox-restricted host, i.e. a paid re-drive. The diagnosis above is derived entirely from harvested artifacts and repo source, both cited. drive `20260915T155605Z` red at `services-row`: `the founding's own S11 row says Files did not stand up — the files row is failed: the deploy did not hold — add Files & documents from the control panel` evidence: `/home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260915T155605Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: b0b6a45a7146 -->
Author
Member

Ruled by agent under ADR 0174 — veto anytime. The design ruling the ticket asked for, and the fix, are landed and proven at the seam level. Commit 47c3fcfd.

The ruling (the "why this needs a ruling" questions)

  • Where the pre-generate belongs: a NEW seam operation clan.GenerateNodeVars(node) (Commit, error) — node-wide, --no-sandbox, through the single writer, returning the post-generate tip — invoked by the deploy callers before the apply. This is enrollment's opening vars generate (ADR 0126, enrollment.go) lifted to a standalone step, so the ADR-0126 discipline lives in ONE place the steady-state callers reuse rather than being re-implemented at each site.
  • Not deploy.updateNode: the apply pins an EXACT revision (ADR 0102). A pre-generate commits vars as a NEW commit, so the apply must ride the POST-generate tip — a ?rev= pinned at the pre-generate revision git-archives a tree with none of the freshly-sealed ciphertext. The callers own the revision they pin, so they own the seal→advance→apply; deploy.Run stays pure (and rollback, which must go BACKWARD, is untouched).
  • Not the scoped Vars.Generate: confirmed it structurally cannot see a generator declared inside a nix module — it iterates the .idss sidecar inventory. Node-wide is what is actually needed, and it is exactly what enrollment already does; the "node-wide runs undeclared prompting generators" note is enrollment's own accepted posture (pre-fed answers), and here the new generators are non-prompting openssl rand.

What landed

  • internal/clan/clan.go — GenerateNodeVars on the Clan seam; internal/clan/vars.go — the *Adapter impl (mirrors enrollment's argv exactly); internal/clan/testing/fake.go — the fake + GeneratedNodeVars() accessor + GenerateNodeVarsFails hook.
  • Wired at ALL THREE service-apply sites: founding S11 (internal/founding/services.go), P4 add-from-panel (internal/provision/deploy.go), and the full-install takeover (internal/provision/takeover.go) — the last two via a shared provision.sealApplyNodeVars that advances run.Revision to the sealed tip.
  • Defect 2 fixed: S11 no longer discards the *clan.Failure — it carries the seam's classified Summary/Detail into the log line (servicesApplyFailureLines), so a future failed apply is READ, not re-derived from the config tree + box journal.
  • Docs: STATUS.md header entry; GOTCHAS.md #234.

Proof (revertible + provable — ADR 0174 rule 1)

Red→green seam tests, driving the fake clan CLI:

  • founding.TestStory_S11SealsGatewayVarsBeforeApplyingServices — S11 seals the gateway's vars before the apply and pins the sealed tip (was: never sealed).
  • provision.TestDeploy_GatewayFilesSealsVarsUnsandboxedBeforeApply — the P4 gateway-files co-host (the exact "add Files from the control panel" remedy) seals unsandboxed BEFORE clan.Deploy and pins the sealed tip.
  • The VMMode + takeover order/revision pins updated to the new sequence (seal → deploy).
  • Full repo go test ./... + go vet on touched packages clean; host gofmt gate passed on push.

The one-way residue: live green

The failure only reproduces against the real pinned clan CLI on a sandbox-restricted host (Ubuntu 24.04, apparmor_restrict_unprivileged_userns=1) — a paid drive, which a one-shot session does not run (ADR 0174 rule 7). The live green rides the next rented-services drive (#1491's rehearsal-executor frontier); the code change is proven to do exactly what ADR 0126 requires at the seam. Closing on that basis — the ticket asked for the ruling + fix, both complete; if the re-drive surprises, re-open.

**Ruled by agent under ADR 0174 — veto anytime.** The design ruling the ticket asked for, and the fix, are landed and proven at the seam level. Commit `47c3fcfd`. ## The ruling (the "why this needs a ruling" questions) - **Where the pre-generate belongs:** a NEW seam operation `clan.GenerateNodeVars(node) (Commit, error)` — node-wide, `--no-sandbox`, through the single writer, returning the post-generate tip — invoked by the deploy callers *before* the apply. This is enrollment's opening `vars generate` (ADR 0126, `enrollment.go`) lifted to a standalone step, so the ADR-0126 discipline lives in ONE place the steady-state callers reuse rather than being re-implemented at each site. - **Not `deploy.updateNode`:** the apply pins an EXACT revision (ADR 0102). A pre-generate commits vars as a NEW commit, so the apply must ride the POST-generate tip — a `?rev=` pinned at the pre-generate revision git-archives a tree with none of the freshly-sealed ciphertext. The callers own the revision they pin, so they own the seal→advance→apply; `deploy.Run` stays pure (and rollback, which must go BACKWARD, is untouched). - **Not the scoped `Vars.Generate`:** confirmed it structurally cannot see a generator declared inside a nix module — it iterates the `.idss` sidecar inventory. Node-wide is what is actually needed, and it is exactly what enrollment already does; the "node-wide runs undeclared prompting generators" note is enrollment's own accepted posture (pre-fed answers), and here the new generators are non-prompting `openssl rand`. ## What landed - `internal/clan/clan.go` — `GenerateNodeVars` on the `Clan` seam; `internal/clan/vars.go` — the `*Adapter` impl (mirrors enrollment's argv exactly); `internal/clan/testing/fake.go` — the fake + `GeneratedNodeVars()` accessor + `GenerateNodeVarsFails` hook. - Wired at ALL THREE service-apply sites: founding S11 (`internal/founding/services.go`), P4 add-from-panel (`internal/provision/deploy.go`), and the full-install takeover (`internal/provision/takeover.go`) — the last two via a shared `provision.sealApplyNodeVars` that advances `run.Revision` to the sealed tip. - **Defect 2 fixed:** S11 no longer discards the `*clan.Failure` — it carries the seam's classified `Summary`/`Detail` into the log line (`servicesApplyFailureLines`), so a future failed apply is READ, not re-derived from the config tree + box journal. - Docs: `STATUS.md` header entry; `GOTCHAS.md` #234. ## Proof (revertible + provable — ADR 0174 rule 1) Red→green seam tests, driving the fake clan CLI: - `founding.TestStory_S11SealsGatewayVarsBeforeApplyingServices` — S11 seals the gateway's vars before the apply and pins the sealed tip (was: never sealed). - `provision.TestDeploy_GatewayFilesSealsVarsUnsandboxedBeforeApply` — the P4 gateway-files co-host (the exact "add Files from the control panel" remedy) seals unsandboxed BEFORE `clan.Deploy` and pins the sealed tip. - The VMMode + takeover order/revision pins updated to the new sequence (seal → deploy). - Full repo `go test ./...` + `go vet` on touched packages clean; host gofmt gate passed on push. ## The one-way residue: live green The failure only reproduces against the real pinned clan CLI on a sandbox-restricted host (Ubuntu 24.04, `apparmor_restrict_unprivileged_userns=1`) — a paid drive, which a one-shot session does not run (ADR 0174 rule 7). The live green rides the next `rented-services` drive (#1491's rehearsal-executor frontier); the code change is proven to do exactly what ADR 0126 requires at the seam. Closing on that basis — the ticket asked for the ruling + fix, both complete; if the re-drive surprises, re-open.
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#1496
No description provided.