roles reconciler: an operator granted BEFORE their first sign-in gets the MEMBER role at auto-provision and is never re-reconciled (Listmonk/Mattermost now; Paperless/Gramps the same shape) — land the role before first sign-in #1553
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
2 participants
Notifications
Due date
No due date set.
Blocks
Depends on
Reference
Matou/idss#1553
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?
Why (found by the session babysitting #1547, 2026-09-16, reading the landed tickets against the code)
Spec #1535 — Ben's ruling: adding an operator gives admin on ALL services. #1537's
ReconcileRoles(internal/member/roles.go:177) fans a grant out over every DEPLOYED port whose mapping isreconciler-mapped. The proof drive #1547 grants a SECOND person operator through the panel AFTER founding and then signs them into every door expecting the admin surface. Read againstmaintoday that leg is red by construction on the doors below, so the gap is filed now rather than burned on a droplet.The gap — every OIDC port whose reconcile says "no account here yet — the role applies at first sign-in"
newslettersvc.ReconcileRole(2995cd3e),chatsvc.ReconcileRole(2c0a18af) andcodesvc.ReconcileRole(fa74a1d5) all return a truthful no-op when the person has no account in the app yet. But nothing applies the role at first sign-in: the app auto-provisions the account at the MEMBER role (Listmonkdefault_user_role= Members; Mattermostsystem_user) and no later event re-runs the reconcile — the no-op returned nil, so the member record'sRoleReconciletail is clear and P6-S4 reads the role as applied. Result: an operator granted BEFORE their first visit to the app is a member there forever (until an unrelated grant/deploy re-fans). Forgejo alone is covered by its OIDCgroups→admin claim (#1542's first belt). #1538 (Paperless) and #1539 (Gramps Web) are landing on the same shape — the fix must cover them too, which is why this waits on them.Build — the role lands BEFORE first sign-in
For each OIDC port,
ReconcileRoleprovisions when absent instead of returning nil: create the account the OIDC sign-in will match (ListmonkPOST /api/users{username, email?, type: "user", user_role_id, password_login: false}; MattermostPOST /api/v4/userswithauth_service/auth_databound to the OIDC identity, then roles; PaperlessPOST /api/users/{username, is_superuser, is_staff}; Gramps WebPOST /api/users/with the role) — so the app's auto-provision finds the row and the role is already right. Where an app genuinely cannot pre-bind an OIDC identity, the honest alternative is a first-sign-in hook: the gate's allow (authgate.go) for a person the ledger marks operator whose per-app role is not yet applied triggersReconcileRoles(person); either way the no-account case must NEVER read as applied on P6-S4 — set the outstanding tail when the role could not land.Acceptance
operator-newsletters→/api/settings200 for the granted operator who signs in for the FIRST time in that leg;operator-document-archive,operator-whakapapalikewise).swarm-claim host=elitebook-distributed-server-03 run=25440
(automated multi-host claim — lowest live claim id works this ticket)
Ruled by agent under ADR 0174 — veto anytime (two-way door)
The ticket offered two branches per port ("account created at the operator role or outstanding named"). I ruled the branch per port by whether the app can pre-bind an OIDC identity before first sign-in — revertible, and proved by each port's contract test against its faithful API double:
ReconcileRolenow creates the account at the operator role when absent (ListmonkPOST /api/users {username,type:"user",user_role_id:<Super Admin>,password_login:false}; PaperlessPOST /api/users/ {username,is_superuser:true,is_staff:true}). Both are username-keyed, so the OIDC auto-provision matches the row on first sign-in — the Grist #1551 shape. The operator is admin the instant they land; the live proof (#1547) rides these.ReconcileRolereturns the newErrReconcileNeedsFirstSignIn, folded ontoMember.RoleReconcileas "not yet applied on chat" (the surveys #1552ErrReconcileNeedsDeployposture) — so P6-S4 never reads it as applied;system_adminlands on the next reconcile once first sign-in has auto-provisioned the account. Mattermost is not in the ticket's live-proof list.groups→admin, #1542; Grampsroles→OWNER, front-door-only, #1539). The kanidm operators-group membershipReconcileRoles' foundational half sets at grant time rides that claim into the app. (Gramps landed as claim-native, not the reconciler shape this ticket anticipated, so it is covered by construction like Forgejo.)The hot-path first-sign-in hook the ticket floats as an alternative was NOT taken.
FirstLoginruns on every authenticated gate pass; a fullReconcileRolesthere would hit the IdP (its foundational kanidm half) on every request, and surveys' permanent-outstanding tail (ErrReconcileNeedsDeploy) would never clear, so the fan-out would fire per request forever — a per-request regression. The pre-provision + outstanding-named branches carry the fix instead.Two-way: reverting the three port changes restores the prior no-op. Proved offline —
go build ./... && go vet ./...clean,go test ./internal/{newslettersvc,documentarchivesvc,chatsvc,member,memberorbit}/green (full pre-push gate + golangci-lint + broker passed on push). Live proof deferred to #1547.close-report for #1553 — status
success⛔ close-report gates REFUSED this close — the following claims did not verify:
0bc96e1db6is not reachable from origin/main (not landed)envelope
close-report for #1553 — status
success✅ close-report gates passed — every claim verified against main; issue closed.
envelope