Commit e4fa2d8
test(picker/summary): sleep between writes to avoid mtime tick collision (#2433)
## Problem
`test_cache_roundtrip_and_prune_on_write` flaked on PR #2429's
`code-coverage` job
([logs](https://github.com/max-sixty/worktrunk/actions/runs/24975304781/job/73126010174))
— the assertion that `deadbeef` was pruned after writing `cafebabe`
failed, then a rerun passed.
Root cause: `sweep_lru` (`src/cache.rs:126`) sorts entries by file mtime
to pick the eviction victim. The test wrote `deadbeef` and `cafebabe`
back-to-back with no delay; on filesystems with coarse mtime resolution
both files can share a tick, making eviction order nondeterministic and
sometimes pruning the newer entry instead.
## Solution
Add a 10 ms sleep between the two writes — the same gap
`test_sweep_lru_trims_oldest_entries` (`src/cache.rs:319-322`) already
uses for the same reason.
## Testing
Targeted test passes locally; the broader
`commands::picker::summary::tests` and `cache::tests` modules still
pass.
---
Closes #2432 — automated triage
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>1 parent 76c8371 commit e4fa2d8
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
145 | 151 | | |
146 | 152 | | |
147 | 153 | | |
| |||
0 commit comments