test(hooks): make the pre-push tsx stub path survive .git-less cloud image checkouts - #816
Merged
Merged
Conversation
…image checkouts
The rust-test-targets hook-routing test derives the real tsx binary from
the git common dir. The Cloud Run vitest image ships the source tree
without .git (.dockerignore), so the probe fails there and the old code
fell back to path.join('', ...) — a RELATIVE node_modules/.bin/tsx. The
fixture stub execs that path from the fixture repo, so a relative path
re-execs the stub itself in a silent infinite loop: the shard hangs
until the 30-minute job timeout with zero test failures. This broke every
cloud vitest run since the test landed (both 8dea394 green-base gates
hung 539/540 files green, one shard wedged; reproduced in the exact
image: original file never finishes, even past its own SIGTERM).
- owningTsxPath(): fall back to the checkout root containing the test
file when git metadata is absent, and force an absolute result so the
stub can never self-exec-loop.
- add spawnSync timeouts (15s/30s/120s) so a wedged child fails the
test in bounded time instead of eating the job.
Verified in the exact production image (freshell-e2e:8dea394d996b,
--network=none): fixed file 29/29 in 3.5s where the original wedges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Cloud Run vitest lane has been silently hanging since the pre-push hook
routing tests landed (ba83dd4, Sep 19): every cloud
test:unitrun wedgesone shard forever and fails at the 30-minute job timeout with zero test
failures. This breaks every agent's green-base gate and full-suite run on
the cloud backend (two
scripts/base-gate.sh testattempts at 8dea394 bothwent red this way: 539/540 test files green, one file never completing, in
both runs).
Root cause
test/unit/scripts/rust-test-targets.test.tsderives the realtsxbinaryfor its hook fixture from the git common dir:
.git(
.dockerignoreexcludes it), so the module-levelgit rev-parse --git-common-dirprobe fails with empty stdout.path.join('', ...)— the relativenode_modules/.bin/tsx.#!/bin/sh exec "<path>" "$@"; invoked from thefixture repo, a relative path re-execs the stub itself in an infinite
silent loop (no output, no failure).
spawnSynchad no timeout, so the vitest worker blocks until the jobtimeout reaps the shard.
Locally this never reproduces (the checkout has
.git).Verified in the exact production image
(
freshell-e2e:8dea394d996b,--network=none, worktree file overlaid):git rev-parsefrom/app/test/unit/scripts: exit 128, empty stdout.timeout, exit 124).it survives its own 90-second SIGTERM deadline (the container never
exits).
Fix (test-only)
owningTsxPath(): fall back to the checkout root containing the testfile when git metadata is absent, and force an absolute result so the
stub can never self-exec-loop.
spawnSynctimeouts (15s/30s/120s) so a wedged child fails the test inbounded time instead of eating the 30-minute job.
No production code changes.
Verification
(red → green).
fixed file's 29 tests.
05a89bb).
Test plan
npm run test:vitest -- run test/unit/scripts/rust-test-targets.test.ts --config config/vitest/vitest.config.ts— 29/29.FRESHELL_VITEST_BACKEND=cloud npm run test:unit— exit 0.