Move auth flow out of Login.svelte component#181
Draft
rendall wants to merge 105 commits into
Draft
Conversation
added 30 commits
April 15, 2026 11:01
…entation checklist
…nd lifecycle contract
… contract in auth service
…erification and state handling
… contract in auth service
…asks and implementation details
…hip and future tasks
…lists to 'completed' and document completion findings in the planning file
…Login.svelte as identified and draft slice for signup() command ownership in auth-service
…eateUser functionality and error handling
…istration and authentication flow
added 29 commits
April 28, 2026 14:21
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
This PR completes Priority 5: the frontend auth-service extraction and cleanup.
The main outcome is that auth behavior now lives behind a widget-scoped
authService, while Svelte components receive explicitauthServiceandcurrentUserprops instead of coordinating through the old global relay stores.What Changed
src/lib/auth-service.tsas the frontend auth command/runtime boundary.auth-servicefor initial verification, login, logout, signup, guest login, guest profile update, auth request/outcome handling, and persistence integration.src/lib/auth-persistence.tssosimple_comment_usersession/guest persistence is no longer owned byLogin.svelte.Login.svelteto delegate auth commands toauthServicewhile keeping form-local validation, status rendering, selected-tab UI, andsimple_comment_login_tabpersistence local to the component.CommentInput.svelteto request login throughauthServiceinstead ofdispatchableStore/loginStateStorerelay events.SelfDisplay.svelteto observe logout availability fromauthServiceand callauthService.logout()directly.SimpleComment.svelteas the composition root that creates the widget-scopedauthService, subscribes toauthService.currentUser, and passes explicit props down to auth-aware children.src/lib/auth-store-bridge.tsandsrc/lib/svelte-stores.ts.docs/archive/Priority5Completion.md.Architecture Decision
Priority 5 intentionally stops at a narrow, explicit architecture:
auth-service.tsowns auth behavior and auth runtime state.SimpleComment.svelteowns widget composition and the top-levelcurrentUsersubscription.authServiceexplicitly.currentUserexplicitly.AuthRuntime.svelte, or speculative global auth store is introduced.A thin service-backed store remains a possible future option only if concrete prop-threading or shared-derived-state pressure appears later.
Why
The earlier auth path coupled login, comment submission, self display, local persistence, and runtime auth state through
Login.svelteplus global relay stores. That made incremental extraction fragile and created churn around broader architecture proposals.This PR keeps the extraction narrow and reversible: auth side effects move into
authService, while the component tree keeps explicit ownership and data flow.Validation
yarn run ci:localpassed on 2026-04-29.ci:localincludes dependency install with frozen lockfile, lint, prettier check, frontend/backend typecheck, backend/frontend build, backend Jest tests, frontend Jest tests, and Svelte component Vitest tests.Notes And Scope Boundaries
ELECTRON_RUN_AS_NODEreset for local Cypress execution.Login.svelteinto child form components, addingauth-controller.ts, addingAuthRuntime.svelte, or redesigning frontend state architecture remains explicitly out of scope.