Skip to content

Fix flaky mail test, Queue.restore and fake message grammar - #16

Merged
necessarylion merged 3 commits into
mainfrom
fix/queue-followups
Nov 2, 2026
Merged

necessarylion merged 3 commits into
mainfrom
fix/queue-followups

Conversation

@mydoxie

@mydoxie mydoxie commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

Three fixes.

1. Flaky test: "a 100 KB body is not in the error"

Problem: the test checks that the log and the saved error do not have xxxx in them (the body is x * 100 KB). But the error also holds the encrypted details: a long random base64 text. Base64 uses the letter x too.

Effect: about 1 in 300 encrypted texts has xxxx in it by chance. One run makes several of them, so the test failed now and then (on main e8d6f6b and on #15), with no real leak. It was not a log line from another test.

Fix: the test now cuts out the encrypted part (Details are encrypted: <base64>) before it checks the text. If the details were ever plain text, the check still catches it, because plain text has spaces and is not cut.

2. Queue.restore() did not undo Mail.useQueue()

Problem: Queue.fake() calls Mail.useQueue(). Queue.restore() did not undo it.

Effect: in a test with no Queue.configure(), Mail.queue() still found a queue after restore().

Fix: restore() now sets the mail queue back: none when the queue was never configured, else this queue.

3. Grammar of the fake messages

Problem: the check messages said "a AllTypesJob", "1 times" and "the 1 pushed X jobs".

Fix: they now say "an AllTypesJob", "1 time" and "the 1 pushed X job". The README already says that a failed check throws an AssertionError, so no doc change was needed.

Tests

  • New test: after restore() with no config, Mail.mailQueue throws (fails without fix 2).
  • The message tests now expect the new text.
  • Locally: format, analyze and dart test pass (SQLite only; Postgres, MariaDB and Redis run on CI).

@mydoxie

mydoxie commented Nov 2, 2026

Copy link
Copy Markdown
Contributor Author

Bot review

Checked: dart analyze --fatal-infos, format and dart test pass (3 runs). I used local main of dox and dox-mailer as overrides, like ci/use-siblings.sh. Only SQLite runs here. Without the restore() change, the new restore test fails.

The flaky test is still useful. The regex cuts only the text right after Details are encrypted: up to the first space or quote. A plain error text has spaces, so the 100 KB body would still be found if it leaked. RedactedMailError.decrypt is checked in the test before it.

Blocking

None.

Non-blocking

  • lib/src/queue_fake.dart:91: _a checks only the first letter. A name like UserJob gives "an UserJob". Fine for now.
  • lib/src/queue.dart:50: restore() sets the mail queue to QueueMailQueue or null. A custom Mail.useQueue() set before Queue.fake() is not put back. That was already lost before this PR, so it is not a regression.

@necessarylion
necessarylion merged commit fd32294 into main Nov 2, 2026
1 check passed
@necessarylion
necessarylion deleted the fix/queue-followups branch November 2, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants