feat(accounts): UserStatus.Pending + workspace gating (task 1.1, ACC-01…04) #53
No reviewers
Labels
No labels
epic
phase-0
phase-1
phase-2
phase-3
phase-4
phase-5
phase-6
phase-7
phase-8
phase-9
priority/P0
priority/P1
priority/P2
type/backend
type/client
type/docs
type/ops
type/security
type/spike
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
primatekuntech/failsulit!53
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/1.1-user-status-gating"
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?
Phase 1 feature work begins. Task 1.1 adds the account-lifecycle gating that the org-request flow (tasks 1.2/1.3) builds on.
Behavior (SRS ACC-01…04)
UserStatus.Pending— org founders awaiting system-admin approvalTests (TDD §2.1)
UserStatusGatingTests(7) +AdminDidRegistrationTests(1) written first — red at 6 failures, green after implementation. Two latent bugs found and fixed during green: FK-ordering in the SuperAdmin bootstrap tenant flow + the #44-class AsNoTracking mutation in GetRootFolder.Verification
754/754 ×3 (Release); pre-push hook green incl. coverage gate (83.40% ≥ 80).
Closes #16 (task 1.1). Also closes #10 (0.2 PRF deferred to Phase 2 E2E per decision — rationale on the issue).
ponytail-review (§2.4 AI first-pass) — Verdict: Ship.
What this change does: introduces the Pending account state and blocks tenant-scoped file APIs for Pending/no-workspace users at the single middleware choke point (SsdidAuthMiddleware), with an account-level allowlist; removes the Personal auto-tenant creation from both bootstrap paths (GetRootFolder kept for SuperAdmin console convenience).
Checked: gate placement is AFTER suspended-check and BEFORE MFA-pending handling (correct precedence — pending is orthogonal to mfa); allowlist covers all account-level endpoints a founder needs (me/org-requests/invitations/recovery/account/credentials/devices/auth/health); IsTenantScoped prefix list matches the file-family route groups (folders/files/shares/activity) — notifications/users/tenants/devices intentionally NOT gated (downstream membership checks handle those, per ACC-01 'file/share APIs' wording); SuperAdmin exemption keyed on SystemRole (never user-input); the ExecuteUpdate tenant-provisioning now saves the tenant BEFORE the user FK update (bug found during green); no prod secrets touched.
Notes (not blocking): the 403 problem bodies use the bare codes (org_approval_pending / no_workspace) as detail — the SRS acceptance asserts those exact strings ✓; a later pass can add typed problem codes via AppError for consistency with handler-shaped errors.
Not checked: real-browser Login v2 rendering of the pending/no-workspace states (Phase 2 E2E); Postgres parity for the enum string-mapping (string-mapped, no migration needed).