fix(e2e): verify the disposable account before change-email (BUNYIP-150) #226
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bunyip-150-change-email-verify-first"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Fix the last failing BUNYIP-150 e2e spec:
account/change-email. After #225 (registration unthrottled + JMAP origin) magic-link and password-reset went green, but change-email'swaitForLinktimed out for the/settings/confirm-emaillink that never arrived.Root cause
request_email_change(crates/bunyip-domain/src/services/auth.rs) branches onemail_verified:/settings/confirm-emaillink.Ok((old_email, None))).A freshly registered disposable account is unverified, so the change took the immediate path and the spec waited forever for a link that was never sent. magic-link and password-reset pass because they do not depend on verification state.
Fix
The spec now verifies the disposable account first via the existing verify-email flow (over the same JMAP sink), so the change takes the verified, link-confirmed path it is meant to exercise:
POST /v1/users/me/email/verify(no body) -> read the/settings/verify-emaillink from the sink ->POST /v1/users/me/email/verify/confirm { token }.POST /v1/users/me/emailto a new subaddress -> read the/settings/confirm-emaillink -> confirm -> assert the new email.Adds the two verify routes to
lib/api.ts,EMAIL_VERIFY_REtolib/mail-sink.ts, and a dev-docs note. As a bonus it now also exercises the otherwise-untested verify-email flow.Verification
Pure e2e change against existing deployed endpoints (no app deploy needed).
tsc --noEmitclean. Full green confirmed by the staging e2e run on this PR.🤖 Generated with Claude Code