redeploy-services: the newsletters operator pre-provision never NAMES the account status — Listmonk's user_status enum refuses the create 500 and the operator reads "not yet applied" forever #1592

Closed
opened 2026-09-18 17:38:52 +00:00 by matou-build-agent · 1 comment

The failure

Drive 20260918T165406Z (commit 771736b3) red at redeploy-services, 29/30 legs green:

role posture not honest on 1 door(s) — proof-operator's role on newsletters reads "not yet applied" (Super Admin) — the reconcile is still owed

The leg adds newsletters from the panel, then reads the granted operator's detail and demands every declared-posture door name a role that is APPLIED (journey.rented-services.spec.ts:627-645). artifacts/roles/detail-proof-operator-after-redeploy.json shows exactly one dishonest row:

{"service":"newsletters","has_access":true,"via":"all members","role_in_app":"Super Admin","not_applied":true}

Notably surveys — not_applied:true in detail-proof-operator-granted.json before the redeploy — CLEARED. The deploy-time reconcile ran; it just could not land newsletters.

What the box said

Asked directly (journalctl -u idss-control-plane, the kept droplet 170.64.183.213; the same two lines are at logs/droplet-journal.txt:1957 and :1969):

newsletters operator pre-provision refused component=control-plane person=operator
  role="Super Admin" status=500
  reason=" — Listmonk said: {\"message\":\"Error creating User: pq: invalid input value for enum user_status: \\\"\\\"\"}"
newsletters operator pre-provision refused component=control-plane person=proof-operator
  role="Super Admin" status=500
  reason=" — Listmonk said: {\"message\":\"Error creating User: pq: invalid input value for enum user_status: \\\"\\\"\"}"

Twice — the founder operator and the by-hand-granted proof-operator. Nothing after: no newsletters role reconciled, no newsletters operator pre-provisioned.

The defect

internal/newslettersvc/newslettersvc.go:271-278 — provisionOperator POSTs /api/users with username/email/name/type/user_role_id/password_login and no status. Listmonk passes the body through to Postgres, whose user_status enum has no empty member, so the INSERT is refused. (The error is a driver error, not a Listmonk field-validation 400 — so the create got past Listmonk's own validators and status is the last gap.)

The consequence is the honest tail doing its job: ReconcileService records a failed per-person reconcile as still owed (internal/member/roles.go:346, setServiceOutstanding(&ls.Members[i], service, owed)), detail.go:399 renders it as NotApplied, and the leg refuses it.

Why the unit tests were green

The faithful double's create handler (newslettersvc_test.go:93-129) hard-coded status: "enabled" on every new row regardless of the request body — so #1553's pre-provision was proven against a Listmonk that does not exist. Same shape as #1580's missing email, and the same lesson as GOTCHAS #246: the create's REQUIRED fields belong in the double, not in its generosity.

Suspected layer

Product — the newsletters (Listmonk) port adapter, one missing key in one admin-API create body. Not harness, not fixture, not the drive.

Note on the signature

This is the third consecutive red at sig 03347fc9985d, but the signature has not RESISTED healing — each drive's red had a distinct fault and each heal advanced it. Heal #1 (2864527a) added newsletters-oidc.service to the droplet journal dial; that is precisely why droplet-journal.txt carried the refusal line this time instead of needing the box asked by hand. This is the first drive whose evidence names the role-posture fault itself.

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

Two-way door. Revertible by a single commit dropping one key ("status": statusEnabled) from the map literal at internal/newslettersvc/newslettersvc.go:280 — nothing persists, no migration, no state on any box outlives the drive that made it.

Proven by a test written here, red first. TestNewslettersPort_ReconcileRoleOperatorNeverSignedInIsPreProvisioned and TestNewslettersPort_PreProvisionCarriesThePersonsEmail both failed with the box's own words before the fix — the double now refuses a status-less create with the verbatim 500 body read off this drive's journal — and pass after. The pre-provision test also gained a new assertion (u.status != statusEnabled) pinning the created row's status.

Mechanical, not a design decision. statusEnabled is the port's own existing constant (newslettersvc.go:309), already the state DisableCredentials/EnableCredentials reconcile between — that posture decision was made elsewhere and is untouched. An enabled row is what the pre-provision already MEANT: its doc comment says the operator is "a Super Admin the instant they land", which a disabled account defeats. Nothing a community sees changes, no route, no secret, no default, no message at a trust moment — the code is made to do what it already declared it does. Rules 1 and 2 both hold: no assertion, test or leg was weakened, deleted or skipped (only added to), and the diff is 2 files / 14 non-test insertions (3 of the 4 deletions are the email/name/type keys re-emitted at gofmt's new alignment, values byte-identical; the 4th is the fake's fakeUser construction line, which now carries the body's status instead of a hard-coded one). Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes.

drive 20260918T165406Z red at redeploy-services (sig 03347fc9985d) — self-fixed on the fast lane, commit c87fe622aaea15e32e3e1349f2cae368a8175fc3; checks: Red-first: GOWORK=… go test ./internal/newslettersvc/ -run 'PreProvision|NeverSignedIn' -count=1 after the double was made faithful and BEFORE the product fix — 2 FAIL, both pre-provision operator "newcomer" failed: HTTP 500 — Listmonk said: {"message":"Error creating User: pq: invalid input value for enum user_status: \"\""}, i.e. the box's refusal reproduced byte-for-byte on the workstation. Targeted (after the fix): same command — ok. Package tests: GOWORK=… go test ./internal/newslettersvc/ -count=1 — ok (0.017s). Dependent packages: GOWORK=… go test ./internal/newslettersvc/ ./internal/member/ ./internal/provision/ -count=1 — all three ok. go vet ./internal/newslettersvc/ — exit 0. gofmt -l internal/newslettersvc/ — clean. GOWORK=… go build ./... — exit 0. Diff: 2 files, 33 insertions / 4 deletions; no assertion, test or leg touched except by ADDITION (one new t.Fatalf guard on the created row's status). The live leg needs a rented droplet and re-proves on the next drive.. evidence: /home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260918T165406Z on matou-workstation.

## The failure Drive `20260918T165406Z` (commit `771736b3`) red at `redeploy-services`, 29/30 legs green: > role posture not honest on 1 door(s) — proof-operator's role on newsletters reads "not yet applied" (Super Admin) — the reconcile is still owed The leg adds `newsletters` from the panel, then reads the granted operator's detail and demands every declared-posture door name a role that is APPLIED (`journey.rented-services.spec.ts:627-645`). `artifacts/roles/detail-proof-operator-after-redeploy.json` shows exactly one dishonest row: ```json {"service":"newsletters","has_access":true,"via":"all members","role_in_app":"Super Admin","not_applied":true} ``` Notably `surveys` — `not_applied:true` in `detail-proof-operator-granted.json` before the redeploy — CLEARED. The deploy-time reconcile ran; it just could not land newsletters. ## What the box said Asked directly (`journalctl -u idss-control-plane`, the kept droplet `170.64.183.213`; the same two lines are at `logs/droplet-journal.txt:1957` and `:1969`): ``` newsletters operator pre-provision refused component=control-plane person=operator role="Super Admin" status=500 reason=" — Listmonk said: {\"message\":\"Error creating User: pq: invalid input value for enum user_status: \\\"\\\"\"}" newsletters operator pre-provision refused component=control-plane person=proof-operator role="Super Admin" status=500 reason=" — Listmonk said: {\"message\":\"Error creating User: pq: invalid input value for enum user_status: \\\"\\\"\"}" ``` Twice — the founder `operator` and the by-hand-granted `proof-operator`. Nothing after: no `newsletters role reconciled`, no `newsletters operator pre-provisioned`. ## The defect `internal/newslettersvc/newslettersvc.go:271-278` — `provisionOperator` POSTs `/api/users` with `username`/`email`/`name`/`type`/`user_role_id`/`password_login` and **no `status`**. Listmonk passes the body through to Postgres, whose `user_status` enum has no empty member, so the INSERT is refused. (The error is a *driver* error, not a Listmonk field-validation 400 — so the create got past Listmonk's own validators and `status` is the last gap.) The consequence is the honest tail doing its job: `ReconcileService` records a failed per-person reconcile as still owed (`internal/member/roles.go:346`, `setServiceOutstanding(&ls.Members[i], service, owed)`), `detail.go:399` renders it as `NotApplied`, and the leg refuses it. ## Why the unit tests were green The faithful double's create handler (`newslettersvc_test.go:93-129`) hard-coded `status: "enabled"` on every new row regardless of the request body — so `#1553`'s pre-provision was proven against a Listmonk that does not exist. Same shape as `#1580`'s missing `email`, and the same lesson as GOTCHAS #246: the create's REQUIRED fields belong in the double, not in its generosity. ## Suspected layer Product — the newsletters (Listmonk) port adapter, one missing key in one admin-API create body. Not harness, not fixture, not the drive. ## Note on the signature This is the third consecutive red at sig `03347fc9985d`, but the signature has not RESISTED healing — each drive's red had a distinct fault and each heal advanced it. Heal #1 (`2864527a`) added `newsletters-oidc.service` to the droplet journal dial; that is precisely why `droplet-journal.txt` carried the refusal line this time instead of needing the box asked by hand. This is the first drive whose evidence names the role-posture fault itself. ## Proposed ruling (Ruled by the healer under ADR 0174 — veto anytime) **Two-way door.** Revertible by a single commit dropping one key (`"status": statusEnabled`) from the map literal at `internal/newslettersvc/newslettersvc.go:280` — nothing persists, no migration, no state on any box outlives the drive that made it. **Proven by a test written here, red first.** `TestNewslettersPort_ReconcileRoleOperatorNeverSignedInIsPreProvisioned` and `TestNewslettersPort_PreProvisionCarriesThePersonsEmail` both failed with the box's own words before the fix — the double now refuses a status-less create with the verbatim 500 body read off this drive's journal — and pass after. The pre-provision test also gained a new assertion (`u.status != statusEnabled`) pinning the created row's status. **Mechanical, not a design decision.** `statusEnabled` is the port's own existing constant (`newslettersvc.go:309`), already the state `DisableCredentials`/`EnableCredentials` reconcile between — that posture decision was made elsewhere and is untouched. An enabled row is what the pre-provision already MEANT: its doc comment says the operator is "a Super Admin the instant they land", which a disabled account defeats. Nothing a community sees changes, no route, no secret, no default, no message at a trust moment — the code is made to do what it already declared it does. Rules 1 and 2 both hold: no assertion, test or leg was weakened, deleted or skipped (only added to), and the diff is 2 files / 14 non-test insertions (3 of the 4 deletions are the `email`/`name`/`type` keys re-emitted at gofmt's new alignment, values byte-identical; the 4th is the fake's `fakeUser` construction line, which now carries the body's status instead of a hard-coded one). Built on the workstation (never the drive host) and closed through the close-report gate — the same gate a swarm worker passes. drive `20260918T165406Z` red at `redeploy-services` (sig 03347fc9985d) — self-fixed on the fast lane, commit `c87fe622aaea15e32e3e1349f2cae368a8175fc3`; checks: Red-first: `GOWORK=… go test ./internal/newslettersvc/ -run 'PreProvision|NeverSignedIn' -count=1` after the double was made faithful and BEFORE the product fix — 2 FAIL, both `pre-provision operator "newcomer" failed: HTTP 500 — Listmonk said: {"message":"Error creating User: pq: invalid input value for enum user_status: \"\""}`, i.e. the box's refusal reproduced byte-for-byte on the workstation. Targeted (after the fix): same command — ok. Package tests: `GOWORK=… go test ./internal/newslettersvc/ -count=1` — ok (0.017s). Dependent packages: `GOWORK=… go test ./internal/newslettersvc/ ./internal/member/ ./internal/provision/ -count=1` — all three ok. `go vet ./internal/newslettersvc/` — exit 0. `gofmt -l internal/newslettersvc/` — clean. `GOWORK=… go build ./...` — exit 0. Diff: 2 files, 33 insertions / 4 deletions; no assertion, test or leg touched except by ADDITION (one new `t.Fatalf` guard on the created row's status). The live leg needs a rented droplet and re-proves on the next drive.. evidence: `/home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260918T165406Z` on matou-workstation. <!-- rehearsal-sig: 03347fc9985d -->
Author
Member

close-report for #1592 — status success

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

envelope
{
  "issue": 1592,
  "status": "success",
  "commits": [
    "c87fe622aaea15e32e3e1349f2cae368a8175fc3"
  ],
  "changed_files": [
    "internal/newslettersvc/newslettersvc.go",
    "internal/newslettersvc/newslettersvc_test.go"
  ],
  "tests": [
    {
      "command": "Red-first: `GOWORK=… go test ./internal/newslettersvc/ -run 'PreProvision|NeverSignedIn' -count=1` after the double was made faithful and BEFORE the product fix — 2 FAIL, both `pre-provision operator \"newcomer\" failed: HTTP 500 — Listmonk said: {\"message\":\"Error creating User: pq: invalid input value for enum user_status: \\\"\\\"\"}`, i.e. the box's refusal reproduced byte-for-byte on the workstation. Targeted (after the fix): same command — ok. Package tests: `GOWORK=… go test ./internal/newslettersvc/ -count=1` — ok (0.017s). Dependent packages: `GOWORK=… go test ./internal/newslettersvc/ ./internal/member/ ./internal/provision/ -count=1` — all three ok. `go vet ./internal/newslettersvc/` — exit 0. `gofmt -l internal/newslettersvc/` — clean. `GOWORK=… go build ./...` — exit 0. Diff: 2 files, 33 insertions / 4 deletions; no assertion, test or leg touched except by ADDITION (one new `t.Fatalf` guard on the created row's status). The live leg needs a rented droplet and re-proves on the next drive.",
      "exit_code": 0
    }
  ],
  "criteria": {
    "the red leg is now green": "healed on the fast lane, commit c87fe622aaea15e32e3e1349f2cae368a8175fc3"
  },
  "summary": "The newsletters port's operator pre-provision POSTed `/api/users` with no `status`, which Listmonk's `user_status` Postgres enum refused with HTTP 500, leaving both operators permanently \"not yet applied on newsletters\"; added `\"status\": statusEnabled` to the create body and made the test double refuse a status-less create the way the real service does.",
  "blockers": []
}
**close-report** for #1592 — status `success` :white_check_mark: **close-report gates passed** — every claim verified against main; issue closed. <details><summary>envelope</summary> ```json { "issue": 1592, "status": "success", "commits": [ "c87fe622aaea15e32e3e1349f2cae368a8175fc3" ], "changed_files": [ "internal/newslettersvc/newslettersvc.go", "internal/newslettersvc/newslettersvc_test.go" ], "tests": [ { "command": "Red-first: `GOWORK=… go test ./internal/newslettersvc/ -run 'PreProvision|NeverSignedIn' -count=1` after the double was made faithful and BEFORE the product fix — 2 FAIL, both `pre-provision operator \"newcomer\" failed: HTTP 500 — Listmonk said: {\"message\":\"Error creating User: pq: invalid input value for enum user_status: \\\"\\\"\"}`, i.e. the box's refusal reproduced byte-for-byte on the workstation. Targeted (after the fix): same command — ok. Package tests: `GOWORK=… go test ./internal/newslettersvc/ -count=1` — ok (0.017s). Dependent packages: `GOWORK=… go test ./internal/newslettersvc/ ./internal/member/ ./internal/provision/ -count=1` — all three ok. `go vet ./internal/newslettersvc/` — exit 0. `gofmt -l internal/newslettersvc/` — clean. `GOWORK=… go build ./...` — exit 0. Diff: 2 files, 33 insertions / 4 deletions; no assertion, test or leg touched except by ADDITION (one new `t.Fatalf` guard on the created row's status). The live leg needs a rented droplet and re-proves on the next drive.", "exit_code": 0 } ], "criteria": { "the red leg is now green": "healed on the fast lane, commit c87fe622aaea15e32e3e1349f2cae368a8175fc3" }, "summary": "The newsletters port's operator pre-provision POSTed `/api/users` with no `status`, which Listmonk's `user_status` Postgres enum refused with HTTP 500, leaving both operators permanently \"not yet applied on newsletters\"; added `\"status\": statusEnabled` to the create body and made the test double refuse a status-less create the way the real service does.", "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#1592
No description provided.