Repository navigation
fix(auth): register client email verification mutation - #423
Conversation
|
Thanks for this. The client Reusing A few small things before merging:
|
|
Thanks for the review. Updated in c6ede31: both hooks receive The docs failure is also fixed in 479ab9d by adding the missing Vitest dependency and test script to Resend. After syncing with main, all 579 auth tests, the Resend test, TypeScript, lint, build, and full docs checks pass locally. The full suite has 1,450 passes and the same 10 Windows failures. CI Build and Bugbot passed. Every documentation step, including TypeDoc, navigation sync, and internal links, passed too; GitHub still reports the overall docs job as in progress. |
omegascorp
left a comment
There was a problem hiding this comment.
Looks good, approved
verifyEmail({ token })always rejects withMethod with name '_system.user.verifyEmail' is not defined.The documented client helper exists, but its server mutation is missing.Register the mutation and reuse
verifyEmailTokenfor the existing expiry, account-status, address-update, and token-consumption checks. Invoke the email-verification success/error hooks withsession: nulland the caller's connection information, and propagate errors to the client.The mutation only verifies the address: it does not create a session, replace the caller's account, or set an auth cookie. The existing emailed-link route keeps its behavior. Document this distinction in the manual-verification guide.
Fixes #421.
The documentation workflow also type-checks the existing Resend test, which imports Vitest. Add the missing dev dependency, update its lockfile, and expose
npm testso a clean install can run the test and generate documentation.Validation:
Clean Resend install, its attachment regression test, Resend type checking/build, full TypeDoc generation, unchanged API Reference navigation, and all 187 documentation content files' internal links pass.
Added 11 regression cases through the real user module and server method registry. Successful cases call the real client helper using the built-in in-process transport; database operations are stubbed. Coverage includes anonymous and authenticated callers, unknown/expired/reused tokens, malformed input, disabled/deleted accounts, hooks, and unchanged caller sessions.
The new cases reproduced the missing-method failure before the fix and pass afterward. All 579 auth tests pass, including the existing emailed-link tests.
Lint, build, importing the built server module with Node.js, and Prettier for changed TypeScript files pass.
TypeScript type checking, full TypeDoc generation, API Reference navigation sync, and internal documentation link checks pass. The CI fixture type mismatch is corrected; all 58 focused auth/client tests pass.
Full suite: 1,450 passed, 10 failed. The failures are identical to the unchanged-main baseline in
authCache.test.ts(1),dev.test.ts(1),deploySpec.test.ts(1), andsource.test.ts(7): Windows file modes/path separators, symlink permissions, and missingunzip.The full formatting check passes with
--end-of-line auto; the default check flags existing CRLF files in this Windows checkout.Note
Medium Risk
Touches authentication email verification and session semantics; behavior change for any code that expected user data from verifyEmail, but the mutation path is intentionally sessionless and is well covered by new tests.
Overview
Registers the missing
_system.user.verifyEmailserver mutation so the documented clientverifyEmail({ token })helper works instead of failing with “method not defined.”The new
handleVerifyEmailMutationreusesverifyEmailTokenfor the same validation and DB updates as the emailed-link GET route, but does not create a session, set an auth cookie, or alter the caller’s existing session. Success and error hooks run withsession: nulland the caller’s connection info; the client method’s return type is nowvoid.Docs under manual verification explain this vs the default link flow (which still signs the user in). Regression tests cover anonymous/authenticated callers, token edge cases, hooks, and session isolation.
@modelence/resendadds avitestdev dependency andtestscript (lockfile update only).Reviewed by Cursor Bugbot for commit 479ab9d. Bugbot is set up for automated code reviews on this repo. Configure here.