refactor(frontend): LoginPage consumes @fuzefront/auth-ui AuthPanel - #465
Merged
Conversation
WIP checkpoint: LoginPage.tsx is now a thin adapter around AuthPanel (variant="compact" — .auth-form already supplies the card chrome). The AuthTransport wraps authAPI and reproduces the prior error-message taxonomy so AuthPanel's generic Error.message rendering shows identical wording. Page-load social-callback handling stays in LoginPage (page routing, not a panel concern). Config wiring (tsconfig/vite/vitest aliases, CI build steps) and test updates follow in subsequent commits. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session-Id: 548a2d55-e1cd-4b5e-bfc4-b6e102bf4695
Resolve @fuzefront/auth-ui from SOURCE for vite/vitest bundling+tests (mirroring identity-ui), and to its built dist/index.d.ts for the frontend type-check (mirroring identity-ui/chat-ui/i18n) — it's TSX and imports @fuzefront/design-system, so type-checking its source under the frontend's own tsc would pull a second @types/react/csstype copy. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session-Id: 548a2d55-e1cd-4b5e-bfc4-b6e102bf4695
Adds the security-client -> auth-ui build chain the frontend type-check now depends on (tsconfig resolves auth-ui to its dist/index.d.ts), plus auth-ui's own type-check + vitest run — neither package had any CI coverage before this (PR #458 wired the publish workflow but not ci.yml). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session-Id: 548a2d55-e1cd-4b5e-bfc4-b6e102bf4695
- Removes LoginPage.signup-validation.test.tsx: it asserted a confirm-password field, password-policy-gated submit, and inline email-availability check, none of which @fuzefront/auth-ui's AuthPanel (v0.1.0) implements. Reintroducing them as one-off LoginPage markup would refork logic AuthPanel is meant to own; tracked as a fast-follow against the package instead. - Adds LoginPage.auth-panel-adapter.test.tsx covering the new adapter boundary: signup submits through the transport and redirects, a rejected signup surfaces the mapped friendly error (not the raw axios message), and a social-callback mfa_required result shows the page-level notice. LoginPage.signup-route.test.tsx, LoginPage.google-signin.test.tsx, and LoginPage.submit-resilience.test.tsx are unchanged and expected to keep passing — mode-detection, the Google/credentials paths, and the login error taxonomy (reproduced in LoginPage.tsx's mapAuthError, since AuthPanel just renders Error.message as-is) are all preserved. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session-Id: 548a2d55-e1cd-4b5e-bfc4-b6e102bf4695
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
Pre-existing bug in PR #458, uncaught until now because auth-ui had no type-check step in ci.yml (only added in this PR). input.autocomplete is typed as the strict DOM `AutoFill` token union; a plain `string` param can't assign to it. Use setAttribute instead, which accepts any string and the property getter reflects regardless. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session-Id: 548a2d55-e1cd-4b5e-bfc4-b6e102bf4695
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
jsx: "react-jsx" means the React namespace import isn't needed, and noUnusedLocals (frontend/tsconfig.json) flags it as TS6133. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session-Id: 548a2d55-e1cd-4b5e-bfc4-b6e102bf4695
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
…panel # Conflicts: # frontend/src/pages/LoginPage.tsx
Contributor
Automated code review (gate-code-review)Credit balance is too low Report-only — this check never blocks merge. |
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
frontend/src/pages/LoginPage.tsxis now a thin adapter around@fuzefront/auth-ui'sAuthPanel(variant="compact"—.auth-formalready supplies the card chrome, sovariant="full"'sCenteredCardwould nest a card inside a card).LoginPage.tsxnow lives once inAuthPanel(packages/auth-ui).AuthTransportwraps the existingauthAPI(login→authAPI.login,signup→authAPI.signup,getAuthMethods→authAPI.getAuthMethods,startSocial→authAPI.startSocialLogin).login/signupreproduce the prior inline catch block's error-message taxonomy (timeout / 503 provider-outage / 401 rejected-credentials / network / 500 / fallback) via amapAuthErrorhelper, so AuthPanel — which just rendersError.messageas-is — shows identical wording to before.authAPI.handleAuthCallback()on mount, for the OAuth?code=/?error=redirect back to the app) stays inLoginPage— that's page-load routing, not a panel concern — and renders its ownAlertaboveAuthPanel(AuthPanel has no prop to surface an externally-sourced result).useLanguage()/t(...)(only the mode-toggle strings were ever translated on this page; the heading/subtitle were always literal English, which is exactly AuthPanel's default copy).@fuzefront/auth-uiinto the frontend host exactly like@fuzefront/identity-ui: source alias invite.config.ts/vitest.config.ts,dist/index.d.tsintsconfig.json(it's TSX and imports@fuzefront/design-system, so type-checking its source under the frontend's owntscwould pull a second@types/react/csstypecopy). Added the CI build chain this requires (@fuzefront/security-client→@fuzefront/auth-uid.ts, before the frontend type-check) plusauth-ui's own type-check + vitest run, since neither existed inci.ymlbefore this PR (PR feat(auth-ui): reusable AuthPanel (React + vanilla) + alias-publish #458 wired the publish workflow but notci.yml).Known gap (not fixed in this PR)
@fuzefront/auth-ui'sAuthPanel(v0.1.0) does not yet implement three things the pre-refactorLoginPagehad on signup:These are UI capabilities the reusable component doesn't yet expose. Reintroducing them as one-off
LoginPagemarkup would refork logicAuthPanelis meant to own, so they're dropped from this page rather than duplicated — tracked as a fast-follow against@fuzefront/auth-ui(a background task suggestion has been filed for this). The "still working…" hint shown during a slow submit is also gone for the same reason (no test covered it).LoginPage.signup-validation.test.tsxasserted exactly those three behaviors and has been removed;LoginPage.auth-panel-adapter.test.tsxwas added to cover the new adapter boundary (signup submits through the transport and redirects; a rejected signup shows the mapped friendly error, not the raw axios message; a social-callbackmfa_requiredresult shows the page-level notice).Verified vs. not
frontendis not a root npm workspace (its ownnode_modules, scoped@fuzefront:registryrequiring a GitHub Packages token) and this Windows host hit an unrelated npm/npx bin-linking issue building@fuzefront/security-client/@fuzefront/auth-uilocally (tsup/openapi-typescriptbins not resolving) — consistent with this repo's documented Windows-local-build limitation. Rootnpm ci(workspaces only) succeeded locally.type-check, frontendnpm test(including the new/updatedLoginPage.*.test.tsxfiles),auth-uitype-check+npm test, and the frontendvite build. Will report back oncegh pr checksis green.LoginPage.signup-route.test.tsx,LoginPage.google-signin.test.tsx, andLoginPage.submit-resilience.test.tsxare unchanged and expected to keep passing — mode-detection, the Google/credentials sign-in paths, and the login error taxonomy are all preserved by the adapter.Test plan
lint-and-test: frontend type-check +npm testgreenauth-uitype-check + vitest greenbuild: frontendvite buildgreengate-ds-conformance/ workspace-deps-check green (no hard-coded design values introduced;@fuzefront/auth-uiresolves from source/workspace, not a registry semver)🤖 Generated with Claude Code