Estimate: 50m · Depends on: 6.10.4
Lock the org tier with tests over a real Postgres (the project convention; the only allowed vi.mock is getSession()). Exercise the model, the gating, and the backfill for real.
The model + repositories (6.10.3):
OrganizationMembership create/read round-trips; the (organizationId, userId) uniqueness holds; the Workspace.organizationId relation resolves both ways.tx (a compile-time guarantee; assert the create runs inside a transaction).The access gating (6.10.4):
MemberRole); an org MEMBER falls back to their per-workspace role.OrganizationMembership row appears); adding a user to the ORG creates NO workspace membership (assert an org-only member reaches zero workspaces until explicitly added); removing from the org revokes all workspace access while removing from a workspace leaves the org membership intact.The backfill (6.10.3):
organizationId; re-running the backfill is idempotent (no duplicates).getSession() mocked); the gating + backfill + pagination are exercised for real, not asserted on mocks.motir-core/CLAUDE.md § coverage); the empty-input / no-membership / idempotent-backfill guards each have a direct test (a new repo method’s empty-input branch needs its own assertion or the gate fails).motir-core/CLAUDE.md § tests-use-real-Postgres + § coverage gate.motir-core/tests/helpers/db.ts — the per-test truncation helper the suite runs over.