deploy-surveys: the LimeSurvey console oneshots order only on limesurvey-init, which nixpkgs puts BEFORE the phpfpm ExecStartPre that writes the encryption key/nonce they read — first deploy is a race the admin bootstrap can lose (exit 4) #1333
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1333
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The failure
Drive
20260909T000457Z(artifacts/verdict.json: 20 green, 1 red,firstRedLeg: deploy-surveys) died atdeploy-surveysafter 141s:The box's own journal (
logs/guest-system-journal.log:229-249) gives the whole story in one second:All three units start in the same instant.
limesurvey-adminreaches php first and dies;surveys-brand(…[18699]) survives the same instant and logsidsstheme: idss_brand installed and set as the default survey theme— it only won because its sed/install work bought phpfpm the time. On the retried switch at00:49:43the credentials dir was already populated andlimesurvey-adminfinished (Password for user admin was set.), which is the tell: the fault is ordering, not content.The defect
internal/clan/surveys.go:673(limesurvey-admin) andinternal/clan/surveys.go:507(surveys-brand) both declared:Both units hand php
CREDENTIALS_DIRECTORY=/var/lib/limesurvey/credentials(surveys.go:706andsurveys.go:607) — the value nixpkgs gives the limesurvey phpfpm pool. Against the pinned nixpkgs (/nix/store/lr5ld8f0qbyhjx3nr9mxfvg4cndvpggp-source/nixos/modules/services/web-apps/limesurvey.nix)::55-56— the packaged config.phpfile_get_contents()esencryption_nonce+encryption_keyout of$CREDENTIALS_DIRECTORYon every console run, at require time, before any command dispatches. A missing file is a hard exit, not a degraded run.:393-398—systemd.services.phpfpm-limesurvey.serviceConfig.ExecStartPreis the one writer of those two files into${stateDir}/credentials.:437— the tmpfiles rule creates that directory empty (d ${stateDir}/credentials 0700 …). Nothing else populates it.:329—limesurvey-initis declaredbefore = [ "phpfpm-limesurvey.service" ]. So ordering onlimesurvey-initputs the oneshots and phpfpm-limesurvey in the same runnable set, not one after the other.httpd.servicegates nothing either — it carries no ordering to the pool unit and had been up since00:49:36(guest-system-journal.log:211). So on a fresh box the declared ordering was a starting gun, not a readiness gate, and the race is systematic on first deploy; which oneshot loses it is luck.Suspected layer
The clan render (
internal/clan/surveys.go) — a missing systemd ordering edge between the port's two console oneshots and the nixpkgs unit that materialises the credentials they read.The fix
One shared derivation,
surveysConsoleOneshotAfter, carryingafter = [ "limesurvey-init.service" "phpfpm-limesurvey.service" "httpd.service" ], used by both render sites so the two cannot drift. No cycle is possible: both oneshots are ordering sinks (nothing upstream orders before them), andlimesurvey-init → phpfpm-limesurvey → oneshotsis a chain, not a loop.Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime)
Two-way door, mechanical repair, not a design decision.
Why mechanical. The oneshots already meant to run after LimeSurvey was ready to be consoled — the existing
afterlist says so. They named the wrong unit for the precondition they actually have: nixpkgs writes the encryption key/nonce fromphpfpm-limesurvey's ExecStartPre, not fromlimesurvey-init. Adding the missing edge makes the code do what it already meant. Nothing a community sees changes, no default, no message at a trust moment, no route, no secrets shape, no security posture — the same secrets, the same units, the same config.php, one addedAfter=token. This is exactly rule 3's named 'missing await/readiness gate'.Revertible how. The whole product-code change is 30 lines in one file: two render sites now emit
surveysConsoleOneshotAfterinstead of an inline string, plus that constant and its comment. Reverting isgit revert 9889d49b— it restores two identicalb.WriteStringlines and deletes one unused constant. Nothing persists on a deployed box (systemd ordering is recomputed from the generated unit on every switch), no state migrates, no secret rotates, no schema moves.Proven by which test. Two, at both altitudes:
TestRenderSurveys_OneshotsWaitForTheCredentialsWriter(internal/clan/surveys_test.go) — the render seam. Requires the ordering line exactly twice (both oneshots, so a one-sided fix reds) and explicitly rejects the oldafter = [ "limesurvey-init.service" "httpd.service" ];line. Written first, watched fail, then pass.TestSurveysCohost_EvalSmoke(internal/clan/surveys_eval_test.go) — a new guard reads the generated unit file out of a real nixpkgs eval (config.systemd.units."<unit>.service".text) and requiresAfter=to carryphpfpm-limesurvey.service. This is the half astrings.Containson the render cannot see: it proves the edge survives module merging and would red if a nixpkgs bump dropped it. Both units now reportAfter=limesurvey-init.service phpfpm-limesurvey.service httpd.service.Why not a filing. Rule 1 is untouched — the entire diff removes exactly two lines, both
b.WriteStringcalls in product code; zero removed lines in any test file, no edited assertion, no deleted test or leg, no added skip. Rule 2 is untouched — 3 files, 30 changed non-test lines, one commit. Only rule 3's product-surface path applied, and this is the confident two-way case the #1270 fast lane exists for. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes.drive
20260909T000457Zred atdeploy-surveys(sig 119db33993c0) — self-fixed on the fast lane, commitae313728fa3b569c3ade8963e489722a617c4874; checks: targeted (red-first):go test ./internal/clan/ -run TestRenderSurveys_OneshotsWaitForTheCredentialsWriter→ FAIL before the fix (both render sites still emittedafter = [ "limesurvey-init.service" "httpd.service" ];), PASS after (0.004s). package:go test ./internal/clan/→ ok 18.9s. real-nixpkgs eval smoke:IDSS_EVAL_SMOKE=1 go test ./internal/clan/ -run TestSurveysCohost_EvalSmoke -v→ PASS (36.8s); gateway evaluated to a toplevel drv, and the new unit-file guard read the GENERATED units back:limesurvey-admin.service credentials-readiness gate present: After=limesurvey-init.service phpfpm-limesurvey.service httpd.serviceand the same forsurveys-brand.service— so the edge survives module merging, not just the render. The pre-existing guards in that smoke all still pass: the #1329 PATH guard (PATH generated frompathalone), the #1322config.configmerge guard (nixpkgs'uploaddir/tempdir/userquestionthemerootdirsurvive beside the port'sRPCInterface/userthemerootdir/sitename/defaulttheme), and the teeth half still fails on the phantomuploadsDiras it should. root cause verified against the pinned nixpkgs source/nix/store/lr5ld8f0qbyhjx3nr9mxfvg4cndvpggp-source/nixos/modules/services/web-apps/limesurvey.nix::55-56config.php file_get_contents the nonce+key from$CREDENTIALS_DIRECTORY;:393-398phpfpm-limesurveyExecStartPre is the sole writer into${stateDir}/credentials;:437the tmpfiles rule creates that dir empty;:329limesurvey-initisbefore = [ "phpfpm-limesurvey.service" ]. trees:go test ./internal/...→ no failures;go test ./control-plane/...→ no failures.go build ./...→ clean;gofmt -l internal/clan/→ clean;go vet ./internal/clan/→ clean. commit shape: 3 files, 30 changed non-test lines (internal/clan/surveys.go28/2;surveys_eval_test.go32/0 andsurveys_test.go27/0 are test files), one commit9889d49b, not pushed, working tree clean. rails self-check: removed lines in the ENTIRE diff are exactly two — both the identicalb.WriteString(" after = [ …limesurvey-init… httpd… ];\n")render calls in product code — so no removed assertion/expectation, no removed test or leg declaration, no added skip (t.Skip/.skip(), zero removed lines in any test file; no.sandcastle/rehearsal-*or.forgejo/workflows/path in the diff.. evidence:/home/swarm/swarm/Matou/idss/test-results/private-path/20260909T000457Zon matou-workstation.close-report for #1333 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope