#589 — invite-member leg's occ user:info check runs before the member's first OIDC login, but Nextcloud accounts JIT-provision at sign-in #684

Closed
opened 2026-08-23 03:18:27 +00:00 by matou-build-agent · 2 comments

Failure

Red leg invite-member (drive 20260823T030519Z, signature 1dc3e7a84786):

occIt user:info e2e-member exited 1: Warning: Permanently added '134.199.162.140' (ED25519) to the list of known hosts.

(the ssh client's host-key banner is all that's in stderr; the actual occ error text — probably "User does not exist" — went to stdout, which journey.droplet.spec.ts:690 doesn't capture into the thrown error. Worth also fixing the error message to include stdout while this is being fixed.)

Evidence

  • app/tests/e2e/journey.droplet.spec.ts:650-687: the invite-member leg by-hand-creates a komiti + member over the control-plane API, then IMMEDIATELY runs nextcloud-occ user:info e2e-member --output=json over ssh (:683-687) — before the member ever signs in (oidcSignInAsMember doesn't run until :723).
  • logs/droplet-journal.txt (run dir, tail): at 03:15:19 kanidmd creates the e2e-member person, the komiti_e2e-crew group, sets the credential, and appends the group membership — all kanidm-side, no Nextcloud/PHP-FPM activity around it. The occ user:info ssh session opens a second later and its systemd unit (run-p9240-i9241.service) exits status 1.
  • internal/member/byhand.go:71-82: CreateByHand only calls o.accounts.CreatePerson (the kanidm idp port) — it never touches Nextcloud.
  • internal/nextcloud/nextcloud.go:30-38 + internal/memberorbit/memberorbit.go:128-150 (ServicePort interface): there is no create/provision verb for Nextcloud accounts anywhere in the codebase — Nextcloud's user_oidc is the only thing that ever creates a local user row, and it does so at OIDC token exchange (JIT provisioning), not at kanidm-side person creation.
  • docs/adr/0179-design-komiti-materialise-as-nextcloud-groups-via-runtime-claim-maps.md: komiti reach Nextcloud only via the ocgroups OIDC claim at login; its own closing line says this materialization "needs...working on a real gateway anyway" — i.e. it was never live-proven before this drive.
  • The leg's own comment block (journey.droplet.spec.ts:626-647) explicitly argues occ should work "before the member ever signs in...independent of anything the browser later renders" — a design assumption this run's evidence now contradicts.
  • Commit 3ca0578c ("#589 wire the invite-member e2e leg") that authored this leg says explicitly: "Not live-proven...this session's bound could not also absorb the 1-2+ hour live founding drive." This is that leg's first live run.

Suspected layer

Test design (app/tests/e2e/journey.droplet.spec.ts), resting on a materialization-timing assumption that conflicts with the JIT-provisioning architecture (ADR 0179, internal/nextcloud/nextcloud.go). Not a selector/constant slip — the occ assertion is checking the wrong system at the wrong time.

What plugging it needs (a design call, not mine to make)

One of:

  1. Move the occ user:info display-name/komiti assertion to after oidcSignInAsMember (:723) once the account has JIT-provisioned — but then it's no longer proving the by-hand-create + komiti chain independent of the browser, which was the leg's explicit point.
  2. Assert the pre-login kanidm-side materialization (person + group membership) through kanidm's own API/CLI instead of Nextcloud's occ, keeping the pre-login assertion but pointing it at the system that's actually populated at that point.
  3. Make CreateByHand (internal/member/byhand.go) eagerly provision the Nextcloud account too, so occ genuinely has something to read pre-login — a behavior change to production code, not just the test.

Also worth fixing while here: journey.droplet.spec.ts:689-691 only surfaces info.stderr in the thrown error; occ's real diagnostic text is very likely on stdout and got swallowed, which is why the evidence signature is just the ssh host-key banner instead of the actual occ complaint.

drive 20260823T030519Z red at invite-member: occ user:info e2e-member exited 1: Warning: Permanently added '134.199.162.140' (ED25519) to the list of known hosts.
evidence: test-results/…/20260823T030519Z/ on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596)

## Failure Red leg `invite-member` (drive `20260823T030519Z`, signature `1dc3e7a84786`): ``` occIt user:info e2e-member exited 1: Warning: Permanently added '134.199.162.140' (ED25519) to the list of known hosts. ``` (the ssh client's host-key banner is all that's in `stderr`; the actual occ error text — probably "User does not exist" — went to stdout, which `journey.droplet.spec.ts:690` doesn't capture into the thrown error. Worth also fixing the error message to include stdout while this is being fixed.) ## Evidence - `app/tests/e2e/journey.droplet.spec.ts:650-687`: the `invite-member` leg by-hand-creates a komiti + member over the control-plane API, then IMMEDIATELY runs `nextcloud-occ user:info e2e-member --output=json` over ssh (`:683-687`) — **before** the member ever signs in (`oidcSignInAsMember` doesn't run until `:723`). - `logs/droplet-journal.txt` (run dir, tail): at `03:15:19` kanidmd creates the `e2e-member` person, the `komiti_e2e-crew` group, sets the credential, and appends the group membership — all kanidm-side, no Nextcloud/PHP-FPM activity around it. The `occ user:info` ssh session opens a second later and its systemd unit (`run-p9240-i9241.service`) exits status 1. - `internal/member/byhand.go:71-82`: `CreateByHand` only calls `o.accounts.CreatePerson` (the kanidm `idp` port) — it never touches Nextcloud. - `internal/nextcloud/nextcloud.go:30-38` + `internal/memberorbit/memberorbit.go:128-150` (`ServicePort` interface): there is no create/provision verb for Nextcloud accounts anywhere in the codebase — Nextcloud's `user_oidc` is the only thing that ever creates a local user row, and it does so at OIDC token exchange (JIT provisioning), not at kanidm-side person creation. - `docs/adr/0179-design-komiti-materialise-as-nextcloud-groups-via-runtime-claim-maps.md`: komiti reach Nextcloud only via the `ocgroups` OIDC claim at login; its own closing line says this materialization "needs...working on a real gateway anyway" — i.e. it was never live-proven before this drive. - The leg's own comment block (`journey.droplet.spec.ts:626-647`) explicitly argues occ should work "before the member ever signs in...independent of anything the browser later renders" — a design assumption this run's evidence now contradicts. - Commit `3ca0578c` ("#589 wire the invite-member e2e leg") that authored this leg says explicitly: "Not live-proven...this session's bound could not also absorb the 1-2+ hour live founding drive." This is that leg's first live run. ## Suspected layer Test design (`app/tests/e2e/journey.droplet.spec.ts`), resting on a materialization-timing assumption that conflicts with the JIT-provisioning architecture (`ADR 0179`, `internal/nextcloud/nextcloud.go`). Not a selector/constant slip — the occ assertion is checking the wrong system at the wrong time. ## What plugging it needs (a design call, not mine to make) One of: 1. Move the `occ user:info` display-name/komiti assertion to after `oidcSignInAsMember` (:723) once the account has JIT-provisioned — but then it's no longer proving the by-hand-create + komiti chain independent of the browser, which was the leg's explicit point. 2. Assert the pre-login kanidm-side materialization (person + group membership) through kanidm's own API/CLI instead of Nextcloud's occ, keeping the pre-login assertion but pointing it at the system that's actually populated at that point. 3. Make `CreateByHand` (`internal/member/byhand.go`) eagerly provision the Nextcloud account too, so occ genuinely has something to read pre-login — a behavior change to production code, not just the test. Also worth fixing while here: `journey.droplet.spec.ts:689-691` only surfaces `info.stderr` in the thrown error; occ's real diagnostic text is very likely on stdout and got swallowed, which is why the evidence signature is just the ssh host-key banner instead of the actual occ complaint. drive `20260823T030519Z` red at `invite-member`: `occ user:info e2e-member exited 1: Warning: Permanently added '134.199.162.140' (ED25519) to the list of known hosts.` evidence: `test-results/…/20260823T030519Z/` on matou-workstation (legs.json, droplet-journal.txt, trace) — a representative screenshot is attached here if one was captured (#596) <!-- rehearsal-sig: 1dc3e7a84786 -->
Author
Member

Ruled by agent under ADR 0174 — veto anytime.

Ruling: option 2 (assert the pre-login kanidm-side materialisation instead of Nextcloud's occ), adapted to an existing control-plane read rather than a new SSH+kanidm-CLI probe.

Root cause confirmed as diagnosed: internal/member/byhand.go's CreateByHand only calls o.accounts.CreatePerson (kanidm, via the IdP port) — it never touches Nextcloud. Nextcloud's user_oidc creates its local user row only at OIDC token exchange (JIT provisioning, ADR 0179), so the leg's pre-login occ user:info call always had nothing to read.

Why option 2, not 1 or 3:

  • Option 1 (move the assertion after oidcSignInAsMember) was rejected — it would stop proving the by-hand-create + komiti chain independent of the browser, which is the leg's whole point (its own comment block says so).
  • Option 3 (make CreateByHand eagerly provision Nextcloud) is a production behavior change that contradicts the JIT-provisioning architecture ADR 0179 deliberately chose, and ADR 0179 was itself an accepted design ruling — reopening it isn't a call to make inside a red-leg fix.
  • Option 2 keeps the assertion pre-login and keeps it independent of the browser, just points it at the system actually populated at that point.

Implementation: rather than a new SSH+kanidm-CLI probe, the leg now calls GET /api/v1/members/{id}/detail (app/tests/e2e/journey.droplet.spec.ts:680-704) — the same control-plane read the P6-S4 member-detail screen renders (internal/member/detail.go's MemberDetail), which reads display name + komiti straight through the IdP port to kanidm. This is test-only: no production code changed. It reuses the same direct-to-portal precedent this leg already uses for creation (dash.request over the control plane's ungated /api/v1 mux).

Proof:

  • Two-way door: a single test-file edit, revertible with git revert a7b433d4.
  • internal/member/detail_test.go's TestMemberDetail_ShowsRoleKomitiAccessKaitiakiAndActions already proves Detail.Name/Detail.Komiti populate correctly from the IdP alone (no Nextcloud involved) — the exact pre-login path CreateByHand uses.
  • go test ./internal/member/... ./internal/controlapi/... passes.
  • npx tsc --noEmit over the e2e test package shows no new errors.
  • Not yet live-proven — the actual invite-member leg needs a real droplet drive to exercise this. I did not run one this session: the standing executor's REHEARSAL_DRIVE_ISSUE env var currently points at #657 (closed), not the open standing drive #652, so the automatic drive loop is not currently ticking this forward — filed as a separate follow-up, out of scope for this ticket (rule 1). A manual live founding drive is 1-2+ hours, the same bound the leg's own authoring commit (3ca0578c) already noted a single session can't safely absorb alongside everything else. Next live drive that reaches invite-member is the actual proof; if this ruling is wrong, the reporter will file a fresh signature ticket (dedup only matches open issues), same as any other gap-ticket fix in this repo.

Commit: a7b433d4 — "#684 — invite-member's pre-login assertion reads kanidm, not occ". STATUS.md lead updated in the same commit.

Ruled by agent under ADR 0174 — veto anytime. **Ruling: option 2** (assert the pre-login kanidm-side materialisation instead of Nextcloud's occ), adapted to an existing control-plane read rather than a new SSH+kanidm-CLI probe. Root cause confirmed as diagnosed: `internal/member/byhand.go`'s `CreateByHand` only calls `o.accounts.CreatePerson` (kanidm, via the IdP port) — it never touches Nextcloud. Nextcloud's `user_oidc` creates its local user row only at OIDC token exchange (JIT provisioning, ADR 0179), so the leg's pre-login `occ user:info` call always had nothing to read. Why option 2, not 1 or 3: - Option 1 (move the assertion after `oidcSignInAsMember`) was rejected — it would stop proving the by-hand-create + komiti chain independent of the browser, which is the leg's whole point (its own comment block says so). - Option 3 (make `CreateByHand` eagerly provision Nextcloud) is a production behavior change that contradicts the JIT-provisioning architecture ADR 0179 deliberately chose, and ADR 0179 was itself an accepted design ruling — reopening it isn't a call to make inside a red-leg fix. - Option 2 keeps the assertion pre-login and keeps it independent of the browser, just points it at the system actually populated at that point. Implementation: rather than a new SSH+kanidm-CLI probe, the leg now calls `GET /api/v1/members/{id}/detail` (`app/tests/e2e/journey.droplet.spec.ts:680-704`) — the same control-plane read the P6-S4 member-detail screen renders (`internal/member/detail.go`'s `MemberDetail`), which reads display name + komiti straight through the IdP port to kanidm. This is test-only: no production code changed. It reuses the same direct-to-portal precedent this leg already uses for creation (`dash.request` over the control plane's ungated `/api/v1` mux). Proof: - Two-way door: a single test-file edit, revertible with `git revert a7b433d4`. - `internal/member/detail_test.go`'s `TestMemberDetail_ShowsRoleKomitiAccessKaitiakiAndActions` already proves `Detail.Name`/`Detail.Komiti` populate correctly from the IdP alone (no Nextcloud involved) — the exact pre-login path `CreateByHand` uses. - `go test ./internal/member/... ./internal/controlapi/...` passes. - `npx tsc --noEmit` over the e2e test package shows no new errors. - **Not yet live-proven** — the actual `invite-member` leg needs a real droplet drive to exercise this. I did not run one this session: the standing executor's `REHEARSAL_DRIVE_ISSUE` env var currently points at #657 (closed), not the open standing drive #652, so the automatic drive loop is not currently ticking this forward — filed as a separate follow-up, out of scope for this ticket (rule 1). A manual live founding drive is 1-2+ hours, the same bound the leg's own authoring commit (`3ca0578c`) already noted a single session can't safely absorb alongside everything else. Next live drive that reaches `invite-member` is the actual proof; if this ruling is wrong, the reporter will file a fresh signature ticket (dedup only matches open issues), same as any other gap-ticket fix in this repo. Commit: `a7b433d4` — "#684 — invite-member's pre-login assertion reads kanidm, not occ". STATUS.md lead updated in the same commit.
Author
Member

Close report.

Landed: a7b433d4 — "#684 — invite-member's pre-login assertion reads kanidm, not occ" (app/tests/e2e/journey.droplet.spec.ts, STATUS.md). Pushed to origin/main.

What changed: the invite-member leg's pre-login materialisation check no longer calls nextcloud-occ user:info over SSH (which was reading Nextcloud before its JIT-provisioned user row exists, ADR 0179). It now calls GET /api/v1/members/{id}/detail over the same ungated control-plane API the leg already uses for creation — a read that goes straight through the IdP port to kanidm, populated synchronously by CreateByHand. The leg's point (by-hand-create + komiti chain proven independent of the browser) is preserved.

Design ruling and rationale: posted separately above under ADR 0174.

Proof: existing unit coverage (TestMemberDetail_ShowsRoleKomitiAccessKaitiakiAndActions) plus go test/tsc sanity — not yet live-proven against a real droplet drive (see the ruling comment for why, and #685 filed as the follow-up blocking automatic re-verification: the standing executor currently watches a closed issue, #657, instead of the open standing drive #652).

Also noted, not separately fixed: the stdout-swallowing bug in the old error path (journey.droplet.spec.ts:689-691 in the pre-fix version) is moot — that code path is deleted along with the occ call it wrapped. The branded-chrome leg's own occ call (a different leg, working leg, out of scope here) still only surfaces stderr; not touched.

Closing — the fix is a genuine two-way door (test-only, revertible), backed by existing test proof and direct code reading of the exact system it now reads. If the live drive proves it wrong when it next reaches this leg, the reporter will file a fresh signature ticket (dedup only matches open issues).

Close report. **Landed:** `a7b433d4` — "#684 — invite-member's pre-login assertion reads kanidm, not occ" (`app/tests/e2e/journey.droplet.spec.ts`, `STATUS.md`). Pushed to `origin/main`. **What changed:** the `invite-member` leg's pre-login materialisation check no longer calls `nextcloud-occ user:info` over SSH (which was reading Nextcloud before its JIT-provisioned user row exists, ADR 0179). It now calls `GET /api/v1/members/{id}/detail` over the same ungated control-plane API the leg already uses for creation — a read that goes straight through the IdP port to kanidm, populated synchronously by `CreateByHand`. The leg's point (by-hand-create + komiti chain proven independent of the browser) is preserved. **Design ruling and rationale:** posted separately above under ADR 0174. **Proof:** existing unit coverage (`TestMemberDetail_ShowsRoleKomitiAccessKaitiakiAndActions`) plus `go test`/`tsc` sanity — not yet live-proven against a real droplet drive (see the ruling comment for why, and #685 filed as the follow-up blocking automatic re-verification: the standing executor currently watches a closed issue, #657, instead of the open standing drive #652). **Also noted, not separately fixed:** the stdout-swallowing bug in the old error path (`journey.droplet.spec.ts:689-691` in the pre-fix version) is moot — that code path is deleted along with the occ call it wrapped. The `branded-chrome` leg's own occ call (a different leg, working leg, out of scope here) still only surfaces stderr; not touched. Closing — the fix is a genuine two-way door (test-only, revertible), backed by existing test proof and direct code reading of the exact system it now reads. If the live drive proves it wrong when it next reaches this leg, the reporter will file a fresh signature ticket (dedup only matches open issues).
matou-build-agent 2026-08-23 03:30:19 +00:00
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#684
No description provided.