fix(auth): add ADMIN to Permission enum so admins can log in#984
Merged
Conversation
The backend returns the `ADMIN` permission for admin roles, but the generated Cambiatus.Enum.Permission (last regenerated 2022, #786) lacks it. Its decoder fails on unknown values, so decoding the signIn response for any admin user errored → elm-graphql returned RemoteData.Failure → the UI showed "Authentication failed", even though the backend signIn succeeded and returned a valid token. Non-admin users were unaffected. Add the `Admin` variant (type, list, decoder, toString, fromString) as a surgical unblock. The generated schema is years stale and should be fully regenerated (yarn generate-graphql) in a separate, reviewed change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
❌ Deploy Preview for cambiatus-elm-book failed.
|
lucca65
added a commit
that referenced
this pull request
Jun 17, 2026
The generated Cambiatus types were last refreshed in 2022 (#786) and had drifted from the live backend — e.g. the Permission enum was missing ADMIN, which broke signIn decoding for admin users (fixed surgically in #984; this regen supersedes that with the generated version). Regenerated with @dillonkearns/elm-graphql against the production graph endpoint (app.cambiatus.io) because staging was unreachable at the time. Changes are additive/compatible: new Object types (EncryptedMnemonicResult, Passkey*), enum and field syncs. `yarn build` compiles clean and elm-format validates. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Admin users got "Authentication failed" at login even though the backend
signInsucceeded (valid token returned). The generatedCambiatus.Enum.Permission(last regenerated 2022-07-13, #786) is missing theADMINvalue the backend now returns for admin roles. elm-graphql enum decodersDecode.failon unknown values, so decoding the signIn response for an admin profile failed →RemoteData.Failure→auth.failed.Non-admin users are unaffected (no
ADMINpermission in their payload) — which is why regular logins work after #982/#983 but admin logins didn't.Fix
Add the
Adminvariant to the Permission enum (type, list, decoder, toString, fromString). Surgical unblock;yarn buildcompiles clean (nothing pattern-matches Permission exhaustively).Follow-up
The generated schema is ~4 years stale. It should be fully regenerated (
yarn generate-graphql) in a separate, reviewed change — there may be other drifted enums/fields.🤖 Generated with Claude Code