newsletters-wears-kit: both settings reconcilers gate on Listmonk's FORK, not its listener — the kit apply exit 0s into a refused connection and reports green #1357

Closed
opened 2026-09-09 14:48:56 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260909T134009Z (artifacts/verdict.json: 33 legs, 32 green, firstRedLeg: newsletters-wears-kit) red at the last leg:

the live Newsletters (https://newsletters.e2e-drive.idss.internal:41941) is missing kit marks [name; accent] — its surface's ruled token set (DDR 0225) promises them on the card ("Carries your name, logo & colours"); title "listmonk - Mailing list", 1 stylesheets read

The title is listmonk's stock public-page title, so app.site_name was never set. Nothing was applied at all.

The evidence

logs/guest-system-journal.log:310-320 is the whole defect, in six lines:

14:36:06 systemd[1]: Started Listmonk - newsletter and mailing list manager.
14:36:06 systemd[1]: Starting Apply the community brand kit to the running Listmonk (newsletters port, DDR 0225)...
14:36:06 systemd[1]: Starting Point Listmonk's SMTP send path at the community's own mail service ...
14:36:06 systemd[1]: Finished Point Listmonk's SMTP send path ...
14:36:06 systemd[1]: Finished Apply the community brand kit to the running Listmonk ...
14:36:06.210288 listmonk[24860]: init.go:657: initialized email (SMTP) messenger: username@smtp.yoursite.com
14:36:06          listmonk[24860]: ⇨ http server started on [::]:9010

Both reconcilers ran to completion and reported GREEN before the daemon bound its serve port. The daemon then read listmonk's stock username@smtp.yoursite.com relay off the untouched settings row — independent proof that newsletters-smtp's PUT no-opped too, not just the brand one.

logs/guest-failed-units.log lists zero failed units: the fault was invisible to every guest-side check.

The layer

internal/clan/newsletters.go — the two settings-PUT reconcilers it renders.

  • renderListmonkSMTP (old newsletters.go:376) and renderNewslettersBrand (old newsletters.go:480) each opened with current=$(curl -sf … "$addr/api/settings") || exit 0. On a refused connection that is an exit-zero, so systemd records a successful oneshot that applied nothing.
  • Both units carry only after = [ "listmonk.service" ]. The nixpkgs module runs Listmonk Type=simple, so systemd calls the unit started the instant the process forks — ~200 ms before it listens. This is exactly the standing rule in docs/GOTCHAS.md:31-43 (#2, "the port lies"): "systemd after= is ordering, not readiness — a oneshot that needs a peer answering carries its own bounded retry." The sibling brand oneshots already obey it — internal/clan/video.go:394-414 and internal/clan/whakapapa.go:564-575 both poll for i in $(seq 1 30) and exit 1 loud. Newsletters was the one port that never did.
  • Second, latent fault in the same place: once both reconcilers do wait, they release together and each does a whole-object GET /api/settings → jq-merge → PUT of the one settings object. Concurrently, whichever read first has its keys silently dropped by the other's PUT — and app.root_url is the SMTP reconciler's key (newsletters.go:383), the base every public stylesheet link (and so the accent the check reads) resolves against.

The fix

One shared newslettersSettingsReadyGate (internal/clan/newsletters.go:393-430) both reconcilers now open with (:377, :505): poll the capability actually needed — the settings API answering — over a 60 s budget, keep the answered object in $current for the jq merge, and exit 1 loud when the budget elapses. The SMTP unit grows the coreutils path the retry's seq/sleep come off (:359). The brand oneshot orders after the SMTP one (:477, after alone, never requires — a failed send-path reconcile must not withhold the brand).

One thing worth a later look (not fixed here, does not block)

The leg reported [name; accent] missing but not logo, against a Listmonk where demonstrably nothing was applied — so pickLogoRef (app/tests/e2e/fixtures/brandreach.ts:535) accepted one of listmonk's own stock assets. That is the same class the Grist heal addressed by preferring a kit-bearing document; here no document carried the accent, so the natural-order fallback took an upstream asset. After this fix the accent lands, the kit-bearing document wins, and the fallback is not reached — so it is not a blocker, but the logo half of the newsletters contract is not independently proven today.

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

Two-way door. The whole change is confined to the shell body and unit ordering of two reconciler oneshots that internal/clan/newsletters.go renders — git revert 069070a9 restores the previous || exit 0 bytes exactly, and the render is deterministic (TestRenderNewsletters_Deterministic), so a revert is byte-identical, with no migration, no persisted state and no infra footprint. It is a mechanical repair, not a design decision: it changes nothing about what the newsletters port means to do. The keys applied (app.site_name, appearance.public.custom_css, app.logo_url/app.favicon_url, the SMTP relay), the carrier (DDR 0225's live settings-PUT oneshot), the identity (the #1306 API-user token) and the live-apply/no-restart semantic are all untouched — the code now merely waits for the daemon to be able to accept the apply it already intended, which is what its own doc comments already claim ("AFTER Listmonk is up", newsletters.go:39-43) and what docs/GOTCHAS.md #2 already rules as house law for every oneshot in this tree. No security, trust, secrets, route or message surface is touched. Proven here by TestRenderNewsletters_ReconcilersGateOnListmonkServing (internal/clan/newsletters_test.go:261), written red-first: it failed on the pre-fix render and passes on the post-fix one, pinning the bounded retry on both reconcilers, the loud failure on budget elapse, the absence of the exit-0 swallow, and the serialisation of the two whole-object PUTs. Every pre-existing pin in the package still holds unchanged. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes.

drive 20260909T134009Z red at newsletters-wears-kit (sig 1c728f5612b3) — self-fixed on the fast lane, commit f08c46a0c3ae32fdc56a5471165b8ff3c0d016a4; checks: targeted (red-first): go test ./internal/clan/ -run TestRenderNewsletters_ReconcilersGateOnListmonkServing → FAIL before the fix (no retry loop, no loud-failure message, the || exit 0 swallow still rendered, brand unordered against newsletters-smtp); go test ./internal/clan/ -run TestRenderNewsletters → ok after (all 9 newsletters render tests, including the 8 pre-existing ones, unchanged and passing). package: go test ./internal/clan/ → ok 18.016s; go vet ./internal/clan/ → clean; gofmt -l on both changed files → clean. whole tree: go build ./... → clean and go test ./... → every package ok, no failures. commit shape: 2 files, 97 insertions / 8 deletions, of which 54/8 are non-test (internal/clan/newsletters.go); one commit 069070a9, not pushed, working tree clean. rails self-check: all 8 removed lines are in newsletters.go and are plumbing only — the two current=$(curl …) || exit 0 GET lines, one after = [ "listmonk.service" ]; render line, and four comment-render lines; ZERO removed lines in any test file (newsletters_test.go is +43/-0), none matching expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip; no skip added; 2 files and 54 non-test changed lines, under the cap; no .sandcastle/rehearsal-* or .forgejo/workflows/ path touched.. evidence: /home/swarm/swarm/Matou/idss/test-results/private-path/20260909T134009Z on matou-workstation.

## The failure Drive `20260909T134009Z` (`artifacts/verdict.json`: 33 legs, 32 green, `firstRedLeg: newsletters-wears-kit`) red at the last leg: > the live Newsletters (`https://newsletters.e2e-drive.idss.internal:41941`) is missing kit marks [name; accent] — its surface's ruled token set (DDR 0225) promises them on the card ("Carries your name, logo & colours"); title "listmonk - Mailing list", 1 stylesheets read The title is listmonk's stock public-page title, so `app.site_name` was never set. Nothing was applied at all. ## The evidence `logs/guest-system-journal.log:310-320` is the whole defect, in six lines: ``` 14:36:06 systemd[1]: Started Listmonk - newsletter and mailing list manager. 14:36:06 systemd[1]: Starting Apply the community brand kit to the running Listmonk (newsletters port, DDR 0225)... 14:36:06 systemd[1]: Starting Point Listmonk's SMTP send path at the community's own mail service ... 14:36:06 systemd[1]: Finished Point Listmonk's SMTP send path ... 14:36:06 systemd[1]: Finished Apply the community brand kit to the running Listmonk ... 14:36:06.210288 listmonk[24860]: init.go:657: initialized email (SMTP) messenger: username@smtp.yoursite.com 14:36:06 listmonk[24860]: ⇨ http server started on [::]:9010 ``` Both reconcilers ran to completion **and reported GREEN** before the daemon bound its serve port. The daemon then read listmonk's stock `username@smtp.yoursite.com` relay off the untouched settings row — independent proof that `newsletters-smtp`'s PUT no-opped too, not just the brand one. `logs/guest-failed-units.log` lists zero failed units: the fault was invisible to every guest-side check. ## The layer `internal/clan/newsletters.go` — the two settings-PUT reconcilers it renders. - `renderListmonkSMTP` (old `newsletters.go:376`) and `renderNewslettersBrand` (old `newsletters.go:480`) each opened with `current=$(curl -sf … "$addr/api/settings") || exit 0`. On a refused connection that is an *exit-zero*, so systemd records a successful oneshot that applied nothing. - Both units carry only `after = [ "listmonk.service" ]`. The nixpkgs module runs Listmonk `Type=simple`, so systemd calls the unit started the instant the process **forks** — ~200 ms before it listens. This is exactly the standing rule in `docs/GOTCHAS.md:31-43` (#2, "the port lies"): *"systemd `after=` is ordering, not readiness — a oneshot that needs a peer answering carries its own bounded retry."* The sibling brand oneshots already obey it — `internal/clan/video.go:394-414` and `internal/clan/whakapapa.go:564-575` both poll `for i in $(seq 1 30)` and `exit 1` loud. Newsletters was the one port that never did. - Second, latent fault in the same place: once both reconcilers *do* wait, they release together and each does a whole-object `GET /api/settings` → jq-merge → `PUT` of the **one** settings object. Concurrently, whichever read first has its keys silently dropped by the other's PUT — and `app.root_url` is the SMTP reconciler's key (`newsletters.go:383`), the base every public stylesheet link (and so the accent the check reads) resolves against. ## The fix One shared `newslettersSettingsReadyGate` (`internal/clan/newsletters.go:393-430`) both reconcilers now open with (`:377`, `:505`): poll the capability actually needed — the settings API answering — over a 60 s budget, keep the answered object in `$current` for the jq merge, and `exit 1` loud when the budget elapses. The SMTP unit grows the coreutils path the retry's `seq`/`sleep` come off (`:359`). The brand oneshot orders after the SMTP one (`:477`, `after` alone, never `requires` — a failed send-path reconcile must not withhold the brand). ## One thing worth a later look (not fixed here, does not block) The leg reported `[name; accent]` missing but **not** `logo`, against a Listmonk where demonstrably nothing was applied — so `pickLogoRef` (`app/tests/e2e/fixtures/brandreach.ts:535`) accepted one of listmonk's own stock assets. That is the same class the Grist heal addressed by preferring a kit-bearing document; here no document carried the accent, so the natural-order fallback took an upstream asset. After this fix the accent lands, the kit-bearing document wins, and the fallback is not reached — so it is not a blocker, but the logo half of the newsletters contract is not independently proven today. ## Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime) Two-way door. The whole change is confined to the shell body and unit ordering of two reconciler oneshots that `internal/clan/newsletters.go` renders — `git revert 069070a9` restores the previous `|| exit 0` bytes exactly, and the render is deterministic (TestRenderNewsletters_Deterministic), so a revert is byte-identical, with no migration, no persisted state and no infra footprint. It is a mechanical repair, not a design decision: it changes nothing about what the newsletters port *means* to do. The keys applied (`app.site_name`, `appearance.public.custom_css`, `app.logo_url`/`app.favicon_url`, the SMTP relay), the carrier (DDR 0225's live settings-PUT oneshot), the identity (the #1306 API-user token) and the live-apply/no-restart semantic are all untouched — the code now merely waits for the daemon to be able to accept the apply it already intended, which is what its own doc comments already claim ("AFTER Listmonk is up", newsletters.go:39-43) and what docs/GOTCHAS.md #2 already rules as house law for every oneshot in this tree. No security, trust, secrets, route or message surface is touched. Proven here by TestRenderNewsletters_ReconcilersGateOnListmonkServing (internal/clan/newsletters_test.go:261), written red-first: it failed on the pre-fix render and passes on the post-fix one, pinning the bounded retry on both reconcilers, the loud failure on budget elapse, the absence of the exit-0 swallow, and the serialisation of the two whole-object PUTs. Every pre-existing pin in the package still holds unchanged. Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes. drive `20260909T134009Z` red at `newsletters-wears-kit` (sig 1c728f5612b3) — self-fixed on the fast lane, commit `f08c46a0c3ae32fdc56a5471165b8ff3c0d016a4`; checks: targeted (red-first): `go test ./internal/clan/ -run TestRenderNewsletters_ReconcilersGateOnListmonkServing` → FAIL before the fix (no retry loop, no loud-failure message, the `|| exit 0` swallow still rendered, brand unordered against newsletters-smtp); `go test ./internal/clan/ -run TestRenderNewsletters` → ok after (all 9 newsletters render tests, including the 8 pre-existing ones, unchanged and passing). package: `go test ./internal/clan/` → ok 18.016s; `go vet ./internal/clan/` → clean; `gofmt -l` on both changed files → clean. whole tree: `go build ./...` → clean and `go test ./...` → every package ok, no failures. commit shape: 2 files, 97 insertions / 8 deletions, of which 54/8 are non-test (internal/clan/newsletters.go); one commit 069070a9, not pushed, working tree clean. rails self-check: all 8 removed lines are in newsletters.go and are plumbing only — the two `current=$(curl …) || exit 0` GET lines, one `after = [ "listmonk.service" ];` render line, and four comment-render lines; ZERO removed lines in any test file (newsletters_test.go is +43/-0), none matching expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip; no skip added; 2 files and 54 non-test changed lines, under the cap; no `.sandcastle/rehearsal-*` or `.forgejo/workflows/` path touched.. evidence: `/home/swarm/swarm/Matou/idss/test-results/private-path/20260909T134009Z` on matou-workstation. <!-- rehearsal-sig: 1c728f5612b3 -->
Author
Member

close-report for #1357 — status success

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

envelope
{
  "issue": 1357,
  "status": "success",
  "commits": [
    "f08c46a0c3ae32fdc56a5471165b8ff3c0d016a4"
  ],
  "changed_files": [
    "internal/clan/newsletters.go",
    "internal/clan/newsletters_test.go"
  ],
  "tests": [
    {
      "command": "targeted (red-first): `go test ./internal/clan/ -run TestRenderNewsletters_ReconcilersGateOnListmonkServing` → FAIL before the fix (no retry loop, no loud-failure message, the `|| exit 0` swallow still rendered, brand unordered against newsletters-smtp); `go test ./internal/clan/ -run TestRenderNewsletters` → ok after (all 9 newsletters render tests, including the 8 pre-existing ones, unchanged and passing). package: `go test ./internal/clan/` → ok 18.016s; `go vet ./internal/clan/` → clean; `gofmt -l` on both changed files → clean. whole tree: `go build ./...` → clean and `go test ./...` → every package ok, no failures. commit shape: 2 files, 97 insertions / 8 deletions, of which 54/8 are non-test (internal/clan/newsletters.go); one commit 069070a9, not pushed, working tree clean. rails self-check: all 8 removed lines are in newsletters.go and are plumbing only — the two `current=$(curl …) || exit 0` GET lines, one `after = [ \"listmonk.service\" ];` render line, and four comment-render lines; ZERO removed lines in any test file (newsletters_test.go is +43/-0), none matching expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip; no skip added; 2 files and 54 non-test changed lines, under the cap; no `.sandcastle/rehearsal-*` or `.forgejo/workflows/` path touched.",
      "exit_code": 0
    }
  ],
  "criteria": {
    "the red leg is now green": "healed on the fast lane, commit f08c46a0c3ae32fdc56a5471165b8ff3c0d016a4"
  },
  "summary": "Both newsletters settings reconcilers fired at Listmonk's fork rather than its listener and swallowed the refused connection with `|| exit 0`, so the brand and SMTP applies silently no-opped and the live port wore no kit; added a shared bounded readiness gate that polls /api/settings and fails loud, and ordered the brand PUT after the SMTP PUT so the two whole-object merges cannot clobber each other.",
  "blockers": []
}
**close-report** for #1357 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1357, "status": "success", "commits": [ "f08c46a0c3ae32fdc56a5471165b8ff3c0d016a4" ], "changed_files": [ "internal/clan/newsletters.go", "internal/clan/newsletters_test.go" ], "tests": [ { "command": "targeted (red-first): `go test ./internal/clan/ -run TestRenderNewsletters_ReconcilersGateOnListmonkServing` → FAIL before the fix (no retry loop, no loud-failure message, the `|| exit 0` swallow still rendered, brand unordered against newsletters-smtp); `go test ./internal/clan/ -run TestRenderNewsletters` → ok after (all 9 newsletters render tests, including the 8 pre-existing ones, unchanged and passing). package: `go test ./internal/clan/` → ok 18.016s; `go vet ./internal/clan/` → clean; `gofmt -l` on both changed files → clean. whole tree: `go build ./...` → clean and `go test ./...` → every package ok, no failures. commit shape: 2 files, 97 insertions / 8 deletions, of which 54/8 are non-test (internal/clan/newsletters.go); one commit 069070a9, not pushed, working tree clean. rails self-check: all 8 removed lines are in newsletters.go and are plumbing only — the two `current=$(curl …) || exit 0` GET lines, one `after = [ \"listmonk.service\" ];` render line, and four comment-render lines; ZERO removed lines in any test file (newsletters_test.go is +43/-0), none matching expect(/assert/require./t.Fatal/t.Error/toBe/toEqual/func Test/it(/test(/describe(/.skip; no skip added; 2 files and 54 non-test changed lines, under the cap; no `.sandcastle/rehearsal-*` or `.forgejo/workflows/` path touched.", "exit_code": 0 } ], "criteria": { "the red leg is now green": "healed on the fast lane, commit f08c46a0c3ae32fdc56a5471165b8ff3c0d016a4" }, "summary": "Both newsletters settings reconcilers fired at Listmonk's fork rather than its listener and swallowed the refused connection with `|| exit 0`, so the brand and SMTP applies silently no-opped and the live port wore no kit; added a shared bounded readiness gate that polls /api/settings and fails loud, and ordered the brand PUT after the SMTP PUT so the two whole-object merges cannot clobber each other.", "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#1357
No description provided.