fix/pms-241-fmt-bunyip-org-tenant #176
Loading…
Reference in a new issue
No description provided.
Delete branch "david/fix/pms-241-fmt-bunyip-org-tenant"
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?
bunyip_org_idclaim and resolves it to a dedicated mokosh tenant, auto-provisioning one on first login of a new org.Design (per the agreed contract): Bunyip emits an org id, mokosh maps it to a tenant via a new nullable
tenants.bunyip_org_idcolumn (partial unique index, so legacy tenants stay NULL while each org maps to exactly one tenant).TenantService::ensure_tenant_for_bunyip_orgdoes select-or-provision: on first sight it inserts anorg-kind tenantON CONFLICT (bunyip_org_id) DO NOTHING(concurrent first-logins converge on one tenant - the race loser re-reads the winner), initialises the ticket/invoice sequences, and runscopy_default_configso statuses/priorities/queues/SLA + notification templates exist out of the box. The SSO user is JIT-mirrored into the resolved tenant as before.Forward-compatible and inert until Bunyip ships the claim:
AtClaims.bunyip_org_idis#[serde(default)], so current tokens deserialize it toNoneand fall back todefault_bunyip_tenant_id()- byte-for-byte the pre-PMS-240 behaviour. The tenant service is threaded intoAuthMiddlewareviawith_tenants; when it (or the claim) is absent the default-tenant fallback is used. A failed org→tenant resolution drops the bunyip path rather than landing the user in the wrong tenant.Security: the claim rides the already-verified Bunyip at+jwt (iss/aud/signature checked by
BunyipVerifier), so it is as authoritative assub/bunyip_role.Out of scope (follow-ups): the Bunyip side must actually emit
bunyip_org_id; backfilling users already mirrored into the default tenant; and a human-facing tenant name/slug (auto-provisioned tenants getOrg <id>+ a uuid-derived slug, renamable later).Verification:
cargo check --all-targets+cargo clippy --all-targetsclean;tests/tenants.rsaddsensure_tenant_for_bunyip_org_provisions_then_is_idempotent(provision -> same-org idempotent -> distinct-org distinct -> default config copied), full tenants suite (6) and auth suite (14) green.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
cargo fmt --checkstep failed on the feat/mapps-240-bunyip-org-tenant branch (PR #175, run #845): thewith_tenantsbuilder signature in src/modules/auth/middleware.rs was spread across multiple lines and rustfmt wanted it collapsed to one. Rancargo fmt --all; only that signature changed.#PMS-241
Closing as redundant. Despite the description leading with the PMS-240 feature, the only commit ahead of
mainhere is366a1fb(style(auth): cargo fmt the with_tenants signature, PMS-241), and its entire diff collapses thewith_tenantssignature insrc/modules/auth/middleware.rsfrom four lines to one.mainalready has that signature on one line (identical), and the PMS-240 feature itself is already inmainvia PR #175 (commit6b8ed51, this PR's merge-base).The merge conflict is a single stale doc comment, not code: this PR's comment describes the PMS-240
bunyip_org_idclaim design, whichmainhas since superseded with the PMS-243 / PMS-244 invite + self-signup placement (/// Wire the tenant service so the bunyip path can provision a user's personal tenant on self-signup (PMS-244).). Resolving towardmain(the current truth) drops this commit to empty, so there is nothing to merge. Taking this PR's side would regress the doc comment to a removed design.It is an AGit PR with no server branch (head only at
refs/pull/176/head), so "Update Branch" was never available.Pull request closed