Repository navigation
test: fix TestHarvestTypedRecipients flake - #35
Merged
Merged
Conversation
harvestTypedRecipients persists the contacts cache asynchronously
(safeGo → SaveIfDirty). t.TempDir's cleanup can race that goroutine and
fail the test with:
unlinkat … directory not empty
under repeated runs (-count / -race) — it only passed at -count=1 by
luck of timing.
Fix: poll for the cache file to land on disk before the test ends
(2 ms interval, 2 s deadline). Test-only change, pre-existing on main;
surfaced while stress-testing the keyword-tags feature's identical
write-through pattern.
Verified: intermittent failure with -count=20 before, stable after
(-count=30, and -race -count=10).
farangkao
force-pushed
the
fix/test-harvest-flake
branch
from
October 6, 2026 17:49
ce07501 to
f499498
Compare
Same race class as TestHarvestTypedRecipients: applySenderRules persists
merges.toml via safeGo(store.Save) and t.TempDir cleanup can race that
goroutine ("unlinkat ... directory not empty"), flaky under -count and
on slow CI disks. Pre-existing on main — reproduced at the branch point
with -count=300.
Extract the poll-until-saved loop into a shared waitForFile helper and
use it from both tests.
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.
This is a small fix for
compose_test.gowhich was bumping up while i developed a new Feature 'imap message keywords', which i will create a seperate PR ,since this is an unrelated issue.harvestTypedRecipients persists the contacts cache asynchronously (safeGo → SaveIfDirty). t.TempDir's cleanup can race that goroutine and fail the test with:
under repeated runs (-count / -race) — it only passed at -count=1 by luck of timing.
Fix: poll for the cache file to land on disk before the test ends (2 ms interval, 2 s deadline). Test-only change, pre-existing on main; surfaced while stress-testing the keyword-tags feature's identical write-through pattern.
Verified: intermittent failure with -count=20 before, stable after (-count=30, and -race -count=10).