services-row: the OIDC halves redefine an attribute path meshBound already owns, so the gateway stops evaluating and every placed service dies with it #1557

Closed
opened 2026-09-17 00:23:41 +00:00 by matou-build-agent · 1 comment

The failure

drive-rented-services/20260917T000009Z — 19 legs green, services-row red (artifacts/verdict.json, artifacts/legs.json). The founding itself stood up: deploy, activation and founded all green, the branded portal live at https://roles-proof.idss.nz, both public front doors answering over TLS. But S11's own row reported 6 placed services did not stand up — files, archive, document-archive, whakapapa, surveys, data-collections, each failed: the deploy did not hold — add … from the control panel (artifacts/services-rows.json).

The evidence

logs/founding-state.log → standup.deploy.log, the services stage, carries the real cause:

could not seal the placed services' secrets (clan: config mutation "idss: seal declared vars for gateway":
clan: config_eval on gateway: the node's config does not evaluate:
Reason: attribute 'systemd.services.paperless-web.after' already defined at
  /nix/store/…-source/machines/gateway/paperless.nix:80:3)

The captured config in state/clan-config/machines/gateway/paperless.nix shows the collision directly — line 80 and line 235 define the same attribute path at the module's own attrset level. Running nix-instantiate --parse over that captured file reproduces the drive's error verbatim, pointing at paperless.nix:235:3.

Both lines come from the same renderer:

  • internal/clan/paperless.go:529 — renderPaperlessOIDC emits systemd.services.paperless-web.after = [ "document-archive-oidc.service" ];
  • internal/clan/netbird.go:712 — meshBound("paperless-web"), called from internal/clan/paperless.go:273, emits systemd.services.paperless-web.after = [ "netbird-mesh.service" ];

The comment at internal/clan/paperless.go:526 states the false premise outright: "after MERGES with meshBound's (NixOS list option)". That merge is real, but it happens across module definitions. The same attribute path twice in one attrset is a Nix parse/eval error that fires before the module system is ever consulted. internal/clan/netbird_test.go:555-557 already names this exact hazard for the control plane ("a path-leaf meshBound would be a raw-attrset conflict") — the two OIDC ports just missed it.

Because the gateway's config_eval failed, the vars seal failed, so every placed service reported "the deploy did not hold" — the six failures are one fault, not six.

A second, unfired instance of the same defect

Scanning every generated module in state/clan-config/machines/gateway/ for duplicate top-level attribute paths turned up two more, both in whakapapa.nix, both from renderWhakapapaOIDC:

  • systemd.tmpfiles.rules at lines 103 and 202 — internal/clan/whakapapa.go:695 against the store's own at internal/clan/whakapapa.go:440 (same false comment at :694)
  • systemd.services.podman-grampsweb.after at lines 207 and 359 — internal/clan/whakapapa.go:700 against meshBound("podman-grampsweb") at internal/clan/whakapapa.go:295 (same false comment at :697-698)

The drive never reached these: paperless.nix fails eval first. Fixing only paperless would have spent the next paid box rediscovering the twin, so both are repaired in this commit.

Suspected layer

The Nix render layer (internal/clan/), specifically the *-oidc halves added by #1538 (9f5524ef) and #1539 (b4d0b51e). Nothing in the deploy runner, the seal, or the app is at fault — they reported the eval failure accurately.

The fix

Both OIDC halves now emit their definitions as an inline module inside imports = [ … ], which is a separate module definition, so the list options merge exactly as the comments always intended: After= carries both units, and both tmpfiles rules land. internal/clan/netbird_test.go gains TestRenderedModules_NoDuplicateTopLevelAttrPath, the rail behind the hazard ADR 0159 decision 5 already names.

Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime)

Mechanical repair, not a design decision. Nothing about what the product means to do changes: paperless-web still orders after document-archive-oidc, podman-grampsweb still orders after whakapapa-oidc, both still order after netbird-mesh, and the whakapapa oidc env file still gets its tmpfiles rule. The only change is where in the module those definitions sit, so that Nix accepts them. No new default, no changed message at a trust moment, no route shape, no secrets shape, no security posture — the emitted units, secrets and ordering are byte-equivalent in meaning. The existing render assertions (internal/clan/paperless_test.go:294,298, internal/clan/whakapapa_test.go:264,316,377) all still pass unedited, which is itself evidence nothing the checks prove was weakened.

Two-way door — revertible. git revert 6a4c4884 restores the previous emission exactly; the change is three files of render text with no migration, no state, no on-box artifact, and nothing persisted outside the generated module. A later commit is free to pick a different merge mechanism (a variadic meshBound, say) without unwinding anything.

Proven by tests written here. TestRenderedModules_NoDuplicateTopLevelAttrPath in internal/clan/netbird_test.go was written first and run red, and it reproduced the drive's own line numbers before the fix — paperless-web.after [80 235], matching paperless.nix:80:3 in founding-state.log exactly — plus the two unfired whakapapa collisions. It passes after the fix, and the full internal/clan package is green. Independently confirmed outside Go: nix-instantiate --parse on the drive's captured paperless.nix reproduces attribute 'systemd.services.paperless-web.after' already defined, while both post-fix renders parse clean. gofmt clean, go vet clean.

Rules 1 and 2 hold. No assertion, expectation, test or leg was edited, deleted or skipped — the diff on the test file is +50/-0. Three files, 36 changed non-test lines (paperless.go 15/3, whakapapa.go 21/7), one commit. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes.

drive 20260917T000009Z red at services-row (sig b0b6a45a7146) — self-fixed on the fast lane, commit 1ba9448db578ae52a8a74a9512df2e5b24d2f0e7; checks: Targeted (red-first): GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderedModules_NoDuplicateTopLevelAttrPath — RED before the fix with 3 failures reproducing the drive's own line numbers (paperless (OIDC): "systemd.services.paperless-web.after" defined 2 times, lines [80 235]; whakapapa (OIDC): "systemd.tmpfiles.rules" lines [103 202]; whakapapa (OIDC): "systemd.services.podman-grampsweb.after" lines [207 359]), and ok git.matou.nz/Matou/idss/internal/clan 0.005s after. Package tests: GOWORK=… go test ./internal/clan — ok git.matou.nz/Matou/idss/internal/clan 26.722s, all green. Independent Nix confirmation: nix-instantiate --parse on the drive's captured state/clan-config/machines/gateway/paperless.nix reproduces error: attribute 'systemd.services.paperless-web.after' already defined at …paperless.nix:80:3 / at …:235:3, while the post-fix RenderPaperless(samplePaperlessOIDC()) and RenderWhakapapa(sampleWhakapapaOIDC()) outputs both PARSE-OK. gofmt -l internal/clan/ clean; go vet ./internal/clan clean.. evidence: /home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260917T000009Z on matou-workstation.

## The failure `drive-rented-services/20260917T000009Z` — 19 legs green, `services-row` red (`artifacts/verdict.json`, `artifacts/legs.json`). The founding itself stood up: `deploy`, `activation` and `founded` all green, the branded portal live at `https://roles-proof.idss.nz`, both public front doors answering over TLS. But S11's own row reported **6 placed services did not stand up** — files, archive, document-archive, whakapapa, surveys, data-collections, each `failed: the deploy did not hold — add … from the control panel` (`artifacts/services-rows.json`). ## The evidence `logs/founding-state.log` → `standup.deploy.log`, the `services` stage, carries the real cause: ``` could not seal the placed services' secrets (clan: config mutation "idss: seal declared vars for gateway": clan: config_eval on gateway: the node's config does not evaluate: Reason: attribute 'systemd.services.paperless-web.after' already defined at /nix/store/…-source/machines/gateway/paperless.nix:80:3) ``` The captured config in `state/clan-config/machines/gateway/paperless.nix` shows the collision directly — line 80 and line 235 define the same attribute path at the module's own attrset level. Running `nix-instantiate --parse` over that captured file reproduces the drive's error verbatim, pointing at `paperless.nix:235:3`. Both lines come from the same renderer: - `internal/clan/paperless.go:529` — `renderPaperlessOIDC` emits `systemd.services.paperless-web.after = [ "document-archive-oidc.service" ];` - `internal/clan/netbird.go:712` — `meshBound("paperless-web")`, called from `internal/clan/paperless.go:273`, emits `systemd.services.paperless-web.after = [ "netbird-mesh.service" ];` The comment at `internal/clan/paperless.go:526` states the false premise outright: "`after` MERGES with meshBound's (NixOS list option)". That merge is real, but it happens across module **definitions**. The same attribute path twice in **one** attrset is a Nix parse/eval error that fires before the module system is ever consulted. `internal/clan/netbird_test.go:555-557` already names this exact hazard for the control plane ("a path-leaf meshBound would be a raw-attrset conflict") — the two OIDC ports just missed it. Because the gateway's `config_eval` failed, the vars seal failed, so **every** placed service reported "the deploy did not hold" — the six failures are one fault, not six. ## A second, unfired instance of the same defect Scanning every generated module in `state/clan-config/machines/gateway/` for duplicate top-level attribute paths turned up two more, both in `whakapapa.nix`, both from `renderWhakapapaOIDC`: - `systemd.tmpfiles.rules` at lines 103 and 202 — `internal/clan/whakapapa.go:695` against the store's own at `internal/clan/whakapapa.go:440` (same false comment at `:694`) - `systemd.services.podman-grampsweb.after` at lines 207 and 359 — `internal/clan/whakapapa.go:700` against `meshBound("podman-grampsweb")` at `internal/clan/whakapapa.go:295` (same false comment at `:697-698`) The drive never reached these: `paperless.nix` fails eval first. Fixing only paperless would have spent the next paid box rediscovering the twin, so both are repaired in this commit. ## Suspected layer The Nix render layer (`internal/clan/`), specifically the `*-oidc` halves added by #1538 (`9f5524ef`) and #1539 (`b4d0b51e`). Nothing in the deploy runner, the seal, or the app is at fault — they reported the eval failure accurately. ## The fix Both OIDC halves now emit their definitions as an inline module inside `imports = [ … ]`, which **is** a separate module definition, so the list options merge exactly as the comments always intended: `After=` carries both units, and both tmpfiles rules land. `internal/clan/netbird_test.go` gains `TestRenderedModules_NoDuplicateTopLevelAttrPath`, the rail behind the hazard ADR 0159 decision 5 already names. ## Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime) **Mechanical repair, not a design decision.** Nothing about what the product *means* to do changes: paperless-web still orders after `document-archive-oidc`, podman-grampsweb still orders after `whakapapa-oidc`, both still order after `netbird-mesh`, and the whakapapa oidc env file still gets its tmpfiles rule. The only change is *where in the module* those definitions sit, so that Nix accepts them. No new default, no changed message at a trust moment, no route shape, no secrets shape, no security posture — the emitted units, secrets and ordering are byte-equivalent in meaning. The existing render assertions (`internal/clan/paperless_test.go:294,298`, `internal/clan/whakapapa_test.go:264,316,377`) all still pass unedited, which is itself evidence nothing the checks prove was weakened. **Two-way door — revertible.** `git revert 6a4c4884` restores the previous emission exactly; the change is three files of render text with no migration, no state, no on-box artifact, and nothing persisted outside the generated module. A later commit is free to pick a different merge mechanism (a variadic `meshBound`, say) without unwinding anything. **Proven by tests written here.** `TestRenderedModules_NoDuplicateTopLevelAttrPath` in `internal/clan/netbird_test.go` was written first and run red, and it reproduced the drive's own line numbers before the fix — `paperless-web.after [80 235]`, matching `paperless.nix:80:3` in `founding-state.log` exactly — plus the two unfired whakapapa collisions. It passes after the fix, and the full `internal/clan` package is green. Independently confirmed outside Go: `nix-instantiate --parse` on the drive's captured `paperless.nix` reproduces `attribute 'systemd.services.paperless-web.after' already defined`, while both post-fix renders parse clean. `gofmt` clean, `go vet` clean. **Rules 1 and 2 hold.** No assertion, expectation, test or leg was edited, deleted or skipped — the diff on the test file is +50/-0. Three files, 36 changed non-test lines (paperless.go 15/3, whakapapa.go 21/7), one commit. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes. drive `20260917T000009Z` red at `services-row` (sig b0b6a45a7146) — self-fixed on the fast lane, commit `1ba9448db578ae52a8a74a9512df2e5b24d2f0e7`; checks: Targeted (red-first): `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderedModules_NoDuplicateTopLevelAttrPath` — RED before the fix with 3 failures reproducing the drive's own line numbers (`paperless (OIDC): "systemd.services.paperless-web.after" defined 2 times, lines [80 235]`; `whakapapa (OIDC): "systemd.tmpfiles.rules" lines [103 202]`; `whakapapa (OIDC): "systemd.services.podman-grampsweb.after" lines [207 359]`), and `ok git.matou.nz/Matou/idss/internal/clan 0.005s` after. Package tests: `GOWORK=… go test ./internal/clan` — `ok git.matou.nz/Matou/idss/internal/clan 26.722s`, all green. Independent Nix confirmation: `nix-instantiate --parse` on the drive's captured `state/clan-config/machines/gateway/paperless.nix` reproduces `error: attribute 'systemd.services.paperless-web.after' already defined at …paperless.nix:80:3 / at …:235:3`, while the post-fix `RenderPaperless(samplePaperlessOIDC())` and `RenderWhakapapa(sampleWhakapapaOIDC())` outputs both PARSE-OK. `gofmt -l internal/clan/` clean; `go vet ./internal/clan` clean.. evidence: `/home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260917T000009Z` on matou-workstation. <!-- rehearsal-sig: b0b6a45a7146 -->
Author
Member

close-report for #1557 — status success

✅ close-report gates passed — every claim verified against main; issue closed.

envelope
{
  "issue": 1557,
  "status": "success",
  "commits": [
    "1ba9448db578ae52a8a74a9512df2e5b24d2f0e7"
  ],
  "changed_files": [
    "internal/clan/netbird_test.go",
    "internal/clan/paperless.go",
    "internal/clan/whakapapa.go"
  ],
  "tests": [
    {
      "command": "Targeted (red-first): `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderedModules_NoDuplicateTopLevelAttrPath` — RED before the fix with 3 failures reproducing the drive's own line numbers (`paperless (OIDC): \"systemd.services.paperless-web.after\" defined 2 times, lines [80 235]`; `whakapapa (OIDC): \"systemd.tmpfiles.rules\" lines [103 202]`; `whakapapa (OIDC): \"systemd.services.podman-grampsweb.after\" lines [207 359]`), and `ok git.matou.nz/Matou/idss/internal/clan 0.005s` after. Package tests: `GOWORK=… go test ./internal/clan` — `ok git.matou.nz/Matou/idss/internal/clan 26.722s`, all green. Independent Nix confirmation: `nix-instantiate --parse` on the drive's captured `state/clan-config/machines/gateway/paperless.nix` reproduces `error: attribute 'systemd.services.paperless-web.after' already defined at …paperless.nix:80:3 / at …:235:3`, while the post-fix `RenderPaperless(samplePaperlessOIDC())` and `RenderWhakapapa(sampleWhakapapaOIDC())` outputs both PARSE-OK. `gofmt -l internal/clan/` clean; `go vet ./internal/clan` clean.",
      "exit_code": 0
    }
  ],
  "criteria": {
    "the red leg is now green": "healed on the fast lane, commit 1ba9448db578ae52a8a74a9512df2e5b24d2f0e7"
  },
  "summary": "renderPaperlessOIDC and renderWhakapapaOIDC defined attribute paths (`…paperless-web.after`, `…podman-grampsweb.after`, `systemd.tmpfiles.rules`) that meshBound and the store already defined in the same attrset — a Nix eval error, not the list merge the comments claimed — which failed the gateway's config_eval, failed the vars seal, and made all six placed services report \"the deploy did not hold\"; both halves now emit their definitions as an inline module in `imports`, where the lists genuinely merge.",
  "blockers": []
}
**close-report** for #1557 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1557, "status": "success", "commits": [ "1ba9448db578ae52a8a74a9512df2e5b24d2f0e7" ], "changed_files": [ "internal/clan/netbird_test.go", "internal/clan/paperless.go", "internal/clan/whakapapa.go" ], "tests": [ { "command": "Targeted (red-first): `GOWORK=/home/dev/rehearsal-heal/idss/go.work go test ./internal/clan -run TestRenderedModules_NoDuplicateTopLevelAttrPath` — RED before the fix with 3 failures reproducing the drive's own line numbers (`paperless (OIDC): \"systemd.services.paperless-web.after\" defined 2 times, lines [80 235]`; `whakapapa (OIDC): \"systemd.tmpfiles.rules\" lines [103 202]`; `whakapapa (OIDC): \"systemd.services.podman-grampsweb.after\" lines [207 359]`), and `ok git.matou.nz/Matou/idss/internal/clan 0.005s` after. Package tests: `GOWORK=… go test ./internal/clan` — `ok git.matou.nz/Matou/idss/internal/clan 26.722s`, all green. Independent Nix confirmation: `nix-instantiate --parse` on the drive's captured `state/clan-config/machines/gateway/paperless.nix` reproduces `error: attribute 'systemd.services.paperless-web.after' already defined at …paperless.nix:80:3 / at …:235:3`, while the post-fix `RenderPaperless(samplePaperlessOIDC())` and `RenderWhakapapa(sampleWhakapapaOIDC())` outputs both PARSE-OK. `gofmt -l internal/clan/` clean; `go vet ./internal/clan` clean.", "exit_code": 0 } ], "criteria": { "the red leg is now green": "healed on the fast lane, commit 1ba9448db578ae52a8a74a9512df2e5b24d2f0e7" }, "summary": "renderPaperlessOIDC and renderWhakapapaOIDC defined attribute paths (`…paperless-web.after`, `…podman-grampsweb.after`, `systemd.tmpfiles.rules`) that meshBound and the store already defined in the same attrset — a Nix eval error, not the list merge the comments claimed — which failed the gateway's config_eval, failed the vars seal, and made all six placed services report \"the deploy did not hold\"; both halves now emit their definitions as an inline module in `imports`, where the lists genuinely merge.", "blockers": [] } ``` </details>
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#1557
No description provided.