Repository navigation
fix(plugin-auth): the phone-number password-reset request answers without waiting for the SMS send, as the emailed reset does - #29973
Conversation
…hout waiting for the SMS send, as the emailed reset does On the public door the reset text is built and sent after the response, through the same helper the emailed reset uses; a send that fails is logged on the server at error. A server-side call that carries no request still awaits its send. Claude-Session: https://claude.ai/code/session_01QSeKYn5CmmdShCJifm6WYj Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check3 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 4d41b89e1d6e9a56a51a3cf5c314aa0e7d14c730 && git checkout 4d41b89e1d6e9a56a51a3cf5c314aa0e7d14c730
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 04cbdf78b602261054368c16e075b299eaa69ade af6b561239528146bd89745a61b371bc7358e6cc && git checkout -B drift-repro 04cbdf78b602261054368c16e075b299eaa69ade && git merge --no-ff af6b561239528146bd89745a61b371bc7358e6cc
node scripts/docs-audit/affected-docs.mjs --json 04cbdf78b602261054368c16e075b299eaa69ade |
|
security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj 席位核对ACCEPT · head
|
|
security#1 · os-justin · session_01QSeKYn5CmmdShCJifm6WYj Re-queue · head The merge group on base |
Clause-②: no
Metadata-protocol: none
维护者速读
POST /api/v1/auth/phone-number/request-password-reset)不再在请求内等待短信发送;重置短信在响应之后构建并发送,与邮件重置一致。sendAfterResponseOnPublicDoor,不新增机制。packages/plugins/plugin-auth/src/auth-manager-plugin-list.ts的sendPasswordResetOTP一行(取ctx?.request交给 helper);②run-after-response.ts的日志措辞(what自带介质,邮件那行字节不变);③reset-request-mail-after-response.test.ts新增的 phonedescribe。pnpm --filter @objectstack/plugin-auth exec vitest run src/reset-request-mail-after-response.test.ts,预期 9/9 通过,其中 phonedescribe三条全绿。What changes
The phone-number password-reset request answers without waiting for the SMS send, as the emailed reset does.
sendPasswordResetOTP(auth-manager-plugin-list.ts) now goes throughsendAfterResponseOnPublicDoor, the helper the emailed reset'ssendResetPasswordalready uses. A call that carries aRequest(the public door) resolves at once; the text is built and sent after the response; a failed send goes tologAfterResponseSendFailureat error.sendPasswordResetOTP(data, ctx)— the endpoint context, not theRequestthe emailed reset is handed (plugins/phone-number/routes.mjs). The callback therefore passesctx?.request, the very valuesendResetPasswordreceives (routes/password.mjs). The helper's rule is unchanged: aRequestpresent means the public door; none means a server-sideauth.api.*call, which still awaits its send.logAfterResponseSendFailuretakes the medium insidewhat: the email door passespassword-reset emailand prints the same bytes as before; the phone door printsphone password-reset text was not delivered: …. The line carries the transport's error, never the one-time code.200 {"status":true}), the per-number cooldown and hourly cap in the before-hook, the per-IP limit on the route, the text itself, andsendOTP(sign-in OTP), which still awaits its send so its429/400refusals reach the caller.Tests
New top-level
describein the existing harness filesrc/reset-request-mail-after-response.test.ts(realAuthManager.handleRequestover ObjectQL + better-sqlite3):answers a number with an account and a number without one alike, while the reset text is still being sent: the SMS stub's send waits on a deferred the case resolves by hand. Both answers arrive, equal, while that send is still open; then the case resolves it and the text goes out to the number (control). No wall-clock threshold.logs a reset text whose send fails on the server, without its code, and answers as for a text that is sent.the server-side phone reset call (no Request) still awaits its send.src/phone-otp-no-sms-service-refusal.test.ts: the existing pin that the refusing send is reached now waits for it withvi.waitFor, since it runs after the response. The two phone pins inpassword-reset-ends-sessions.test.ts(which already usevi.waitFor) pass unchanged.Results at af6b561
One-shot ablation (committed fix first; mutation through scripts/ablation-replace.mjs; restore proven blob == HEAD, git diff HEAD empty)
Acceptance notes
git grep -n requestPasswordResetPhoneNumberhits only the new test, and the identity import calls the emailedrequestPasswordReset. The no-Requestbranch is kept anyway and pinned (leg B above).advanced.backgroundTasks.handler, stays unset: it would also stop the identity import's server-side reset from awaiting the delivery receipt it reads.Verification
All readings at
af6b561239(the head of this PR);origin/mainhad not moved from the merge base3b8c724cf2when they were taken.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstacknamed 59 commands for this diff; each was run with its exit code captured before any pipe, then reconciled; in the final record every one answered exit 0 (the list and its codes are in the seat report).node scripts/pm/dispatch-gates.mjs --ran→Run reconciliation — 59 derived, 59 run, 0 NOT-MEASURED, 0 UNRUN.pnpm check:dual-build-cjs-loadsfirst answered exit 3 (PREREQUISITE NOT MET: unbuilt packages, nothing measured); after a full workspace build (turbo run build --filter=!@objectstack/docs, 119/119 tasks) it answered exit 0:116 published require entry point(s) across 71 package(s) load.@objectstack/plugin-authsuite and typecheck: see Tests above.test:repo(the vitestrepoproject, which CI'sTest Coreruns) and the full CI farm; CI's check-runs on this PR are the reading for those.CI note (seat)
Build Coreonaf6b561239first failed before compiling anything:@objectstack/spec's build could not fetch the deletion-check anchor commit7eb613c39fb8, and the remote did not serve it during that run. The commit exists on the remote, and this PR touches no file underpackages/spec. Treated as a transient fetch flake; re-run once through the relay, and the re-run issuccess.Check Changeseton this head was cancelled without a newer run superseding it. This body edit re-triggers it.