mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-31 04:12:10 +03:00
* test(ci): stop the promote-latest guard from racing the script's early exit `Unit Tests fast-path (2/4)` went red on two unrelated PRs today (#8953, #8966), always on the same case, always with `Error: spawnSync bash EPIPE` — never an assertion. The file passes locally in 1.8s, so it read as load-related noise. It is not: it is a race with a precise, reproducible mechanism. should-promote-latest.sh decides a pre-release VERSION and exits BEFORE reading stdin at all: case "$VERSION" in *-*) echo "false"; exit 0 ;; esac The test harness passed the candidate tags via execFileSync's `input:`, i.e. a pipe. The child exits, its read end closes, and the parent's write raises EPIPE — so the test throws before asserting anything. Whether the write lands first depends on the 64 KB pipe buffer and the scheduler, which is exactly why it failed intermittently under four concurrent shards while passing in isolation. Measured, not inferred — same version, growing payload: 2 tags ( 11 bytes) → ok 100 tags ( 689 bytes) → ok 5 000 tags ( 43 889 bytes) → ok 20 000 tags (188 889 bytes) → EPIPE, every time Fix: back stdin with a real FILE instead of a pipe. A file has no reader to lose, so the child may exit whenever it likes. The script's interface is untouched — it still reads candidate tags from stdin, exactly as docker-publish.yml pipes them. Production is NOT affected, and that was checked rather than assumed: docker-publish.yml short-circuits pre-releases before the helper is ever called (`elif printf '%s' "$VERSION" | grep -qE -- '-(rc|alpha|beta|pre|next)'`), so the early-exit branch is unreachable there. Only the test exercised it. No production file changes here. TDD — the new case is the guard for the harness itself, run against both helpers: node --import tsx/esm --test tests/unit/build/should-promote-latest-5301.test.ts # new helper (file-backed stdin): 9 pass, 0 fail # old helper (input: pipe): 8 pass, 1 fail → Error: spawnSync bash EPIPE * docs(changelog): fragment for #8977 --------- Co-authored-by: diegosouzapw <diegosouzapw@users.noreply.github.com>