Files
msd-core/tests
Tom Boucher 249c586a40 fix(3582): stop the cold-tree guard from racing the builders it guards against (#3665)
The guard added in #3656 asserts that this test leaves the real repo hooks/ directory
alone. It compared a RAW listing before and after — and just failed on the runner:

    the real repo hooks/ directory listing must be unchanged by this test
    -   '.dist-staging-20858',
        'dist',
        ...

Nothing was wrong with the test's own behaviour. A CONCURRENT scripts/build-hooks.js —
nine test files invoke it from before() hooks — created hooks/.dist-staging-20858 inside
the comparison window. The assertion assumed the shared hooks/ directory is stable for the
duration of a test, which is precisely the assumption this line of work exists to
disprove. The race-detector raced.

The intent is right and is kept: this test must not add or remove anything in the repo.
Only the comparison changes — both snapshots are now filtered through shouldCopyHookEntry,
the same rule the fixture itself uses, so transient build scratch that is not this test's
doing and is excluded from the fixture anyway no longer registers as a difference.

Proven by execution: with a .dist-staging dir injected mid-window the filtered listings
compare equal, while the unfiltered listings provably differ by exactly that entry — so
the old comparison would have failed and the new one is immune rather than merely quieter.
The injected directory is removed afterwards and hooks/ is confirmed byte-identical.

Checked for the same shape elsewhere: this is the only raw listing comparison of the live
hooks/ directory in the file or the repo. The second title in the failure output is the
describe() wrapper around this same test, not a sibling.

Refs #3582

Co-authored-by: sim <sim@local>
2026-08-19 09:00:39 -04:00
..