feat(provisioning): unified user provisioning service (task 1.4, INV-02/03 + IDA-09) #56

Merged
amiryahaya merged 2 commits from feat/1.4-unified-provisioning into main 2026-11-05 13:58:44 +01:00
Owner

Closes #19 (task 1.4)

What

New UserProvisioningService: ALL invite-based registration paths route through one ProvisionInviteeAsync so the invariants hold uniformly:

  • invitation Pending + unexpired (token || short-code lookup)
  • INV-03 email binding — claimed email must match invite email, no null-skip
  • find-or-create user (wallet by DID, others by email) with suspended check
  • atomic claim via InvitationAcceptanceService (Pending WHERE-guard — no double-accept)
  • TenantId granted via ExecuteUpdate after the claim (#44-safe)

Paths rewired

Path Before After
wallet register/verify inline find-or-create ProvisionInviteeAsync (AdminDid bootstrap stays direct — no invite, ACC-03)
email+OTP register/verify inline ProvisionInviteeAsync
accept-with-wallet inline duplicate of AcceptAsync ProvisionInviteeAsync
OIDC callback registration block, TenantId gap ProvisionInviteeAsync (gap closed)

Tests

  • Fixtures bind invites to the claimed email (INV-03-conscious coupling)
  • 39 LegacyWallet tests skipped (wallet-paused decision — OIDC first)
  • Suite: 767 total, 0 failed, 39 skipped (Release)

Coverage

80.89% line coverage (≥80% gate floor)

Closes #19 (task 1.4) ## What New `UserProvisioningService`: ALL invite-based registration paths route through one `ProvisionInviteeAsync` so the invariants hold uniformly: - invitation Pending + unexpired (token || short-code lookup) - **INV-03 email binding** — claimed email must match invite email, no null-skip - find-or-create user (wallet by DID, others by email) with suspended check - atomic claim via `InvitationAcceptanceService` (Pending WHERE-guard — no double-accept) - TenantId granted via `ExecuteUpdate` after the claim (#44-safe) ## Paths rewired | Path | Before | After | |---|---|---| | wallet register/verify | inline find-or-create | ProvisionInviteeAsync (AdminDid bootstrap stays direct — no invite, ACC-03) | | email+OTP register/verify | inline | ProvisionInviteeAsync | | accept-with-wallet | inline duplicate of AcceptAsync | ProvisionInviteeAsync | | OIDC callback | registration block, TenantId gap | ProvisionInviteeAsync (gap closed) | ## Tests - Fixtures bind invites to the claimed email (INV-03-conscious coupling) - 39 LegacyWallet tests skipped (wallet-paused decision — OIDC first) - **Suite: 767 total, 0 failed, 39 skipped (Release)** ## Coverage 80.89% line coverage (≥80% gate floor)
feat(provisioning): unified user provisioning service — 4 paths, 1 set of invariants (task 1.4, INV-02/03 + IDA-09)
All checks were successful
API CI / build-and-test (pull_request) Successful in 35m59s
ec82776a3d
New UserProvisioningService: ALL invite-based registration paths (wallet,
email+OTP, accept-with-wallet, OIDC) route through one ProvisionInviteeAsync
enforcing uniform invariants:
- invitation Pending + unexpired (token || short code lookup)
- INV-03 email binding (claimed email must match invite email — no null-skip)
- find-or-create user (wallet by DID, others by email) with suspended check
- atomic claim via InvitationAcceptanceService (Pending WHERE-guard)
- TenantId granted via ExecuteUpdate after the claim (#44-safe)

Paths rewired:
- RegisterVerify: wallet new-user → ProvisionInviteeAsync; AdminDid
  bootstrap stays direct (no invite, ACC-03)
- EmailRegisterVerify: post-OTP → ProvisionInviteeAsync
- AcceptWithWallet: ProvisionInviteeAsync replaces inline find-or-create +
  duplicate claim block
- OidcCallback: registration-block → ProvisionInviteeAsync (closes the
  TenantId gap where OIDC signups landed in no workspace)

Tests: fixtures bind invites to the claimed email (INV-03 conscious
coupling); 39 LegacyWallet tests skipped under the wallet-paused decision —
suite 767 green, 0 failed, 39 skipped (Release).
fix(provisioning): ponytail-review round-1 — token-leak debug line, dead DI params, LastLoginAt (findings 1/6/7)
All checks were successful
API CI / build-and-test (pull_request) Successful in 20m25s
7e2aa03c74
- AcceptWithWallet: delete leftover [ACCEPT-WALLET-DEBUG] Console.Error
  line — it printed the raw invitation token (bearer credential) to logs
  (finding 1, must-fix)
- remove now-unused InvitationAcceptanceService params from
  EmailRegisterVerify / OidcCallback / AcceptWithWallet; drop the
  redundant invitation pre-check in EmailRegisterVerify (the service 404s
  uniformly); restore lost newline (finding 6)
- OidcCallback registration branch stamps LastLoginAt again —
  registration is the first login (finding 7)

Findings 2-5 (race catch, error propagation, case-insensitive email
lookup, shared_claims validation) → tracker follow-up issue.
Suite: 767 total / 0 failed / 39 skipped (Release).
Sign in to join this conversation.
No description provided.