Skip to content

Commit 40c29d1

Browse files
committed
fix(gate-validator): deterministic tiebreaker for latest-gate sort
When two gate files land in the same millisecond (common on fast CI filesystems), mtime-only sort is unstable and may pick the wrong "latest" gate. Add filename localeCompare as a stable secondary sort so latest-mode validation is reproducible. Resolves CI flake on tests/gate-validator.test.js:164 "validates every gate when requested".
1 parent 016d989 commit 40c29d1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/gate-validator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function latestGateFile() {
5656
const full = path.join(GATES_DIR, name);
5757
return { name, full, mtime: fs.statSync(full).mtimeMs };
5858
})
59-
.sort((a, b) => b.mtime - a.mtime);
59+
.sort((a, b) => b.mtime - a.mtime || b.name.localeCompare(a.name));
6060

6161
return files[0] || null;
6262
}

0 commit comments

Comments
 (0)