Skip to content

mod: one PowerShell test per value, so three pwsh cold starts stop sharing one 5 s budget - #2838

Open
backnotprop wants to merge 1 commit into
mainfrom
fix/hook-pwsh-test-timeout
Open

backnotprop wants to merge 1 commit into
mainfrom
fix/hook-pwsh-test-timeout

Conversation

@backnotprop

Copy link
Copy Markdown
Owner

Cause

The test hooks.json's SessionStart compact hook > PowerShell: prints only whitespace and exits 0, set or not in apps/hook/hooks/mod/inbox-reminder.test.ts started pwsh from cold three times in one test (unset, the reminder text, the hostile text). Bun's default budget for the test is 5 s. On main's unit-2 shard it already uses most of that:

Run Sha Result Time
42339830014 5c6fafd pass 3096 ms
42338872718 8c8addd pass 2739 ms
42336706551 9ebcc8b pass 3185 ms
42336075827 efd8239 pass 3516 ms

On PR 2776 (run 42340487682, unit-2) it hit 5008 ms and timed out. Bun then killed the leftover pwsh, so the failure reads as Expected: 0, Received: null. PR 2776 changes only packages/system/.

Change

  • One test per value: unset, set to the text, set to the hostile text. Each starts pwsh once and keeps the same three assertions: exit 0, stdout is only whitespace, stderr is empty.
  • The probe for whether pwsh is present still runs once, when the file is collected. It is the shared skip condition and does not count against any test's budget.
  • No timeout changed. Each case should take about a third of the old 2.7 to 3.5 s.

Timing

  • pwsh is not installed on the author's machine, so locally the three PowerShell cases skip: 18 pass, 3 skip, 0 fail, 115 to 144 ms over three runs (bun test apps/hook/hooks/mod/inbox-reminder.test.ts, as the unit lane runs it, without --isolate).
  • The per-case times on CI are in this PR's unit shard log.
  • tsc for apps/hook/hooks/mod/tsconfig.json and apps/hook/tsconfig.server.json is clean. The mod tsconfig excludes *.test.ts. Gitleaks over the range found no leaks.

…aring one 5 s budget

The SessionStart compact hook's PowerShell test ran pwsh three times in
one test. On main's unit-2 it took 2.7 to 3.5 s and on PR 2776 it hit
5008 ms and timed out. Each value is now its own test with the same three
assertions; the probe for pwsh stays a shared skip condition.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant