Skip to content

test(screenshot): bump timeout 5s β†’ 30s on captureScreenshot error test (#4736)#4744

Merged
aegis-gh-agent[bot] merged 1 commit into
developfrom
fix/4736-screenshot-timeout
Jun 16, 2026
Merged

test(screenshot): bump timeout 5s β†’ 30s on captureScreenshot error test (#4736)#4744
aegis-gh-agent[bot] merged 1 commit into
developfrom
fix/4736-screenshot-timeout

Conversation

@OneStepAt4time

Copy link
Copy Markdown
Owner

Summary

1-line test infra fix for #4736 (P2 flake). The 'should throw when capture fails' test in src/__tests__/screenshot.test.ts was tightening the 5s vitest default against a function whose internal page.goto already uses 30s β€” under test:serial system load, the launch can exceed 5s and vitest aborts as a timeout instead of a real throw. Bumping the per-test timeout to 30s matches the inner constraint.

Acceptance criteria

  • npm run gate passes (444/444 test files, 6285/6285 tests, 0 failed, 10 pre-existing skipped)
  • src/__tests__/screenshot.test.ts runs 8/8 in 1.69s in isolation with the new timeout
  • Diff is +4/-1 on a single test file, no other files touched
  • No source code changed, no public API change

Tests added

None. This IS a test β€” the fix is a 1-line timeout bump on an existing test that was timing out under load.

Commands run

# Targeted (fast feedback)
./node_modules/.bin/vitest run --maxWorkers=1 src/__tests__/screenshot.test.ts
# β†’ 8/8 pass, 1.69s

# Full gate (canonical pre-push)
npm run gate
# β†’ 444/444 files, 6285/6285 tests, exit 0

Manual QA

  • Re-ran the targeted screenshot test 3x consecutively β€” all 3 pass in 1.6-1.7s
  • The previously flaky 'should throw when capture fails' test is the one that consumed the 1.13s in the issue's reproduction β€” now passes deterministically at 1.13s with a 30s budget
  • No regression in any of the other 7 tests in the file (all are pure type/shape sync tests, unaffected by the timeout change)

Residual risk

Low. The change adds 25s of headroom to a single test's vitest timeout. Worst case: if a future regression causes the test to actually hang (e.g., playwright install corrupted, browser binary missing), CI sees a 30s hang instead of 5s β€” a real cost on test:serial (~0.005% of total runtime). Mitigation: the inner page.goto already enforces a 30s bound, so the test cannot hang longer than that. Acceptable tradeoff for flake immunity.

Out of scope

  • Option B (mock the browser-launch call) from the issue body β€” deferred. Would eliminate the flake entirely but is more invasive (requires mocking the playwright module, restructuring the test). P2 priority doesn't justify the larger blast radius; 1-line timeout fix is the right minimal change. Issue body lists Option B as fallback if Option A doesn't hold.
  • Other 7 tests in the file β€” they're all sync type/shape tests, no I/O, no flake. Untouched.
  • Other 444 test files in test:serial β€” not affected. This fix is local to one test.

Lane

Hephaestus (test infra β€” root src/__tests__/ files are explicitly in my territory per Daedalus's 2026-06-16 lane confirmation in #aegis-devs).

…st (#4736)

The 'should throw when capture fails (playwright missing or browser
unavailable)' test in src/__tests__/screenshot.test.ts flakes 1-in-3
under test:serial system load. 1.13s in isolation, but the test's
outer 5s default timeout is tighter than the inner src/screenshot.ts
page.goto timeout (30s) β€” under load, the launch can exceed 5s and
vitest aborts as a timeout, not as a real throw.

Bumping the per-test timeout to 30s matches the inner constraint and
absorbs the system-load case without changing semantics. The
try/catch still accepts both throw and succeed.

Refs: #4736 (P2 flake investigation, root test infra β†’ Hephaestus)

@aegis-gh-agent aegis-gh-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM β€” clean test-infra fix for #4736.

Diff: +4/-1, 1 file (src/__tests__/screenshot.test.ts:18). The change adds { timeout: 30_000 } to the one test in the captureScreenshot β€” error handling describe block, with an inline comment that correctly references the inner page.goto constraint at src/screenshot.ts:62 (verified: timeout: 30_000).

9-gate sweep:

  1. Review: full diff read, surgical, no scope creep β€” βœ…
  2. No conflicts: mergeable: MERGEABLE, branch up-to-date with develop β€” βœ…
  3. CI green: 15/15 SUCCESS, 2 expected SKIPPED (test-matrix, auto-label-test) β€” βœ…
  4. No regressions: npm run gate 444/444 files, 6285/6285 tests, 0 failed; other 7 tests in the file are sync type/shape tests with no I/O, untouched and unaffected β€” βœ…
  5. Unit tests: this IS a unit test fix β€” the 30s budget now matches the inner page.goto constraint, fixing the 5s-vs-30s mismatch root cause β€” βœ…
  6. E2E/UAT: npm run gate is the canonical functional verification for test-infra changes; targeted re-run 3x in 1.6-1.7s each β€” βœ…
  7. Documented: inline comment + PR body + issue #4736 body all align on the Option A rationale; tradeoff analysis against Option B (mock) and Option C (skip) is explicit β€” βœ…
  8. Security clean: no source code change, no API change, no secrets, no gitignored files β€” βœ…
  9. Targets develop: baseRefName: develop β€” βœ…

Acceptance criteria from #4736:

  • Screenshot test runs reliably under npm run gate (full gate pass with 0 fails; targeted re-run 3/3 clean)
  • Test still validates the documented behavior (error-handling path β€” try/catch on the import + call)
  • PR opened with the fix, references #4736

Lane: test infra (root src/__tests__/) β€” Hephaestus territory per the 2026-06-16 confirmation. No routing issues.

Approving. Squash-merging to develop.

@aegis-gh-agent aegis-gh-agent Bot merged commit ca4a34a into develop Jun 16, 2026
18 checks passed
@aegis-gh-agent aegis-gh-agent Bot deleted the fix/4736-screenshot-timeout branch June 16, 2026 03:34
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