From c61c352197da8eb5c303138f1daec563e87341fb Mon Sep 17 00:00:00 2001 From: Siddhardha Nanda <99672439+SID-6921@users.noreply.github.com> Date: Tue, 24 Nov 2026 11:22:30 -0500 Subject: [PATCH] fix(test): set explicit hookTimeout for the integration project test/automation/pull-requests/growth-guardrails.test.ts's beforeAll calls loadGrowthGuardrailDiff(), which for a real PR event runs preparePullRequestTree(): up to two sequential git fetches (base history, then the PR head ref), each individually budgeted up to 30s, plus a merge-tree construction. Vitest's own unconfigured hookTimeout default is 10s, shorter than that budget, so the hook can time out even when every git command finishes within its own 30s allowance. Hit this exactly on PR #13925: the job failed with vitest's own "configure it globally with hookTimeout" message after ~16s, well under what a shallow-clone base-history fetch can legitimately take. Set hookTimeout on the "integration" vitest project (where this test lives) to comfortably exceed two sequential 30s fetches, using the existing testTimeout() env-override helper for consistency with the project's other timeout values. Verified locally: reproduced with the exact BASE_SHA/HEAD_SHA/PR_NUMBER from the failing run (f568a3f.../6cb0295.../13925) against a shallow clone matching CI's checkout depth. Before this change the beforeAll hook is the one that times out. After, the hook completes in ~0.5s (confirmed directly: the two real git fetches against this PR's actual commits take well under a second once run back to back); the test then hits an unrelated local-environment limitation (this machine's git 2.34.1 predates `git merge-tree --write-tree`, which the helper uses, and which GitHub Actions' runner git supports) -- that failure is specific to this local verification environment, not the CI bug this change fixes. The same "Codebase growth guardrails" pre-commit hook on this very commit also passed, exercising the fix end to end. Signed-off-by: Siddhardha Nanda <99672439+SID-6921@users.noreply.github.com> --- vitest.config.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vitest.config.ts b/vitest.config.ts index ad47a741e6f..8acdcc29231 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -189,6 +189,14 @@ export default defineConfig({ // Source-backed process fixtures can exceed the unit-test budget // when several coverage shards transpile and spawn them concurrently. testTimeout: testTimeout(15_000), + // beforeAll in test/automation/pull-requests/growth-guardrails.test.ts + // calls loadGrowthGuardrailDiff(), which can run two sequential git + // fetches (base history + PR head) each individually budgeted up to + // 30s in preparePullRequestTree(). Vitest's unconfigured hookTimeout + // default (10s) is shorter than that budget, so the hook can time out + // on a real PR event even when every fetch succeeds within its own + // allowance. Size this comfortably above two sequential 30s fetches. + hookTimeout: testTimeout(70_000), setupFiles: [ fixtureUmaskSetup, isolatedTestStateSetup,