Files
member-console/internal/provisioning
cgalo5758 dd3962990b Adopt entity keys and add invoice numbers
Replace the entity slugs on organizations, workspaces, resource pools,
and
plan ladders with nullable `key` columns and add keys to products,
prices,
and entitlement sets. Rename `providers.slug` to `provider` and add
partial
unique indexes for system and org role names.

Assign invoice numbers per billing account from a gapless transactional
counter; Stripe's number moves to the invoice mapping as an external
reference.

Seeds, fixtures, and the operator lookup address rows by key, and the
returning-login resync no longer blanks a display name when the IdP
sends
no `name` claim.
2026-08-29 20:12:04 -05:00
..
2026-03-24 17:35:14 -05:00

Provisioning Module

The provisioning module orchestrates first-login auto-provisioning. When a user authenticates via OIDC for the first time, AutoProvision creates all governance and resource structures within a single database transaction:

  1. User — identity record linked to the OIDC subject
  2. Person — profile record (display name, email)
  3. Organization — personal org (org_type = 'personal')
  4. OrgMember — membership with the owner system role
  5. Workspace — default workspace within the org
  6. Role Assignment — org-scoped role assignment for the owner
  7. Resource Pool — default pool (pool_type = 'default', is_auto_managed = true)
  8. Pool Assignment — primary link between workspace and pool (is_primary = true)

If any step fails, the entire transaction rolls back — no partial structures exist.