Files
Paul LütznerandClaude Opus 5 2ca7824783 test(ai): two tests that only failed on a machine that had run the app
Both passed in CI against a fresh database and failed locally, which is the
shape of a test that reads state it did not write.

AiBackfillStateRepositoryTest works in a transaction, and the transaction
unwinds what the tests write — not what was already there. The table is a
singleton, so on any machine that has run the app its one row is present before
the first test starts, carrying a real interactive_seen_at from whenever
somebody last opened the composer. touchInteractive() refuses to move that stamp
backwards, which is the behaviour it exists to guarantee, so a row stamped later
than the fixed date the test picks made the test fail against its own input. The
row is now cleared in setUp, inside the transaction, so each test establishes
the state it asserts on; the rollback puts the original back.

IndexNewMailCommandTest::testItSweepsEveryMailboxWhenNoneIsNamed asserted the
queue was exactly its own fixtures after an UNSCOPED sweep. The first test in
the same file carries a docblock warning about precisely this — "it would be an
assertion about what else happens to be in the database, which is the shape of a
test that fails on a second afternoon" — and scopes itself with --email to avoid
it. The unscoped one relied instead on the other seeded mailboxes being empty,
and they stopped being empty. It now asserts the claim that is actually worth
holding: the mailbox nobody named still got swept, newest mail first, and the
ceiling still stopped it short of draining the mailbox.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 16:01:44 +02:00
..