Repository navigation
fix(plugin-auth): a sign-up answers without waiting for any mail send, whether or not the address already has an account - #29975
Conversation
…, whether or not the address already has an account On the public door the sign-up's mail - the verification mail, or the notice to an address that already has an account - is built and sent after the response, through the same helper the reset mail uses; a send that fails is logged on the server at error. A server-side call that carries no request, and every other caller of the verification mail (the resend among them), still awaits its send. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
…d, whether or not the address already has an account Pins, with sendOnSignUp off and on, that both kinds of address get the same answer while every send is still open and that the mail still goes out after the response; that a failed verification send is logged on the server; that the server-side sign-up call still awaits its sends; and that the resend still awaits its send and reports one that failed. The existing pins read the mail once it has arrived. Adds the changeset. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check4 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run. What this run could not see
Coarse fallback — 22 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 732ea91dde26eac6c93abbc0db57fbb2c5f401ac && git checkout 732ea91dde26eac6c93abbc0db57fbb2c5f401ac
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6f7df530cd1432d0d34e0ee5cbee6b4d669e3f77 a58c8e55b316c3293a1ab15bbd292f4bce6f9bc2 && git checkout -B drift-repro 6f7df530cd1432d0d34e0ee5cbee6b4d669e3f77 && git merge --no-ff a58c8e55b316c3293a1ab15bbd292f4bce6f9bc2
node scripts/docs-audit/affected-docs.mjs --json 6f7df530cd1432d0d34e0ee5cbee6b4d669e3f77 |
|
security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
Clause-②: no
Metadata-protocol: none
维护者速读
POST /api/v1/auth/sign-up/email不再等任何邮件发送完成就作答——新地址的验证邮件、以及发给已有账号地址的提醒邮件,都改在响应之后发出,沿用找回密码邮件已在用的同一个助手。auth-manager-auth-instance.ts里的sendAfterResponseOnSignUp与两个回调的包装;signup-existing-address-success-shape.test.ts的 ⑦ 组;run-after-response.ts的日志一行。pnpm --filter @objectstack/plugin-auth exec vitest run src/signup-existing-address-success-shape.test.ts,预期 18 个用例全绿。What changes
POST /api/v1/auth/sign-up/emailanswers without waiting for any mail send, whether or not the address already has an account. On the public door (a call that carries its request) the verification mail and the notice to an address that already has an account are built and sent after the response, throughsendAfterResponseOnPublicDoor, the helper the password-reset mail already uses. A send that fails is logged on the server at error and never reaches the caller, whose answer is the one a sent mail gets.sendAfterResponseOnSignUphands the helper only the call the sign-up endpoint makes, read by the endpoint's declared path from better-auth's endpoint context (as the hooks readctx.path), never from the request URL. Every other call is awaited exactly as before, above all/send-verification-email, which still reports a failed send to its caller. Outside any endpoint context the call is awaited.auth.api.signUpEmailcarries no request and still awaits both sends.what.logAfterResponseSendFailurenow printswhatas given (password-reset email,verification email,sign-up notice email). This hunk, and the reset call site'swhat, are byte-identical to the sibling draft that moves the phone reset text, so the two merge cleanly in either order (git merge-treeagainst its head: no conflict). The reset's own log line reads exactly as before. The notice keeps its own error line for a failed send and never throws;onFailureis its backstop.Tests
signup-existing-address-success-shape.test.tsgains ⑦, one top-leveldescribein the existing harness file:sendOnSignUpoff and on, both kinds of address get the same answer while every send is held open by a deferred, and the mail still goes out once it is released;Request) still awaits its sends;/send-verification-emailresend still awaits its send and answers 500 for one that failed.vi.waitFor) before reading it; what each asserts is unchanged. The negative mail assertions in ②, ③ and ④ follow an explicit refusal, where no send is ever scheduled.Acceptance notes
git grepover test files outside this package finds none.sendOnSignUp onanswer case and the failure-log case; wrapping every verification call reds the resend case. Removing a wrapper fails by the case timeout, because the answer then waits on the held send.Verification
plugin-auth suite at 7a467a8
plugin-auth typecheck at 7a467a8
Ablation at 6a399c2 (source identical at 7a467a8)
Derived gates at 7a467a8
CI note (seat)
Type Check · workspaceon7a467a8031failed becauseCheckout repositorytimed out after 20 minutes, before any step ran on the code (the same runner-side timeout hit merge-group run 41719580038 the same hour). Treated as a flake and re-run once through the relay.Check Changeseton this head was cancelled with no superseding run; this body edit re-triggers it.