feat(auth): backfill default-tenant users off the shared tenant on login (PMS-245) #180
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/mapps-245-backfill-default-tenant-users"
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?
What
Closes the gap from PMS-244: existing users dumped into the shared default tenant by the pre-PMS-244 funnel (the original PMS-239 complaint) stayed there, because the resolution kept an already-placed user where they were. Only brand-new users got a personal tenant.
How
The bunyip login path now treats a user still parked in the default tenant like a fresh user: with no pending invite they are moved to their own freshly provisioned
personaltenant (reusingensure_personal_tenant+ the PMS-243rehome_user_between_tenants). Lazy migration - each user moves on their next login.usersrow moves.super_adminexempt: platform operators legitimately belong to the infra/default tenant.is_stuck_in_default(current, default_tenant, role, has_invite).find_user_tenant->find_user_placement(returns(tenant_id, role)).Verification
cargo check --all-targets+cargo clippy --all-targetsclean. Newbackfill_only_non_admin_default_tenant_users_without_inviteunit test (target case + super_admin / invite / other-tenant / new-user exemptions).auth(14),tenants(7),invitations(5) pass.Note
End-to-end (user logs in via Bunyip and is observed to move) is still PMS-249 (mocked OIDC verifier); this PR unit-tests the new decision and reuses the already-tested move primitives.
🤖 Generated with Claude Code