First signup creates the first tenant; later signups join - #702
Merged
TheGreatAxios merged 5 commits intoSep 10, 2026
Merged
Conversation
TheGreatAxios
deleted the
cl-7578-first-signup-is-superadmin-first-tenant-not-a-cli
branch
September 10, 2026 13:20
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linear: CL-7578
Summary
0→1 is now first signup, not boot. On an empty hub, the first OAuth/email signup mints the first tenant via native
POST /api/tenantsand its native owner grant is the superadmin — no Workbench admin table. Every later signup joins that root tenant as a read-only member and never mints a tenant or a Myra.genesisOrJoinHubSignup(packages/onboarding/src/genesis.ts): existing-member → gated join → needs-onboarding → genesis. Slug-conflict 409 re-reads the root and joins. Signup never seeds (seeded: falsealways).apps/hub/src/signup-tenancy.ts: native join viacreatePrincipalStore+principalRole(mirrorsaddWorkbenchMember), idempotent.signup_not_allowed— an operator-removed member cannot self-rejoin. Genesis waives onlysignup_closed; email-verified and domain rules still bind the first user.users>1 && tenants===0can no longer wedge a hub.existing-member(with tenant id/slug) so read-only members never land in the owner-only onboarding wizard.skipEnsureDefaultTenantseam onHubConfig:ensureDefaultTenant,runSystemSeed, and the env-credential plant still run — their removal is CL-7580/7576/7579.POST /api/tenantsis allowed at zero tenants.Test plan
bun test packages/onboarding/test/genesis.test.ts packages/onboarding/test/provision.test.ts(23 pass)bun test apps/hub/test/signup-genesis.test.ts(3 pass, real Postgres: genesis 1 user/1 tenant/owner; join 1 tenant/member; removed member 403)bun test scripts/e2e/{smoke-onboarding,greeting-delivery,local-rip}.test.ts(3 pass, real Postgres)bun run checkexit 0 (pre-push hook + CI)