Repository navigation
fix(admin): surface API validation errors on instance setup form - #10285
Closed
CoderSufiyan wants to merge 1 commit into
Closed
CoderSufiyan wants to merge 1 commit into
CoderSufiyan wants to merge 1 commit into
Conversation
Contributor
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Contributor
Author
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.
Summary
Fixes #10283. The instance setup form (
/god-mode/) never displayed validation errors returned by the API.Root cause
When setup fails, the API redirects back with:
error_codeis the numeric authentication error code (seeAUTHENTICATION_ERROR_CODESinapps/api/plane/authentication/adapter/error.py), whileerror_messageis the machine-readable constant.The form had a local
EErrorCodesenum with string values and switched onerrorCodeagainst them:errorCodeis"5160", but the enum values were"INVALID_EMAIL","USER_ALREADY_EXISTS", etc. — they can never match.INVALID_EMAILvsINVALID_ADMIN_EMAIL,USER_ALREADY_EXISTSvsADMIN_USER_ALREADY_EXIST).So
errorDataalways resolved to{ type: undefined }and nothing was rendered.Changes
EAuthErrorCodesfrom@plane/constants, whose values are the numeric codes the API actually sends. This is the same enum the admin sign-in flow already uses.error_codeagainst that enum instead of against mismatched string names.INVALID_ADMIN_EMAIL).INVALID_ADMIN_EMAILrenders inline on the email field,INVALID_ADMIN_PASSWORD/PASSWORD_TOO_WEAKrender inline on the password field, and everything else renders in the banner. Unknown codes now fall back to the API'serror_messagein the banner instead of being silently dropped.Testing
Ran in
apps/admin(afterpnpm turbo run build --filter="./packages/*"so workspace packages resolve):pnpm --filter=admin check:types— passes (only pre-existing Vite config warnings)pnpm --filter=admin check:lint— 0 errors (15 pre-existing warnings, under the configured limit)pnpm --filter=admin check:format— cleanNo backend changes required; the API already sends both parameters.
Reviewer notes
error_messagecontains a machine-readable constant rather than prose, so I map known codes to readable copy. If you'd prefer to keep the raw value or move these strings into@plane/i18n, happy to adjust.Summary by CodeRabbit