surveys-healthy (found while verifying): the render's config.config definition outranks nixpkgs' mkDefault and WIPES nixpkgs' entire LimeSurvey config subtree — uploaddir, tempdir, force_ssl all fall back to the read-only Nix store #1322

Closed
opened 2026-09-08 13:03:15 +00:00 by matou-build-agent · 3 comments

Not the red — a distinct, pre-existing, currently-shipping defect found by decoding the built artifact

While verifying the RPCInterface fix against real nixpkgs I decoded the evaluated gateway's config.php derivation and found nixpkgs' entire services.limesurvey.config.config default subtree missing. This is not caused by my fix and not fixed by it — I measured it at HEAD (a948f6ed) with my change stashed.

Measured evidence

eval toplevel drv decoded config.config
HEAD a948f6ed, my change stashed 7q7r4dmycb3j1qijffaxbc53pk0xkd3n-nixos-system-gateway-… {}
with my commit 3aa60340 ik6mywa8pbhqxi5kz1annh5sjlk3n5sr-nixos-system-gateway-… {"RPCInterface":"json"}

In both cases nixpkgs' tempdir, uploaddir, userquestionthemerootdir, force_ssl and config.defaultlang are absent from the deployed config.php. Reproduce: IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run TestSurveysCohost_EvalSmoke -v, then nix derivation show the config.php.drv in the toplevel closure and read the JSON out of its text env var.

Cause — a NixOS merge-priority inversion

nixpkgs sets its LimeSurvey defaults as services.limesurvey.config = mapAttrs (name: mkDefault) { runtimePath = …; components = {…}; config = {…}; } (nixos/modules/services/web-apps/limesurvey.nix:359). So the config attribute's whole value carries mkDefault — priority 1000.

The render defines config.config = lib.mkMerge [ … ] (internal/clan/surveys.go:310) at normal priority 100. In the attrsOf configType merge, filterOverrides keeps only the highest-priority definitions per attribute — so for the config attribute the render's definition wins outright and nixpkgs' entire subtree is discarded rather than merged.

Critically this fires even with no brand kit applied: both brand entries are lib.optionalAttrs guards that collapse to {}, but mkMerge [{} {}] is still a definition at priority 100, so it still wipes. That is exactly the {} measured at HEAD. Introduced by #1318 (d2830225), which correctly moved the brand keys under config.config but did not match nixpkgs' priority.

Impact

With the subtree gone, LimeSurvey falls back to application/config/config-defaults.php, where $config['rootdir'] = getcwd() (line 43) and:

  • uploaddir = rootdir/upload (line 738) and tempdir = rootdir/tmp (line 736) — under php-fpm these resolve inside the read-only Nix store instead of /var/lib/limesurvey/{upload,tmp}.
  • The declared Surveys dataset (ADR 0080) is not where the port claims it is. DefaultSurveysStorePath's own doc comment (internal/clan/surveys.go:55-63) asserts "nixpkgs derives uploaddir = ${stateDir}/upload beneath it" — the wipe makes that statement false, so backup coverage reads a path LimeSurvey is not using.
  • The brand feature is broken once a kit is applied. userthemerootdir = uploaddir/themes/survey (config-defaults.php:746) is exactly where the surveys-brand oneshot lands idss_brand — so defaulttheme = "idss_brand" points at a theme LimeSurvey looks for under the store path and cannot find (#1265 / DDR 0225).
  • force_ssl falls back to 'off' (line 539) although nixpkgs sets it 'on' for an SSL vhost.

This did not red this drive: the surveys-brand oneshot writes a hardcoded path (so deploy-surveys stayed green), and the health gate never got past get_session_key to exercise uploads. It is latent, not benign.

Proposed fix (mechanical)

Define the render's config.config at the same priority as nixpkgs' so attrsOf unions them per key rather than replacing — i.e. wrap the render's attrs in lib.mkDefault (priority 1000, matching limesurvey.nix:359) instead of leaving them at 100. Then pin it with an eval-smoke assertion that decodes the built config.php and requires nixpkgs' uploaddir and tempdir to survive alongside the port's own keys — a strings.Contains seam test cannot see this fault at all, since the render's emitted text is identical either way. That is the #191 lesson applied to merge priority rather than option existence.

I did not fold this into the heal: it is a second, independent decision touching the ADR 0080 dataset home, and it deserves its own commit and its own eval assertion rather than riding a health-gate fix.

drive 20260908T112826Z red at surveys-healthy: surveys service is not healthy after 360s of warm-up re-probe (#556): Surveys is not serving — LimeSurvey could not capture and keep a response through its public form — this service is not doing
evidence: /home/swarm/swarm/Matou/idss/test-results/private-path/20260908T112826Z on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured

## Not the red — a distinct, pre-existing, currently-shipping defect found by decoding the built artifact While verifying the `RPCInterface` fix against real nixpkgs I decoded the evaluated gateway's `config.php` derivation and found nixpkgs' entire `services.limesurvey.config.config` default subtree missing. This is **not** caused by my fix and **not** fixed by it — I measured it at `HEAD` (`a948f6ed`) with my change stashed. ## Measured evidence | eval | toplevel drv | decoded `config.config` | |---|---|---| | HEAD `a948f6ed`, my change stashed | `7q7r4dmycb3j1qijffaxbc53pk0xkd3n-nixos-system-gateway-…` | `{}` | | with my commit `3aa60340` | `ik6mywa8pbhqxi5kz1annh5sjlk3n5sr-nixos-system-gateway-…` | `{"RPCInterface":"json"}` | In **both** cases nixpkgs' `tempdir`, `uploaddir`, `userquestionthemerootdir`, `force_ssl` and `config.defaultlang` are **absent** from the deployed `config.php`. Reproduce: `IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run TestSurveysCohost_EvalSmoke -v`, then `nix derivation show` the `config.php.drv` in the toplevel closure and read the JSON out of its `text` env var. ## Cause — a NixOS merge-priority inversion nixpkgs sets its LimeSurvey defaults as `services.limesurvey.config = mapAttrs (name: mkDefault) { runtimePath = …; components = {…}; config = {…}; }` (`nixos/modules/services/web-apps/limesurvey.nix:359`). So the **`config` attribute's whole value** carries `mkDefault` — priority 1000. The render defines `config.config = lib.mkMerge [ … ]` (`internal/clan/surveys.go:310`) at normal priority 100. In the `attrsOf configType` merge, `filterOverrides` keeps only the highest-priority definitions **per attribute** — so for the `config` attribute the render's definition wins outright and nixpkgs' entire subtree is discarded rather than merged. Critically this fires **even with no brand kit applied**: both brand entries are `lib.optionalAttrs` guards that collapse to `{}`, but `mkMerge [{} {}]` is still a definition at priority 100, so it still wipes. That is exactly the `{}` measured at HEAD. Introduced by #1318 (`d2830225`), which correctly moved the brand keys under `config.config` but did not match nixpkgs' priority. ## Impact With the subtree gone, LimeSurvey falls back to `application/config/config-defaults.php`, where `$config['rootdir'] = getcwd()` (line 43) and: - `uploaddir = rootdir/upload` (line 738) and `tempdir = rootdir/tmp` (line 736) — under php-fpm these resolve **inside the read-only Nix store** instead of `/var/lib/limesurvey/{upload,tmp}`. - **The declared Surveys dataset (ADR 0080) is not where the port claims it is.** `DefaultSurveysStorePath`'s own doc comment (`internal/clan/surveys.go:55-63`) asserts "nixpkgs derives uploaddir = `${stateDir}/upload` beneath it" — the wipe makes that statement false, so backup coverage reads a path LimeSurvey is not using. - **The brand feature is broken once a kit is applied.** `userthemerootdir = uploaddir/themes/survey` (config-defaults.php:746) is exactly where the `surveys-brand` oneshot lands `idss_brand` — so `defaulttheme = "idss_brand"` points at a theme LimeSurvey looks for under the store path and cannot find (#1265 / DDR 0225). - `force_ssl` falls back to `'off'` (line 539) although nixpkgs sets it `'on'` for an SSL vhost. This did not red this drive: the `surveys-brand` oneshot writes a hardcoded path (so `deploy-surveys` stayed green), and the health gate never got past `get_session_key` to exercise uploads. It is latent, not benign. ## Proposed fix (mechanical) Define the render's `config.config` at the **same priority** as nixpkgs' so `attrsOf` unions them per key rather than replacing — i.e. wrap the render's attrs in `lib.mkDefault` (priority 1000, matching `limesurvey.nix:359`) instead of leaving them at 100. Then pin it with an eval-smoke assertion that decodes the built `config.php` and requires nixpkgs' `uploaddir` and `tempdir` to survive **alongside** the port's own keys — a `strings.Contains` seam test cannot see this fault at all, since the render's emitted text is identical either way. That is the #191 lesson applied to merge *priority* rather than option *existence*. I did not fold this into the heal: it is a second, independent decision touching the ADR 0080 dataset home, and it deserves its own commit and its own eval assertion rather than riding a health-gate fix. drive `20260908T112826Z` red at `surveys-healthy`: `surveys service is not healthy after 360s of warm-up re-probe (#556): Surveys is not serving — LimeSurvey could not capture and keep a response through its public form — this service is not doing ` evidence: `/home/swarm/swarm/Matou/idss/test-results/private-path/20260908T112826Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 9ea63fb93ac3 -->
Author
Member

swarm-claim host=matou-dev-server-01 run=20040
(automated multi-host claim — lowest live claim id works this ticket)

swarm-claim host=matou-dev-server-01 run=20040 (automated multi-host claim — lowest live claim id works this ticket)
Author
Member

close-report for #1322 — status success

⛔ close-report gates REFUSED this close — the following claims did not verify:

  • commit 1a69df25f is not a valid commit object (fabricated, or never pushed)
  • changed_files: 'internal/clan/surveys.go' is not in the diff of the claimed commits
  • changed_files: 'internal/clan/surveys_eval_test.go' is not in the diff of the claimed commits
  • changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits
  • changed_files: 'STATUS.md' is not in the diff of the claimed commits
envelope
{
  "issue": 1322,
  "status": "success",
  "commits": [
    "1a69df25f"
  ],
  "changed_files": [
    "internal/clan/surveys.go",
    "internal/clan/surveys_eval_test.go",
    "docs/GOTCHAS.md",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/ -run TestRenderSurveys -count=1",
      "exit_code": 0
    },
    {
      "command": "IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run TestSurveysCohost_EvalSmoke -count=1 -v",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/clan/ -count=1",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/clan/surveys.go internal/clan/surveys_eval_test.go",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The render's config.config matches nixpkgs' mkDefault priority so attrsOf unions per key rather than wiping nixpkgs' subtree": "internal/clan/surveys.go — each config.config mkMerge element wrapped in lib.mkDefault (not mkDefault(mkMerge …), which leaks the raw merge attrset)",
    "An eval-smoke assertion decodes the built config.php/services.limesurvey.config and requires nixpkgs' uploaddir and tempdir to survive alongside the port's own keys": "internal/clan/surveys_eval_test.go — decodes services.limesurvey.config JSON, asserts uploaddir/tempdir/userquestionthemerootdir present AND RPCInterface==json; passed GREEN against real 26.11pre nixpkgs (uploaddir=/var/lib/limesurvey/upload, tempdir=/var/lib/limesurvey/tmp)",
    "The fix is its own commit and its own eval assertion, not folded into the heal": "commit 1a69df25 is a single standalone commit for #1322 with the new eval assertion"
  },
  "summary": "Wrapped each surveys config.config mkMerge element in lib.mkDefault so it matches nixpkgs' priority and attrsOf unions per key instead of wiping nixpkgs' whole LimeSurvey config subtree, pinned by a new eval-smoke decode assertion (GOTCHAS #195).",
  "reason": "",
  "blockers": []
}
**close-report** for #1322 — status `success` :no_entry: **close-report gates REFUSED this close** — the following claims did not verify: - commit 1a69df25f is not a valid commit object (fabricated, or never pushed) - changed_files: 'internal/clan/surveys.go' is not in the diff of the claimed commits - changed_files: 'internal/clan/surveys_eval_test.go' is not in the diff of the claimed commits - changed_files: 'docs/GOTCHAS.md' is not in the diff of the claimed commits - changed_files: 'STATUS.md' is not in the diff of the claimed commits <details><summary>envelope</summary> ```json { "issue": 1322, "status": "success", "commits": [ "1a69df25f" ], "changed_files": [ "internal/clan/surveys.go", "internal/clan/surveys_eval_test.go", "docs/GOTCHAS.md", "STATUS.md" ], "tests": [ { "command": "go test ./internal/clan/ -run TestRenderSurveys -count=1", "exit_code": 0 }, { "command": "IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run TestSurveysCohost_EvalSmoke -count=1 -v", "exit_code": 0 }, { "command": "go test ./internal/clan/ -count=1", "exit_code": 0 }, { "command": "gofmt -l internal/clan/surveys.go internal/clan/surveys_eval_test.go", "exit_code": 0 } ], "criteria": { "The render's config.config matches nixpkgs' mkDefault priority so attrsOf unions per key rather than wiping nixpkgs' subtree": "internal/clan/surveys.go — each config.config mkMerge element wrapped in lib.mkDefault (not mkDefault(mkMerge …), which leaks the raw merge attrset)", "An eval-smoke assertion decodes the built config.php/services.limesurvey.config and requires nixpkgs' uploaddir and tempdir to survive alongside the port's own keys": "internal/clan/surveys_eval_test.go — decodes services.limesurvey.config JSON, asserts uploaddir/tempdir/userquestionthemerootdir present AND RPCInterface==json; passed GREEN against real 26.11pre nixpkgs (uploaddir=/var/lib/limesurvey/upload, tempdir=/var/lib/limesurvey/tmp)", "The fix is its own commit and its own eval assertion, not folded into the heal": "commit 1a69df25 is a single standalone commit for #1322 with the new eval assertion" }, "summary": "Wrapped each surveys config.config mkMerge element in lib.mkDefault so it matches nixpkgs' priority and attrsOf unions per key instead of wiping nixpkgs' whole LimeSurvey config subtree, pinned by a new eval-smoke decode assertion (GOTCHAS #195).", "reason": "", "blockers": [] } ``` </details>
Author
Member

close-report for #1322 — status success

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

envelope
{
  "issue": 1322,
  "status": "success",
  "commits": [
    "1a69df2502892a610011dd319e2fa0f3038ecd39"
  ],
  "changed_files": [
    "internal/clan/surveys.go",
    "internal/clan/surveys_eval_test.go",
    "docs/GOTCHAS.md",
    "STATUS.md"
  ],
  "tests": [
    {
      "command": "go test ./internal/clan/ -run TestRenderSurveys -count=1",
      "exit_code": 0
    },
    {
      "command": "IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run TestSurveysCohost_EvalSmoke -count=1 -v",
      "exit_code": 0
    },
    {
      "command": "go test ./internal/clan/ -count=1",
      "exit_code": 0
    },
    {
      "command": "gofmt -l internal/clan/surveys.go internal/clan/surveys_eval_test.go",
      "exit_code": 0
    }
  ],
  "criteria": {
    "The render's config.config matches nixpkgs' mkDefault priority so attrsOf unions per key rather than wiping nixpkgs' subtree": "internal/clan/surveys.go — each config.config mkMerge element wrapped in lib.mkDefault (not mkDefault(mkMerge …), which leaks the raw merge attrset)",
    "An eval-smoke assertion decodes the built config.php/services.limesurvey.config and requires nixpkgs' uploaddir and tempdir to survive alongside the port's own keys": "internal/clan/surveys_eval_test.go — decodes services.limesurvey.config JSON, asserts uploaddir/tempdir/userquestionthemerootdir present AND RPCInterface==json; passed GREEN against real 26.11pre nixpkgs (uploaddir=/var/lib/limesurvey/upload, tempdir=/var/lib/limesurvey/tmp)",
    "The fix is its own commit and its own eval assertion, not folded into the heal": "commit 1a69df25 is a single standalone commit for #1322 with the new eval assertion"
  },
  "summary": "Wrapped each surveys config.config mkMerge element in lib.mkDefault so it matches nixpkgs' priority and attrsOf unions per key instead of wiping nixpkgs' whole LimeSurvey config subtree, pinned by a new eval-smoke decode assertion (GOTCHAS #195).",
  "reason": "",
  "blockers": []
}
**close-report** for #1322 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1322, "status": "success", "commits": [ "1a69df2502892a610011dd319e2fa0f3038ecd39" ], "changed_files": [ "internal/clan/surveys.go", "internal/clan/surveys_eval_test.go", "docs/GOTCHAS.md", "STATUS.md" ], "tests": [ { "command": "go test ./internal/clan/ -run TestRenderSurveys -count=1", "exit_code": 0 }, { "command": "IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run TestSurveysCohost_EvalSmoke -count=1 -v", "exit_code": 0 }, { "command": "go test ./internal/clan/ -count=1", "exit_code": 0 }, { "command": "gofmt -l internal/clan/surveys.go internal/clan/surveys_eval_test.go", "exit_code": 0 } ], "criteria": { "The render's config.config matches nixpkgs' mkDefault priority so attrsOf unions per key rather than wiping nixpkgs' subtree": "internal/clan/surveys.go — each config.config mkMerge element wrapped in lib.mkDefault (not mkDefault(mkMerge …), which leaks the raw merge attrset)", "An eval-smoke assertion decodes the built config.php/services.limesurvey.config and requires nixpkgs' uploaddir and tempdir to survive alongside the port's own keys": "internal/clan/surveys_eval_test.go — decodes services.limesurvey.config JSON, asserts uploaddir/tempdir/userquestionthemerootdir present AND RPCInterface==json; passed GREEN against real 26.11pre nixpkgs (uploaddir=/var/lib/limesurvey/upload, tempdir=/var/lib/limesurvey/tmp)", "The fix is its own commit and its own eval assertion, not folded into the heal": "commit 1a69df25 is a single standalone commit for #1322 with the new eval assertion" }, "summary": "Wrapped each surveys config.config mkMerge element in lib.mkDefault so it matches nixpkgs' priority and attrsOf unions per key instead of wiping nixpkgs' whole LimeSurvey config subtree, pinned by a new eval-smoke decode assertion (GOTCHAS #195).", "reason": "", "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.

Reference
Matou/idss#1322
No description provided.