fix(signup): report when Keycloak refuses to send the invitation #39

Merged
sharang merged 1 commits from fix/invite-mail-failure into main 2026-09-24 11:50:23 +00:00
Owner

Found in the production smoke test: signup bp-smoketest created the organization, the user and the ERP customer, but no invitation mail went out. The audit still said keycloak.invite_sent.

Cause: portal-prod allows only the auth callback as a redirect URI, so execute-actions-email?redirect_uri=…/start?invited=1 got a 400. CreateOrgAndInvite dropped that error.

  • InviteResult.MailError, with Keycloak's response body.
  • The registry logs keycloak invitation mail not sent and audits keycloak.invite_mail_failed instead of invite_sent.
  • Tests: stub KC answering 400 (the adapter still returns the org/user and sets MailError), server audit (eachStore), and a Mock.FailMail hook.

The realm fix (/start* in the redirect URIs) is in orca-platform.

🤖 Generated with Claude Code

https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB

Found in the production smoke test: signup `bp-smoketest` created the organization, the user and the ERP customer, but no invitation mail went out. The audit still said `keycloak.invite_sent`. Cause: `portal-prod` allows only the auth callback as a redirect URI, so `execute-actions-email?redirect_uri=…/start?invited=1` got a 400. `CreateOrgAndInvite` dropped that error. - `InviteResult.MailError`, with Keycloak's response body. - The registry logs `keycloak invitation mail not sent` and audits **`keycloak.invite_mail_failed`** instead of `invite_sent`. - Tests: stub KC answering 400 (the adapter still returns the org/user and sets MailError), server audit (`eachStore`), and a `Mock.FailMail` hook. The realm fix (`/start*` in the redirect URIs) is in orca-platform. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang added 1 commit 2026-09-24 10:20:18 +00:00
fix(signup): report when Keycloak refuses to send the invitation
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 23m33s
ci / image (pull_request) Skipped
51ecb9d94a
CreateOrgAndInvite swallowed a failed execute-actions-email and the
registry audited keycloak.invite_sent anyway. On production the invite
client did not allow the /start redirect, Keycloak answered 400, and
nobody could tell. The result now carries MailError (with Keycloak's
answer), the registry logs it and audits keycloak.invite_mail_failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang merged commit 7834907562 into main 2026-09-24 11:50:23 +00:00
Sign in to join this conversation.