oliver-zehentleitner / maity
hub tests: test_product_line now and then misses the dead sign-in mail in the outbox on SQLite
tsk-knmx8yw3s1xa Done Maity Coder Claude 002
Flake seen on #1717 (hub-sqlite): a tests/test_product_line.py test expected the dead sign-in mail in the outbox and did not find it. Re-run alone, it was green. It is not related to #1717's change. Reported by maity-review-team-lead#vuur.
Not diagnosed yet.
Wanted:
- Find the cause (ordering, a shared outbox between tests, timing of the mail write, or something else) and make the test deterministic.
- If the cause is in the hub rather than the test, say so on the card before fixing.
Separate from the with_postgres.sh trap card.
Notes
Maity Coder Claude 002 · Nov 13, 2026, 11:02 UTC
Cause (reproduced; in the tests, not in the hub).
routes/email_sign_in.LIMITSis the hub's in-process limiter forPOST /auth/email-link: per source and address, 3 requests per 15 minutes (past that the answer stays202and no mail is written, as §2.6.4 wants). On SQLite and MariaDB it counts in the test process.hub/tests/conftest.py's reset block (_fresh_process_state) never resets it; onlytests/test_email_sign_in.pyswaps in a fresh one through its own autouselimitsfixture.routes/password_reset.LIMITSis the same gap.Four tests outside that file ask for a link for
ada@example.comfrom the test client:test_mail_factor.py:621,test_password_reset.py:265,test_product_line.py:316,test_product_line.py:343. When all four land on one xdist worker within 15 minutes, the fourth gets202and no mail, somail()fails withassert row is not None(tests/test_email_sign_in.py:65). Which worker gets which test varies by run, hence the flake.Evidence (one process,
-p no:randomly, origin/main a0ffad500fbbbe62278627458d93a1d0bf508ed1):- A
test_mail_factor.py::test_under_email_the_sign_in_link_is_off_and_answers_as_if_sent, Btest_password_reset.py::test_complete_sets_the_password_ends_everything_and_signs_nobody_in, Ctest_product_line.py::test_the_sign_in_link_page_stands_in_the_frame_in_the_humans_language, Dtest_product_line.py::test_the_dead_sign_in_link_stands_in_the_frame_in_the_browsers_language - A B C D: 1 failed (D,
assert None is not None), 3 passed - D alone: 1 passed; B C D: 3 passed
- Seen in CI on #1717 and #1723 (run 43405647189).
Fix: the conftest reset block resets these limiters per test, and I am checking the rest of the hub's in-process limiters for the same gap. PR follows.
- A
Maity Coder Claude 002 · Nov 13, 2026, 12:10 UTC
PR #1727: https://github.com/oliver-zehentleitner/maity/pull/1727 (head
e9475e0537687ce8c9e384d4859935af5b21e64a, basea0ffad500fbbbe62278627458d93a1d0bf508ed1). Only tests change._fresh_process_stateinhub/tests/conftest.pynow resets everyLimiterthat a hub module holds, either as a module attribute or one attribute further down (RequestLimits). The helperprocess_limiters()finds them, so there is no hand-kept list. It finds 44 limiters in about 1.7 ms. The old list missed 24 of them: the six insideemail_sign_in.LIMITSandpassword_reset.LIMITS, plus 18 others (attachments, mail_factor, second_factor_reset, avatars, contacts, cross_chats, invitations, presence, forge_webhook ×3, registration ×4, ticker ×2).This deviates from the plan of adding two entries to the list. With 24 missing, the next new limiter would leak again. Keep the Why
4debb183-43cc-4ae5-8730-d2b4e8e03fc5records why.Red/green in one process: A B C D on origin/main: 1 failed, 3 passed. On the branch: 4 passed. Full hub suite
-n 2: 6883 passed, 158 skipped.