fix(ui): improve invitation error messages#11376
Conversation
- Map invitation API errors with status, code, and detail - Preserve sign-up response status for invitation handling - Add regression coverage for invitation error mapping
|
✅ All necessary |
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
🔒 Container Security ScanImage: 📊 Vulnerability Summary
2 package(s) affected
|
- Document invitation error message fix
- Replace invitation flow literals with shared constants - Reuse a form error type constant in signup errors
alejandrobailo
left a comment
There was a problem hiding this comment.
A few things I'd like to address:
-
needsSignOut: trueis now unreachable, but the UI still renders the path. -
The Retry button loops forever for malformed tokens
-
invitation-errors.tsis domain-specific, it live under the feature
Other nits (non-blocking):
-
isInvitationTokenErrormatches the bare /data pointer, which JSON:API uses for any non-field serializer error at /users POST. Today the API ordering prevents misfires, but tightening to only /data/attributes/invitation_token would be more future-proof. -
Inside
invitation-errors.ts, INVITATION_ERROR_DETAIL/_POINTER/_CODE/_FLOW use UPPER_SNAKE keys but INVITATION_ERROR_MESSAGES uses camelCase, small consistency thing.
Thanks!
- Move invitation error mapping under the invitation feature - Remove unreachable sign-out handling from accept errors - Tighten retry and invitation-token error detection
|
Thanks for the review, addressed in Changes made:
Validation passed locally and in pre-commit: cd ui && pnpm test:unit 'app/(auth)/invitation/_lib/invitation-errors.test.ts' actions/auth/auth.test.ts
cd ui && pnpm run typecheck
cd ui && pnpm run lint:check |
Context
Jira: PROWLER-1770

Invitation links currently show generic or status-only error messages. The API already returns distinct HTTP statuses and JSON:API error codes/details for expired, invalid, and missing invitation tokens.
Description
This PR updates the UI invitation flows to display specific invitation-link errors based on API response status, code, and detail instead of relying on an invitation state field.
/dataand/data/attributes/invitation_tokenJSON:API pointers for sign-up invitation errorsSteps to review
ui/lib/invitation-errors.ts.410+token_expired→ expired invitation400+invalid+This invitation is no longer valid.→ no longer valid invitation404+not_found→ invitation not valid400+invalidinvitation-token error → invitation not validinvalid→ generic invalid fallbackChecklist
Community Checklist
SDK/CLI
UI
API
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.