deploy-document-archive: paperless.nix renders environmentFile = "", node eval-excluded #1284

Closed
opened 2026-09-07 02:09:25 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260907T015459Z (private path, target brands, commit 9567f4b21e0ccd6e2ed921b450ae0ad2a3907d29) went red at leg 11 of 11, deploy-document-archive, after 10 green legs. artifacts/verdict.json:

"legs": { "total": 11, "green": 10, "red": 1, "skip": 0 },
"firstRedLeg": "deploy-document-archive"

The drive is the seven-services-one-at-a-time brand-reach journey (tests/e2e/provision-brands.live.spec.ts:114). Service 1 (archive, Omeka) deployed green in 246 s, went healthy, wore its kit and was removed cleanly. Service 2 (document-archive, Paperless) never deployed: the clan eval preflight rejected the gateway's own generated config and excluded the node, so the deploy died in 20 s with nothing applied.

The evidence

artifacts/legs.json, leg 11 — the fault verbatim (identical text in artifacts/journey.json's fault field):

{
  "leg": "deploy-document-archive",
  "status": "red",
  "ms": 20242,
  "error": "deploy failed (clean-retry): provision: deploy gateway: clan: config_eval on gateway: the node was excluded at the eval preflight — nothing was deployed: error:\n… while evaluating the attribute 'value'\nerror: A definition for option `services.paperless.environmentFile' is not of type `null or absolute path'. Definition values:\n- In `/nix/store/9hzllfiy38ywkn96pvz6xmbz1b38zg6k-source/machines/gateway/paperless.nix': \"\""
}

The empty string is the whole red. services.paperless.environmentFile is null or absolute path in nixpkgs; "" is neither, so the module system throws during config_eval and the gateway is excluded before a single derivation is built.

The control plane logged the same thing from inside the box — logs/guest-control-plane.log:198:

Sep 07 02:01:04 gateway idss-control-plane-start[1073]: level=WARN
  msg="provision deploy failed" component=control-plane device=gateway
  error="provision: deploy gateway: clan: config_eval on gateway: the node was
  excluded at the eval preflight — nothing was deployed: error:
  … A definition for option `services.paperless.environmentFile' is not of type
  `null or absolute path'. … : \"\""

The harness saw it through the product's own fault frame, not a timeout — artifacts/provision-brands.live-.../error-context.md, thrown at waitForDeployActive line 391 off [data-field="deploy-failure"] with data-status="clean-retry". That is the deploy screen reporting a classified failure (ADR 0027) and the harness quoting it, both behaving correctly.

Corroborating that nothing infra-side broke:

  • logs/guest-failed-units.log — 0 loaded units listed. The guest is clean; no service crashed, because none was ever deployed.
  • logs/guest-control-plane.log:198 is the only error in the control plane's whole run; line 179 shows the document-archive health check wired normally at boot (url=https://document-archive.e2e-drive.idss.internal admin=admin).
  • logs/guest-journal.log (225 lines) contains no paperless / config_eval / preflight match at all — consistent with the eval preflight running host-side and the guest never being touched.
  • deploy-archive (green, 246501 ms) and remove-archive (green, 20582 ms) prove the deploy/remove path itself works on this box for a different port.

Suspected layer: product

Specifically the clan config renderer for the document-archive (Paperless) port. The renderer wrote a secret-path option as a carried Go string with no producer filling it, so the zero value rendered as "" instead of null (or the attribute being omitted). This is the #1247 empty-secret-path eval-exclusion class, reappearing in the one port that ruling left unconverted.

Not harness: the harness read the product's own fault frame verbatim and failed in 20 s rather than burning the deploy budget. Not infra: host.json shows 62 G free, KVM guest active (logs/guest-unit.log: idss-guest.service … active (running) since 01:56:04), zero failed units, and the preflight refused before any machine work started.

This is not the KNOWN frontier. The named frontier is the own-VPS carrier / pairing-never-flips skip. legs.json records skip: 0 and carries no skip reasons at all; no pairing leg appears in the 11. This red is a distinct, new defect.

What was absent / not asked

  • No live-box section was appended to this diagnosis, so I had no access line and asked the box nothing — everything above is from the harvested records. Worth noting the box was still up at harvest: logs/guest-unit.log shows idss-guest.service active. Note also this drive is VM-mode (ADR 0056, qemu), not a droplet — logs/droplet-journal.txt does not exist; the journal harvested is logs/guest-journal.log.
  • The offending paperless.nix is not in the run directory. state/clan-config/machines/gateway/ holds only configuration.nix, front-door.nix, gateway-guest.nix, gateway-render.json, ledger.nix (all mtime 01:47, the restored snapshot) — the clean-retry rolled the render back, so only the nix store path 9hzllfiy38ywkn96pvz6xmbz1b38zg6k-source names it. A harvest that copied the rendered machine dir before rollback would have handed the exact emitted lines over.
  • logs/state-logs.log records ENOENT … state/logs, and logs/clan-config-snapshot.log has an empty bundle: line — both pre-existing harvest gaps, unrelated to this red.

What plugging it needs

The visible one-line shape — render null/omit when the carried secret path is empty instead of "" — is not sufficient on its own, and this is why the run's own healer refused rather than patched (logs/healer-claude.out, its refusal rule 3):

"A conversion of environmentFile alone re-reds identically on the very next line: nixpkgs declares passwordFile with the same type … so passwordFile = \"\" is rejected the same way as soon as environmentFile stops being the first failure."

(That healer record also cites internal/clan/portroute.go:52, internal/clan/paperless.go:257-258 and internal/clan/portsecrets_test.go:22-27 as the render/attach sites and the vacuous test pin. I could not verify those citations — this diagnosis was sandboxed to the run directory — so treat the line numbers as its claim, not mine. The run-directory evidence above stands on its own.)

So plugging it needs, in order:

  1. A ruling on who mints the document archive's admin superuser credential — whether document-archive converts to the #1247 port-owned-generator shape (one generator minting the Paperless secret key and admin password, with the generator's rendered path landed into the control plane's IDSS_PAPERLESS_ADMIN_PASSWORD_FILE so both ends of the handshake read one secret), or keeps its own pattern with some other producer. Both environmentFile and passwordFile fall out of that answer; so does what identity PAPERLESS_ADMIN_USER carries. This is a trust-moment decision, not a mechanical repair — dropping the options instead would deploy a document archive with no admin superuser, a security-posture change.
  2. Widen the test pin regardless of the ruling — the guard's option list carries the plural environmentFiles (the oci-container form) but not the singular environmentFile or passwordFile that the nixpkgs Paperless module uses, so it passed vacuously over a render emitting two empty paths. Adding both names makes this class fail in unit tests instead of at leg 11 of a rehearsal drive.
  3. Optional harness improvement: harvest the rendered machines/<node>/ tree at the moment of an eval-preflight failure, before the clean-retry rollback, so the next drive of this class ships the emitted nix text rather than a store hash.

drive 20260907T015459Z red at deploy-document-archive: deploy failed (clean-retry): provision: deploy gateway: clan: config_eval on gateway: the node was excluded at the eval preflight — nothing was deployed: error: … while evaluating the attribute 'v
evidence: /home/swarm/swarm/Matou/idss/test-results/private-path/20260907T015459Z 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 `20260907T015459Z` (private path, target `brands`, commit `9567f4b21e0ccd6e2ed921b450ae0ad2a3907d29`) went red at leg 11 of 11, **`deploy-document-archive`**, after 10 green legs. `artifacts/verdict.json`: ```json "legs": { "total": 11, "green": 10, "red": 1, "skip": 0 }, "firstRedLeg": "deploy-document-archive" ``` The drive is the seven-services-one-at-a-time brand-reach journey (`tests/e2e/provision-brands.live.spec.ts:114`). Service 1 (`archive`, Omeka) deployed green in 246 s, went healthy, wore its kit and was removed cleanly. Service 2 (`document-archive`, Paperless) never deployed: the clan eval preflight rejected the gateway's own generated config and excluded the node, so the deploy died in 20 s with nothing applied. ## The evidence `artifacts/legs.json`, leg 11 — the fault verbatim (identical text in `artifacts/journey.json`'s `fault` field): ``` { "leg": "deploy-document-archive", "status": "red", "ms": 20242, "error": "deploy failed (clean-retry): provision: deploy gateway: clan: config_eval on gateway: the node was excluded at the eval preflight — nothing was deployed: error:\n… while evaluating the attribute 'value'\nerror: A definition for option `services.paperless.environmentFile' is not of type `null or absolute path'. Definition values:\n- In `/nix/store/9hzllfiy38ywkn96pvz6xmbz1b38zg6k-source/machines/gateway/paperless.nix': \"\"" } ``` The **empty string** is the whole red. `services.paperless.environmentFile` is `null or absolute path` in nixpkgs; `""` is neither, so the module system throws during `config_eval` and the gateway is excluded before a single derivation is built. The control plane logged the same thing from inside the box — `logs/guest-control-plane.log:198`: ``` Sep 07 02:01:04 gateway idss-control-plane-start[1073]: level=WARN msg="provision deploy failed" component=control-plane device=gateway error="provision: deploy gateway: clan: config_eval on gateway: the node was excluded at the eval preflight — nothing was deployed: error: … A definition for option `services.paperless.environmentFile' is not of type `null or absolute path'. … : \"\"" ``` The harness saw it through the product's own fault frame, not a timeout — `artifacts/provision-brands.live-.../error-context.md`, thrown at `waitForDeployActive` line 391 off `[data-field="deploy-failure"]` with `data-status="clean-retry"`. That is the deploy screen reporting a classified failure (ADR 0027) and the harness quoting it, both behaving correctly. Corroborating that nothing infra-side broke: - `logs/guest-failed-units.log` — `0 loaded units listed.` The guest is clean; no service crashed, because none was ever deployed. - `logs/guest-control-plane.log:198` is the **only** error in the control plane's whole run; line 179 shows the document-archive health check wired normally at boot (`url=https://document-archive.e2e-drive.idss.internal admin=admin`). - `logs/guest-journal.log` (225 lines) contains no `paperless` / `config_eval` / `preflight` match at all — consistent with the eval preflight running host-side and the guest never being touched. - `deploy-archive` (green, 246501 ms) and `remove-archive` (green, 20582 ms) prove the deploy/remove path itself works on this box for a different port. ## Suspected layer: **product** Specifically the clan config renderer for the document-archive (Paperless) port. The renderer wrote a secret-path option as a carried Go string with no producer filling it, so the zero value rendered as `""` instead of `null` (or the attribute being omitted). This is the `#1247` empty-secret-path eval-exclusion class, reappearing in the one port that ruling left unconverted. Not harness: the harness read the product's own fault frame verbatim and failed in 20 s rather than burning the deploy budget. Not infra: `host.json` shows 62 G free, KVM guest active (`logs/guest-unit.log`: `idss-guest.service … active (running) since 01:56:04`), zero failed units, and the preflight refused before any machine work started. **This is not the KNOWN frontier.** The named frontier is the own-VPS carrier / pairing-never-flips skip. `legs.json` records `skip: 0` and carries **no skip reasons at all**; no pairing leg appears in the 11. This red is a distinct, new defect. ## What was absent / not asked - **No live-box section was appended to this diagnosis**, so I had no access line and asked the box nothing — everything above is from the harvested records. Worth noting the box was still up at harvest: `logs/guest-unit.log` shows `idss-guest.service` active. Note also this drive is **VM-mode (ADR 0056, qemu)**, not a droplet — `logs/droplet-journal.txt` does not exist; the journal harvested is `logs/guest-journal.log`. - **The offending `paperless.nix` is not in the run directory.** `state/clan-config/machines/gateway/` holds only `configuration.nix`, `front-door.nix`, `gateway-guest.nix`, `gateway-render.json`, `ledger.nix` (all mtime 01:47, the restored snapshot) — the clean-retry rolled the render back, so only the nix store path `9hzllfiy38ywkn96pvz6xmbz1b38zg6k-source` names it. A harvest that copied the rendered machine dir *before* rollback would have handed the exact emitted lines over. - `logs/state-logs.log` records `ENOENT … state/logs`, and `logs/clan-config-snapshot.log` has an empty `bundle:` line — both pre-existing harvest gaps, unrelated to this red. ## What plugging it needs The visible one-line shape — render `null`/omit when the carried secret path is empty instead of `""` — is **not sufficient on its own**, and this is why the run's own healer refused rather than patched (`logs/healer-claude.out`, its refusal rule 3): > "A conversion of `environmentFile` alone re-reds identically on the very next line: nixpkgs declares `passwordFile` with the same type … so `passwordFile = \"\"` is rejected the same way as soon as `environmentFile` stops being the first failure." (That healer record also cites `internal/clan/portroute.go:52`, `internal/clan/paperless.go:257-258` and `internal/clan/portsecrets_test.go:22-27` as the render/attach sites and the vacuous test pin. I could not verify those citations — this diagnosis was sandboxed to the run directory — so treat the line numbers as its claim, not mine. The run-directory evidence above stands on its own.) So plugging it needs, in order: 1. **A ruling** on who mints the document archive's admin superuser credential — whether document-archive converts to the `#1247` port-owned-generator shape (one generator minting the Paperless secret key and admin password, with the generator's rendered path landed into the control plane's `IDSS_PAPERLESS_ADMIN_PASSWORD_FILE` so both ends of the handshake read one secret), or keeps its own pattern with some other producer. Both `environmentFile` and `passwordFile` fall out of that answer; so does what identity `PAPERLESS_ADMIN_USER` carries. This is a trust-moment decision, not a mechanical repair — dropping the options instead would deploy a document archive with no admin superuser, a security-posture change. 2. **Widen the test pin regardless of the ruling** — the guard's option list carries the plural `environmentFiles` (the oci-container form) but not the singular `environmentFile` or `passwordFile` that the nixpkgs Paperless module uses, so it passed vacuously over a render emitting two empty paths. Adding both names makes this class fail in unit tests instead of at leg 11 of a rehearsal drive. 3. **Optional harness improvement:** harvest the rendered `machines/<node>/` tree at the moment of an eval-preflight failure, before the clean-retry rollback, so the next drive of this class ships the emitted nix text rather than a store hash. drive `20260907T015459Z` red at `deploy-document-archive`: `deploy failed (clean-retry): provision: deploy gateway: clan: config_eval on gateway: the node was excluded at the eval preflight — nothing was deployed: error: … while evaluating the attribute 'v` evidence: `/home/swarm/swarm/Matou/idss/test-results/private-path/20260907T015459Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 8bcb93da00e3 -->
Owner

RULED + FIXED (ruled by agent under ADR 0174 — veto anytime)

Commit 42c9e644 on main.

The ruling: apply the standing #1247 shape — Ben's ruling, five ports already converted — to the two ports its scope note deferred. The deferral was because their secrets are health-check-coupled admin passwords; the missing piece was the handshake, and that shape exists too: #863 (Nextcloud) — the port's generator mints the credential, the control plane falls back to the boot-known materialised path and reads the secret per call. Composing two standing rulings introduces no new trust posture (the archive generator already mints admin passwords locally under sops-age), so this is a two-way door, provable by render tests + the already-armed #1277 loop.

What landed:

  • document-archive-secrets generator (adminpass raw + Django secret-key env) and surveys-secrets (adminpass + dbpass); every consumer reads the generator's rendered .path as a Nix EXPRESSION — passwordFile, environmentFile, database.passwordFile, and LimeSurvey's LoadCredential antiquotes it. The carried AdminPassFile/SecretEnvFile/DBPassFile fields are DELETED — no producer ever existed for them.
  • Surveys fixed pre-emptively: deploy-surveys (two cycles out on this drive) would have red identically at the eval preflight, plus a LoadCredential = [ "admin-pass:" ] that could never load.
  • PAPERLESS_ADMIN_USER/LimeSurvey admin default to admin on BOTH ends (render + health check) — one identity, one minted secret at /run/secrets/vars/<gen>/adminpass, read per call (lazyAdminSecret grew the boot-known default-file fallback; the other ports' behaviour is unchanged).
  • Item 2 done: the #1247 pin now carries the singular environmentFile + passwordFile names it missed — the exact vacuity that let two empty paths red a rehearsal drive at leg 11 instead of a unit test. Scope note rewritten; both ports' SecretsRideClanVars render tests re-ruled to the generator contract.
  • Item 3 (harvest the rendered machines/<node>/ tree before the clean-retry rollback) is a good harness improvement — deferred, not lost: noted here for the next actor rather than bundled into a product commit.

Credit: the healer's rule-3 refusal was exactly right — passwordFile = "" reds identically one line after any environmentFile-only conversion.

Proof: go build/vet/gofmt green; internal/clan + control-plane suites green (uncached). The exact wire (module bootstraps the superuser from the minted file; consume-and-find check authenticates) is confirmed by the armed drive — a red comes back loud with the journal. Closing — #1277 re-fires, adopting the snapshot (the heals since capture are product-dir commits, so the key honestly drifts and the next founded fire re-captures).

## RULED + FIXED (ruled by agent under ADR 0174 — veto anytime) Commit `42c9e644` on `main`. **The ruling:** apply the **standing #1247 shape** — Ben's ruling, five ports already converted — to the two ports its scope note deferred. The deferral was because their secrets are health-check-coupled admin passwords; the missing piece was the handshake, and that shape exists too: **#863** (Nextcloud) — the port's generator mints the credential, the control plane falls back to the boot-known materialised path and reads the secret **per call**. Composing two standing rulings introduces no new trust posture (the archive generator already mints admin passwords locally under sops-age), so this is a two-way door, provable by render tests + the already-armed #1277 loop. **What landed:** - `document-archive-secrets` generator (adminpass raw + Django secret-key env) and `surveys-secrets` (adminpass + dbpass); every consumer reads the generator's rendered `.path` as a Nix EXPRESSION — `passwordFile`, `environmentFile`, `database.passwordFile`, and LimeSurvey's `LoadCredential` antiquotes it. The carried `AdminPassFile`/`SecretEnvFile`/`DBPassFile` fields are DELETED — no producer ever existed for them. - **Surveys fixed pre-emptively**: `deploy-surveys` (two cycles out on this drive) would have red identically at the eval preflight, plus a `LoadCredential = [ "admin-pass:" ]` that could never load. - `PAPERLESS_ADMIN_USER`/LimeSurvey admin default to `admin` on BOTH ends (render + health check) — one identity, one minted secret at `/run/secrets/vars/<gen>/adminpass`, read per call (`lazyAdminSecret` grew the boot-known default-file fallback; the other ports' behaviour is unchanged). - **Item 2 done:** the #1247 pin now carries the singular `environmentFile` + `passwordFile` names it missed — the exact vacuity that let two empty paths red a rehearsal drive at leg 11 instead of a unit test. Scope note rewritten; both ports' `SecretsRideClanVars` render tests re-ruled to the generator contract. - **Item 3 (harvest the rendered `machines/<node>/` tree before the clean-retry rollback)** is a good harness improvement — deferred, not lost: noted here for the next actor rather than bundled into a product commit. **Credit:** the healer's rule-3 refusal was exactly right — `passwordFile = ""` reds identically one line after any `environmentFile`-only conversion. Proof: `go build`/`vet`/`gofmt` green; `internal/clan` + `control-plane` suites green (uncached). The exact wire (module bootstraps the superuser from the minted file; consume-and-find check authenticates) is confirmed by the armed drive — a red comes back loud with the journal. Closing — #1277 re-fires, adopting the snapshot (the heals since capture are product-dir commits, so the key honestly drifts and the next founded fire re-captures).
ben closed this issue 2026-09-07 02:25:26 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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#1284
No description provided.