redeploy-services: Grist and Listmonk refuse the bare-person-id role reconcile (no email) #1581

Closed
opened 2026-09-18 14:37:55 +00:00 by matou-build-agent · 2 comments

The failure

Drive 20260918T135205Z (rented-services, commit a3977df1) is red at leg redeploy-services — 30 legs, 29 green, 1 red, 0 skip (artifacts/verdict.json). The drive ran 14:11:21Z → 14:28:26Z.

This is NOT the known frontier. The frontier named in the brief — pairing never flips, the own-VPS carrier issue — did not occur: {"leg":"pair","status":"green","ms":225}. And artifacts/legs.json carries no skip reasons at all ("skip": 0), so nothing in this drive is declared out of scope. This is a genuine new red.

The fault, from artifacts/legs.json / artifacts/journey.json:

role posture not honest on 2 door(s) — proof-operator's role on data-collections reads "not yet applied" (org owner) — the reconcile is still owed | proof-operator's role on newsletters reads "not yet applied" (Super Admin) — the reconcile is still owed

Two email-keyed ports (Grist, Listmonk) refuse the per-person role reconcile because the product hands them a bare person id where the app requires an email address. A granted operator therefore reads "not yet applied" forever at those two doors.

The evidence

The tail moved exactly as the domain says, except at two doors

artifacts/roles/detail-proof-operator-granted.json (14:25) vs detail-proof-operator-after-redeploy.json (14:28):

door before redeploy after redeploy
surveys "role_in_app":"superadmin","not_applied":true "role_in_app":"superadmin" — cleared ✔
data-collections "role_in_app":"org owner","not_applied":true "role_in_app":"org owner","not_applied":true — still owed ✘
newsletters (absent — service not deployed yet) "role_in_app":"Super Admin","not_applied":true — never applied ✘

surveys cleared through the AppliesAtDeploy branch (internal/member/roles.go:323-325). The two that stayed are genuinely refused per-person reconciles. Note newsletters is absent from artifacts/services-rows.json (6 services, captured at the services-row leg) — it arrives only with the redeploy, which is why its reconcile had never run before.

1. data-collections (Grist) — the org-access PATCH is keyed by a bare person id

logs/droplet-journal.txt:1985-1987, re-read live on the still-up box (journalctl -u idss-control-plane):

14:28:22.408 INFO msg="data-collections org access already converged" person=operator role=owners
14:28:22.428 INFO msg="data-collections org access refused" person=proof-member role=editors status=400 reason=" — Grist said: {\"error\":\"Invalid email address included\"}"
14:28:22.446 INFO msg="data-collections org access refused" person=proof-operator role=owners status=400 reason=" — Grist said: {\"error\":\"Invalid email address included\"}"

The same refusal also fired at droplet-journal.txt:1474, :1531, :1590 (14:25:38 / 14:25:41 / 14:25:51) — at add-member and grant-operator time. That is why data-collections was already in the tail before the redeploy.

The defect is the PATCH body — internal/datacollectionssvc/datacollectionssvc.go:250:

body, _ := json.Marshal(map[string]any{"delta": map[string]any{"users": map[string]any{personID: want}}})

Grist validates that map's keys as email addresses and refuses "proof-operator" outright.

Live-box confirmation (read-only GET /api/orgs/data-collections/access with the owner key from /var/lib/data-collections/state/owner-api-key):

{"users":[{"id":5,"email":"operator","name":"operator","access":"owners","isMember":true},
          {"id":6,"email":"idss-health-nonowner@data-collections.local","access":"guests","isMember":false}]}

proof-operator and proof-member are absent. And the asymmetry is visible: the founder operator is present with email literally "operator" — Grist's own forward-auth path minted that user from the bare header value with no email validation. So Grist accepts a bare id when it mints the user itself (hence person=operator reads "already converged" via the short-circuit at datacollectionssvc.go:243-249, and the read-back at :291 comparing u.Email == personID appears to work), and refuses one when asked to grant access to it. The promise in the port's own doc comment (datacollectionssvc.go:200-204: "a granted operator is an owner the instant the panel grants them, never waiting on a login") cannot hold on that path.

2. newsletters (Listmonk) — the pre-provision POST omits email

No newsletters reconcile line exists in the journal at all — grep -cE "newsletters (role reconciled|operator pre-provisioned)" logs/droplet-journal.txt → 0. Both of this port's failure paths are silent (see the diagnosability note below).

Live-box read-only GET /api/users on the Listmonk loopback (http://127.0.0.1:9010) returns exactly two rows:

{"data":[{"id":1,"username":"idss-admin","email":"idss-admin@listmonk","type":"user","user_role":{"id":1,"name":"Super Admin"}},
         {"id":2,"username":"idss-api","email":null,"type":"api","user_role":{"id":1,"name":"Super Admin"}}]}

proof-operator was never created. GET /api/roles/users returns 200 with Super Admin (id 1) and Members (id 2), so roleID resolution was fine. Listmonk is v6.1.0 (x86_64-linux) (journalctl -u listmonk).

The refusing request is provisionOperator — internal/newslettersvc/newslettersvc.go:237-242:

status, err := p.request(ctx, http.MethodPost, "/api/users", map[string]any{
    "username":       personID,
    "type":           "user",
    "user_role_id":   roleID,
    "password_login": false,
}, nil)

No email field. The healer replayed this verbatim once against the box and read back HTTP 400 {"message":"Invalid fields: email"}, creating nothing (I did not re-run the mutation; the GET /api/users above independently confirms the row is absent). The two existing rows corroborate the constraint's shape: idss-admin is type:"user" and carries a synthesised idss-admin@listmonk; idss-api is type:"api" and is allowed email:null. Listmonk 6.1.0 requires a valid email on any type:"user" row, so the #1553 pre-provision has never been able to land.

Corroborating: the box is otherwise healthy

systemctl --failed on the live box → 0 failed units. Every port probes healthy at 14:28:17–14:28:22, newsletters included (verdict=healthy for all seven). This is not an infra or deploy failure.

The suspected layer: product — and it needs a ruling

The harness is sound and the check is right. assertRoleApplied (app/tests/e2e/fixtures/panelMembers.ts:166-185) raises exactly this string off the product's own not_applied flag; it is asserting the product's declared posture, not inventing one. Nothing in the journey or fixtures needs changing.

The product-side root cause: both ports key a person on an email, but memberorbit.ServicePort.ReconcileRole(personID string, operator bool) (internal/memberorbit/memberorbit.go:151) carries only a bare id, and the member ledger holds no email field at all (grep -rn "Email" internal/member/ → no hits). Neither port can supply one today.

What plugging it needs

The fix is not a wrong constant — it is a decision about what email identity a community member is known by inside a deployed app, and it is a one-way door (a wrong choice strands or duplicates accounts later commits cannot cleanly undo):

  • Option A — synthesise <personID>@<apex> in each port. Cheap, but it decides the identity Listmonk's OIDC auto-provision matches on at first sign-in; get it wrong and you land exactly the failure newslettersvc.go:228-231 warns about — the OIDC login makes a second Members-role account beside the pre-provisioned one. For Grist it also splits the person from the email:"operator"-shaped row the forward-auth header already mints (#1536's bare-id convention), leaving two Grist users for one person — and it would break accessWithKey's u.Email == personID read-back, making the reconcile non-idempotent even once the PATCH succeeds.
  • Option B — carry a real email through the port contract: add it to the ledger and widen ServicePort.ReconcileRole. Honest, but it touches every port implementation and the catalogue.
  • Option C — change the forward-auth/OIDC header to carry an email so apps and reconciler agree on one key. A front-door/identity change, ADR territory (#1536).

A swarm agent can act the moment that ruling lands; it should not pick for itself, which is why this is filed confident: false. Note also that Ben's recent option-1 ruling for #1575 (commit 8d69f1b3 — "a member reaches Grist by a PER-PERSON grant, never the everyone principal") is what put data-collections on this per-person path; the email key is the next question that ruling opens, not a regression of it.

Also worth fixing alongside: the newsletters reconcile failure is invisible

internal/newslettersvc/newslettersvc.go logs only its success paths (:221, :249); ReconcileRole/provisionOperator return errors bare, recording the status but never the response body (:218, :246-248). internal/member/roles.go:345 then discards the error entirely — owed := o.catalogue.ReconcileRole(...) != nil. Net effect: a newsletters reconcile that HTTP-400s leaves zero trace in the drive's journal. The only reason this drive is diagnosable at all is that data-collections was given exactly this logging by #1575 (datacollectionssvc.go:256-262). Bringing newslettersvc onto that footing — log the refusal with the response body, Grist-style — would have named this in one command instead of a replay. Same hazard class as GOTCHAS #245.

What is absent from the run directory

  • No newsletters reconcile line of any kind in logs/droplet-journal.txt (the central absence — the silent error path above).
  • logs/guest-*.log are 127-byte stubs and logs/qemu.log records spawn qemu-system-x86_64 ENOENT — expected: this is a rented droplet in payload mode (artifacts/host.json payloadMode), not a local guest VM.
  • artifacts/legs.json carries no skip entries and therefore no skip reasons — there is no out-of-scope declaration covering this red.
  • logs/reporter-claude.err and logs/reporter-invoked are empty (0 bytes).

Reproduction

The live leg needs a rented droplet, and re-proves on the next drive once a ruling lands. Both refusals are deterministic and reproducible from any founded community with an operator granted by hand before their first sign-in at either door.

drive 20260918T135205Z red at redeploy-services: role posture not honest on 2 door(s) — proof-operator's role on data-collections reads "not yet applied" (org owner) — the reconcile is still owed | proof-operator's role on newsletters reads "not
evidence: /home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260918T135205Z 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 `20260918T135205Z` (rented-services, commit `a3977df1`) is **red at leg `redeploy-services`** — 30 legs, 29 green, 1 red, **0 skip** (`artifacts/verdict.json`). The drive ran 14:11:21Z → 14:28:26Z. **This is NOT the known frontier.** The frontier named in the brief — pairing never flips, the own-VPS carrier issue — did not occur: `{"leg":"pair","status":"green","ms":225}`. And `artifacts/legs.json` carries **no skip reasons at all** (`"skip": 0`), so nothing in this drive is declared out of scope. This is a genuine new red. The fault, from `artifacts/legs.json` / `artifacts/journey.json`: > role posture not honest on 2 door(s) — proof-operator's role on data-collections reads "not yet applied" (org owner) — the reconcile is still owed | proof-operator's role on newsletters reads "not yet applied" (Super Admin) — the reconcile is still owed Two email-keyed ports (Grist, Listmonk) refuse the per-person role reconcile because the product hands them a **bare person id** where the app requires an **email address**. A granted operator therefore reads "not yet applied" forever at those two doors. ## The evidence ### The tail moved exactly as the domain says, except at two doors `artifacts/roles/detail-proof-operator-granted.json` (14:25) vs `detail-proof-operator-after-redeploy.json` (14:28): | door | before redeploy | after redeploy | |---|---|---| | `surveys` | `"role_in_app":"superadmin","not_applied":true` | `"role_in_app":"superadmin"` — **cleared** ✔ | | `data-collections` | `"role_in_app":"org owner","not_applied":true` | `"role_in_app":"org owner","not_applied":true` — **still owed** ✘ | | `newsletters` | *(absent — service not deployed yet)* | `"role_in_app":"Super Admin","not_applied":true` — **never applied** ✘ | `surveys` cleared through the `AppliesAtDeploy` branch (`internal/member/roles.go:323-325`). The two that stayed are genuinely refused per-person reconciles. Note `newsletters` is absent from `artifacts/services-rows.json` (6 services, captured at the `services-row` leg) — it arrives only with the redeploy, which is why its reconcile had never run before. ### 1. data-collections (Grist) — the org-access PATCH is keyed by a bare person id `logs/droplet-journal.txt:1985-1987`, re-read live on the still-up box (`journalctl -u idss-control-plane`): ``` 14:28:22.408 INFO msg="data-collections org access already converged" person=operator role=owners 14:28:22.428 INFO msg="data-collections org access refused" person=proof-member role=editors status=400 reason=" — Grist said: {\"error\":\"Invalid email address included\"}" 14:28:22.446 INFO msg="data-collections org access refused" person=proof-operator role=owners status=400 reason=" — Grist said: {\"error\":\"Invalid email address included\"}" ``` The same refusal also fired at `droplet-journal.txt:1474`, `:1531`, `:1590` (14:25:38 / 14:25:41 / 14:25:51) — at `add-member` and `grant-operator` time. That is why `data-collections` was already in the tail *before* the redeploy. The defect is the PATCH body — `internal/datacollectionssvc/datacollectionssvc.go:250`: ```go body, _ := json.Marshal(map[string]any{"delta": map[string]any{"users": map[string]any{personID: want}}}) ``` Grist validates that map's **keys as email addresses** and refuses `"proof-operator"` outright. **Live-box confirmation** (read-only `GET /api/orgs/data-collections/access` with the owner key from `/var/lib/data-collections/state/owner-api-key`): ```json {"users":[{"id":5,"email":"operator","name":"operator","access":"owners","isMember":true}, {"id":6,"email":"idss-health-nonowner@data-collections.local","access":"guests","isMember":false}]} ``` `proof-operator` and `proof-member` are **absent**. And the asymmetry is visible: the founder `operator` is present with `email` literally `"operator"` — Grist's *own* forward-auth path minted that user from the bare header value with no email validation. So Grist **accepts** a bare id when it mints the user itself (hence `person=operator` reads "already converged" via the short-circuit at `datacollectionssvc.go:243-249`, and the read-back at `:291` comparing `u.Email == personID` appears to work), and **refuses** one when asked to grant access to it. The promise in the port's own doc comment (`datacollectionssvc.go:200-204`: "a granted operator is an owner the instant the panel grants them, never waiting on a login") cannot hold on that path. ### 2. newsletters (Listmonk) — the pre-provision POST omits `email` **No newsletters reconcile line exists in the journal at all** — `grep -cE "newsletters (role reconciled|operator pre-provisioned)" logs/droplet-journal.txt` → **0**. Both of this port's failure paths are silent (see the diagnosability note below). Live-box read-only `GET /api/users` on the Listmonk loopback (`http://127.0.0.1:9010`) returns exactly two rows: ```json {"data":[{"id":1,"username":"idss-admin","email":"idss-admin@listmonk","type":"user","user_role":{"id":1,"name":"Super Admin"}}, {"id":2,"username":"idss-api","email":null,"type":"api","user_role":{"id":1,"name":"Super Admin"}}]} ``` `proof-operator` was **never created**. `GET /api/roles/users` returns 200 with `Super Admin` (id 1) and `Members` (id 2), so `roleID` resolution was fine. Listmonk is `v6.1.0 (x86_64-linux)` (`journalctl -u listmonk`). The refusing request is `provisionOperator` — `internal/newslettersvc/newslettersvc.go:237-242`: ```go status, err := p.request(ctx, http.MethodPost, "/api/users", map[string]any{ "username": personID, "type": "user", "user_role_id": roleID, "password_login": false, }, nil) ``` **No `email` field.** The healer replayed this verbatim once against the box and read back `HTTP 400 {"message":"Invalid fields: email"}`, creating nothing (I did not re-run the mutation; the `GET /api/users` above independently confirms the row is absent). The two existing rows corroborate the constraint's shape: `idss-admin` is `type:"user"` and carries a synthesised `idss-admin@listmonk`; `idss-api` is `type:"api"` and is allowed `email:null`. Listmonk 6.1.0 requires a valid `email` on any `type:"user"` row, so the #1553 pre-provision has **never** been able to land. ### Corroborating: the box is otherwise healthy `systemctl --failed` on the live box → **0 failed units**. Every port probes healthy at 14:28:17–14:28:22, `newsletters` included (`verdict=healthy` for all seven). This is not an infra or deploy failure. ## The suspected layer: **product** — and it needs a ruling The harness is sound and the check is right. `assertRoleApplied` (`app/tests/e2e/fixtures/panelMembers.ts:166-185`) raises exactly this string off the product's own `not_applied` flag; it is asserting the product's declared posture, not inventing one. Nothing in the journey or fixtures needs changing. The product-side root cause: both ports key a person on an **email**, but `memberorbit.ServicePort.ReconcileRole(personID string, operator bool)` (`internal/memberorbit/memberorbit.go:151`) carries only a bare id, and the member ledger holds **no email field at all** (`grep -rn "Email" internal/member/` → no hits). Neither port can supply one today. ## What plugging it needs The fix is not a wrong constant — it is a decision about **what email identity a community member is known by inside a deployed app**, and it is a one-way door (a wrong choice strands or duplicates accounts later commits cannot cleanly undo): - **Option A — synthesise `<personID>@<apex>`** in each port. Cheap, but it decides the identity Listmonk's OIDC auto-provision matches on at first sign-in; get it wrong and you land exactly the failure `newslettersvc.go:228-231` warns about — the OIDC login makes a *second* Members-role account beside the pre-provisioned one. For Grist it also splits the person from the `email:"operator"`-shaped row the forward-auth header already mints (#1536's bare-id convention), leaving two Grist users for one person — and it would break `accessWithKey`'s `u.Email == personID` read-back, making the reconcile non-idempotent even once the PATCH succeeds. - **Option B — carry a real email through the port contract**: add it to the ledger and widen `ServicePort.ReconcileRole`. Honest, but it touches every port implementation and the catalogue. - **Option C — change the forward-auth/OIDC header to carry an email** so apps and reconciler agree on one key. A front-door/identity change, ADR territory (#1536). A swarm agent can act the moment that ruling lands; it should not pick for itself, which is why this is filed `confident: false`. Note also that Ben's recent option-1 ruling for #1575 (commit `8d69f1b3` — "a member reaches Grist by a PER-PERSON grant, never the `everyone` principal") is what put data-collections on this per-person path; the email key is the next question that ruling opens, not a regression of it. ## Also worth fixing alongside: the newsletters reconcile failure is invisible `internal/newslettersvc/newslettersvc.go` logs **only** its success paths (`:221`, `:249`); `ReconcileRole`/`provisionOperator` return errors bare, recording the status but never the response body (`:218`, `:246-248`). `internal/member/roles.go:345` then discards the error entirely — `owed := o.catalogue.ReconcileRole(...) != nil`. Net effect: a newsletters reconcile that HTTP-400s leaves **zero** trace in the drive's journal. The only reason this drive is diagnosable at all is that data-collections was given exactly this logging by #1575 (`datacollectionssvc.go:256-262`). Bringing newslettersvc onto that footing — log the refusal *with the response body*, Grist-style — would have named this in one command instead of a replay. Same hazard class as GOTCHAS #245. ## What is absent from the run directory - No `newsletters` reconcile line of any kind in `logs/droplet-journal.txt` (the central absence — the silent error path above). - `logs/guest-*.log` are 127-byte stubs and `logs/qemu.log` records `spawn qemu-system-x86_64 ENOENT` — expected: this is a rented droplet in payload mode (`artifacts/host.json` `payloadMode`), not a local guest VM. - `artifacts/legs.json` carries no `skip` entries and therefore no skip reasons — there is no out-of-scope declaration covering this red. - `logs/reporter-claude.err` and `logs/reporter-invoked` are empty (0 bytes). ## Reproduction The live leg needs a rented droplet, and re-proves on the next drive once a ruling lands. Both refusals are deterministic and reproducible from any founded community with an operator granted by hand before their first sign-in at either door. drive `20260918T135205Z` red at `redeploy-services`: `role posture not honest on 2 door(s) — proof-operator's role on data-collections reads "not yet applied" (org owner) — the reconcile is still owed | proof-operator's role on newsletters reads "not` evidence: `/home/dev/swarm/Matou/idss/test-results/drive-rented-services/20260918T135205Z` on matou-workstation (legs.json and whatever else the drive harvested there) — a representative screenshot is attached here if one was captured <!-- rehearsal-sig: 03347fc9985d -->
Owner

Duplicate of #1580, filed by this session six minutes earlier off the same kept droplet; the two diagnoses agree. #1580 carries the ruling this ticket asks for and is ready-for-human, because which email-shaped identity a member wears is Ben's call, not a session's. It still blocks #1547.

The "also worth fixing" half here (the invisible newsletters refusal) landed in 334f220c. Closing so no session-runner picks the identity on its own.

Duplicate of #1580, filed by this session six minutes earlier off the same kept droplet; the two diagnoses agree. #1580 carries the ruling this ticket asks for and is `ready-for-human`, because which email-shaped identity a member wears is Ben's call, not a session's. It still blocks #1547. The "also worth fixing" half here (the invisible newsletters refusal) landed in `334f220c`. Closing so no session-runner picks the identity on its own.
ben closed this issue 2026-09-18 14:39:32 +00:00
Author
Member

Session-runner attempt (ADR 0174) — no work landed, and none is owed here.

Confirmed this ticket is a duplicate of #1580 and was already closed by Ben (14:39:32Z) with a dedup close-report. Re-verified against the repo at HEAD (334f220c):

  • The ruling half is a one-way door and is Ben's — which email-shaped identity a member wears (Options A/B/C in the body) strands or duplicates accounts a later commit cannot cleanly undo. It lives on #1580 (ready-for-human), which blocks #1547. A session must not pick it; per ADR 0174 rule 2 this stays with the human. Nothing to relabel — #1580 already carries it.
  • The two-way "also worth fixing" half already landed — internal/newslettersvc/newslettersvc.go now keeps Listmonk's response body on both the role PUT (:218-222) and the operator pre-provision POST (:248-252), appends " — Listmonk said: <body>" to the error, and logs the refusal with person/role/status — Grist-parity (GOTCHAS #246). Landed in 334f220c (after this drive's commit a3977df1), so run 12's silent newsletters refusal is already diagnosable. STATUS records the run.

The only residue was tracker hygiene: this closed ticket still carried the action labels agent-working + ready-for-session, which is what re-drained it into a session. Removed both (kept priority, rehearsal-183 as provenance) so the drainer does not re-pick an already-adjudicated duplicate. Leaving it closed.

Session-runner attempt (ADR 0174) — no work landed, and none is owed here. Confirmed this ticket is a **duplicate of #1580** and was already closed by Ben (14:39:32Z) with a dedup close-report. Re-verified against the repo at `HEAD` (`334f220c`): - **The ruling half is a one-way door and is Ben's** — which email-shaped identity a member wears (Options A/B/C in the body) strands or duplicates accounts a later commit cannot cleanly undo. It lives on **#1580** (`ready-for-human`), which blocks **#1547**. A session must not pick it; per ADR 0174 rule 2 this stays with the human. Nothing to relabel — #1580 already carries it. - **The two-way "also worth fixing" half already landed** — `internal/newslettersvc/newslettersvc.go` now keeps Listmonk's response body on both the role PUT (`:218-222`) and the operator pre-provision POST (`:248-252`), appends `" — Listmonk said: <body>"` to the error, and logs the refusal with person/role/status — Grist-parity (GOTCHAS #246). Landed in `334f220c` (after this drive's commit `a3977df1`), so run 12's silent newsletters refusal is already diagnosable. STATUS records the run. The only residue was tracker hygiene: this closed ticket still carried the **action** labels `agent-working` + `ready-for-session`, which is what re-drained it into a session. Removed both (kept `priority`, `rehearsal-183` as provenance) so the drainer does not re-pick an already-adjudicated duplicate. Leaving it **closed**.
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#1581
No description provided.