Skip to content

fix(migrate): compare owned files, not raw counts, in what_if_mutates_nothing#356

Merged
aaronsb merged 1 commit into
mainfrom
fix/whatif-ds-store-flake
Jul 10, 2026
Merged

fix(migrate): compare owned files, not raw counts, in what_if_mutates_nothing#356
aaronsb merged 1 commit into
mainfrom
fix/whatif-ds-store-flake

Conversation

@aaronsb

@aaronsb aaronsb commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

cmd::migrate_exec::tests::what_if_mutates_nothing fails intermittently on macOS with assertion left == right failed: what-if must not change the tree / left: 43 / right: 44.

This is a known, already-diagnosed flake — just never fixed in this one place. phase_backup carries the diagnosis in a comment:

Compare by set, not raw count: macOS Spotlight can drop a .DS_Store into a directory between the pre-count and the copy, and such OS-transients aren't part of the user's tree — counting them made the backup fail spuriously on macOS only (the 43/44 flake). If a real file is ever missing, it's named.

phase_backup was hardened with a set diff plus an is_os_transient exemption. what_if_mutates_nothing still does assert_eq!(count_files(&dest), before), so the identical Spotlight write still fails it — with the identical 43/44, and with no indication of which path appeared.

This applies the same treatment: compare the set of owned files (transients filtered out) before and after. A genuine what-if mutation now names the offending path rather than printing two integers.

Why now

Surfaced while landing #354 (ways corpus --verbose), whose macOS CI leg went red on this test. #354 touches only corpus.rs, main.rs, and a docs page — nothing that could reach migrate_exec. Confirmed it's not that PR:

Nondeterministic, macOS-only, and independent of the diff — consistent with Spotlight timing on the runner. Fixing it here, on main, rather than smuggling it into the diagnostics PR.

Test plan

  • cargo test -p ways -- --test-threads=1 — 346 pass, 0 fail
  • cargo clippy -p ways --all-targets — no new warnings (count_files still used by phase_backup, so no dead-code)
  • Cross-platform CI on this branch is the real check: the macOS leg is the one that matters

…_nothing

`phase_backup` already learned this lesson: on macOS, Spotlight can drop a
`.DS_Store` into the tree between two observations, so a raw file-count
equality fails spuriously. Its comment even names the symptom — "the 43/44
flake" — and it was hardened to compare by set with an `is_os_transient`
exemption.

`what_if_mutates_nothing` was never given the same treatment. It still asserts
`count_files(&dest) == before`, so the same Spotlight write fails it on macOS
with exactly `left: 43, right: 44` and no indication of which path moved.

Compare by set, filtered through the same `is_os_transient` exemption. A real
mutation now names the offending path instead of printing two integers.
@aaronsb aaronsb merged commit 03976c9 into main Jul 10, 2026
11 checks passed
@aaronsb aaronsb deleted the fix/whatif-ds-store-flake branch July 10, 2026 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant