Repository navigation
fix(verification): preserve working email verification flows - #3
Merged
Merged
Conversation
Treat deleted and expired verification requests as completed no-ops. Preserve database and delivery failures for retries, with regression coverage for each case. Fixes OPENSENSOR-FIEF-1
Preserve outstanding verification requests when welcome delivery runs or retries. Consume all pending codes on successful verification. Add HTTP flow tests using codes from rendered emails for resend ordering, delayed welcome, expiry, and delivery retries.
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.
A delayed welcome-email task deleted pending verification records and replaced their codes. This could invalidate a code in a verification email the user had already received, or cause the queued verification task to fail because its record had disappeared.
Welcome delivery and its retries now preserve existing verification codes. Explicit resends still replace older requests. Completing verification through either the code form or email link consumes all outstanding verification codes for that user. Deleted or expired queued requests are skipped; actual database and email-provider errors still propagate for retry.
Validation: new flow tests reproduced failures with a welcome task running both before and after verification-email delivery. The corrected tests read codes/links from rendered emails, POST them through the HTTP verification endpoint, assert the user is verified, and assert outstanding codes are consumed. Coverage includes reordered resend tasks, delayed welcome delivery, expiry followed by resend, duplicate tasks after completion, and welcome delivery retries with either email's link. The full local SQLite suite passes (2,132 tests plus three subtests); targeted Ruff and mypy pass. CI also covers PostgreSQL and Python 3.12/3.14.
Fixes OPENSENSOR-FIEF-1