You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
accept-lib's tree-snapshot test fails on Linux ext4, where a directory's mtime often doesn't advance #595
The test:test/accept-lib.test.mjs L169–184, "a tree snapshot notices added, removed and rewritten entries, and an untouched tree compares equal".
The failure as seen:diff.changed comes back ['a/b/file'], but the test expects ['a', 'a/b/file']. The entry missing is the directory a, whose mtime should move when the test adds a/new.
Cause (diagnosed): the test assumes the directory's mtimeMs advances when an entry is added right after the previous one, and ext4 doesn't guarantee that. The kernel stamps file times from a coarse clock that ticks once per jiffy. A probe on the same host created a directory, a link in it, and then a file right after: the directory's mtime was unchanged in 192 of 200 tries. The test passes only when a tick happens to pass between the link (L175) and the add (L180).
Ruled out:
M6b's code:scripts/accept/lib.mjs's snapshotTree predates M6b, and M6b doesn't touch the file.
A false green in the judges that use it (acceptance 12's and 13's tree checks, U2's in particular). An added entry is detected by its own key (diff.added), and a rewritten file by its own size, mtime and inode. Only the parent directory's mtime is timing-dependent, and no judge relies on the parent alone to see an add.
macOS: APFS keeps nanosecond times, so the test passes there. The hosted-macOS shards don't hit it; local npm test on Linux and any Linux runner do.
Fix, test-only: before the first snapshot, set a's times to a fixed past value with utimesSync(join(s.dir, 'a'), 1, 1), as the test already does for the file at L179. The add then has to move it.
Proof: red first. A loop running the test alone 12 times on ext4 fails about 8 of 12 before the fix and passes 12 of 12 after.
Activity
#595: accept-lib's tree-snapshot test pins its directory's mtime befo…
SSFSKIM commentedon Nov 27, 2026
[board] done: Landed via PR #596 (test-only, cua 0.30.0)