Repository navigation
fix(frontend): give unit tests timeout headroom for loaded macOS runners - #7717
Conversation
The macos-latest frontend leg failed 6 times in 3 days, each on a pure timeout in a different spec -- never a failed assertion. The leg's own wall time swings ~2x run to run, and the same test that takes ~400ms on ubuntu has been observed at 11s+ inside a beforeEach on a loaded macOS runner, while Vitest's default limits (5s test / 10s hook) are fixed absolute values that don't scale with runner load. Raise both limits in vitest.config.ts (which previously set neither): testTimeout 20s, hookTimeout 30s -- roughly 4x/3x the worst observed times. A genuinely hung test still fails, just a few seconds later on a 9-17 minute leg, which is strictly cheaper than re-running CI and eroding the signal a red leg carries. The browser-mode config (vitest.browser.config.ts) keeps Vitest's defaults: no timeout failures have been observed on that leg. Closes apache#7713.
Backport auto-label reportThis
|
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
Pull request overview
Adds timeout headroom to reduce flaky frontend unit tests on loaded macOS runners.
Changes:
- Raises test timeout to 20 seconds.
- Raises hook timeout to 30 seconds.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7717 +/- ##
============================================
- Coverage 90.94% 90.93% -0.01%
Complexity 4452 4452
============================================
Files 1175 1175
Lines 47140 47140
Branches 5284 5284
============================================
- Hits 42870 42869 -1
Misses 2580 2580
- Partials 1690 1691 +1
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <[email protected]> Signed-off-by: Meng Wang <[email protected]>
Yicong-Huang
left a comment
There was a problem hiding this comment.
🟡 0 must-fix · 1 advisory · 0 polish — implementation is ready; the PR description retains one stale quantitative claim.
Conventions (1)
- Description: replace “roughly 4x/3x the worst observed times” with “4x/3x the defaults” (advisory)
apache#7717 merged the same jsdom raise on main (`testTimeout: 20000`, `hookTimeout: 30000`) while this branch carried 30s/30s, which is what the conflict was. The merge kept this branch's numbers, so the branch was reverting a value another author had just landed — inside a merge commit, with no argument for the change. Take main's verbatim instead: `frontend/vitest.config.ts` now has no diff against main at all. That leaves this PR scoped to what apache#7717 deliberately left out, and two statements that were true before it landed and are not now: - `vitest.browser.config.ts` justified `testTimeout: 30_000` as "the same 30s the jsdom config uses". jsdom is 20s. The standing argument is that browser mode's 15s default is now the tightest per-test ceiling in the frontend job, on the slower of its two runtimes, on the same macOS runners the jsdom raise was for — so it gets at least as much headroom. `hookTimeout` still stays absent: `browser.enabled` already resolves it to 30s. - `TESTING.md` read "30s per test in both configs" with one shared provenance. Split per config against the post-apache#7717 values: jsdom 20s test / 30s hook from apache#7717, browser 30s test from here, browser hooks left at the resolved default. `.github/workflows/build.yml` is untouched by any of this — the `fail-fast: false` and `timeout-minutes: 30` on the frontend job are the part of apache#6073 that apache#7717 does not cover.
… reds (apache#7623) ### What changes were proposed in this PR? **Rescoped after apache#7717 landed.** That PR merged the jsdom half of this one — `testTimeout: 20000` / `hookTimeout: 30000` in `frontend/vitest.config.ts` — which is what put this branch in conflict. This branch had 30s/30s, so the merge would have reverted a value another author had just landed. Resolved by taking main's verbatim: **`vitest.config.ts` now has no diff against main at all.** What remains is the part of apache#6073 that apache#7717 does not cover, plus a timeout the job was still missing: | Change | File | Rationale | | --- | --- | --- | | `fail-fast: false` | `.github/workflows/build.yml` | one flaky OS leg cancels the other two, destroying the evidence that says flake vs. real break | | `timeout-minutes: 45` | `.github/workflows/build.yml` | the job had no cap, so a true hang ran to GitHub's implicit 6h, holding one of the 50 concurrent macOS jobs the whole `apache` org shares | | `testTimeout` 15s → 30s | `frontend/vitest.browser.config.ts` | 15s is now the tightest per-test ceiling in the job, on its slower runtime | | Timeouts row, scoped per config | `frontend/TESTING.md` | documents apache#7717's values and this one's, separately | #### `fail-fast: false` — the flake destroys its own evidence The `build / frontend` macOS leg goes red on a different unit test every few days: always a timeout, never an assertion, always green on rerun. It is a runner stall landing on whichever test happens to be executing — same commit, same matrix, run [31665399757](https://github.com/apache/texera/actions/runs/31665399757/job/94338769943): | Measure | ubuntu-latest | macos-latest | | --- | --- | --- | | the spec file that failed (10 tests) | 240 ms | **11 727 ms** | | suite wall clock | 89.85 s | 252.88 s | | runner size | 4 cores / 16 GB | 3 cores / 7 GB | Today the default fail-fast then cancels ubuntu and windows, so the run no longer says whether the failure reproduces off macOS — exactly the fact needed to classify it. ``` Before: macOS stalls -> that test fails -> ubuntu + windows cancelled After: macOS stalls -> that leg fails alone; a real break still fails all three ``` The opt-out set becomes `frontend`, `platform`, `platform-integration`, `agent-service`, `infra`. `amber-integration` (2 OS legs) and `pyamber` (3 Python versions) are multi-leg without it; left alone to keep this PR to the frontend job. #### `timeout-minutes: 45` — based on green legs, not typical ones This is a correction to what this PR carried through the last review round. The earlier `timeout-minutes: 30` was based on run `31869822969` alone (legs at 8.6 / 10.0 / 10.7 min) and the comment called 30 "~3x the slowest". Pulling every frontend leg from the last eight `Required Checks` runs says otherwise: | Leg | green legs observed | worst green | | --- | --- | --- | | ubuntu-latest | 8.4 – 9.6 min | 9.6 min | | windows-latest | 7.1 – 11.4 min | 11.4 min | | macos-latest | 10.0 – 21.1 min | **21.1 min** | The 21.1-minute leg is run [32219352076](https://github.com/apache/texera/actions/runs/32219352076) — this branch's own merge push, **passing**. apache#7713 corroborates the range independently at 16m52s. So 30 was 1.4x the worst observed *green* leg, not 3x, and could have ended a run that was merely slow — the same false red `fail-fast: false` is here to stop manufacturing. 45 is ~2x that leg and still cuts a true hang from 6h. The per-step breakdown also relocates the variance: on macOS it is the Angular production build, not the tests. | Run | macOS leg | `Prod build` | `Run frontend unit tests` | | --- | --- | --- | --- | | `32219432444` | 12.4 min | 4.5 min | 4.4 min | | `32117825499` | (failed) | 7.8 min | — | | `32219352076` | 21.1 min | **11.1 min** | 5.3 min | #### Browser mode — 15s is now the tightest ceiling in the job `gui:test-browser` runs on all three OSes, on the same runners. Vitest keys its defaults off `browser.enabled` — read out of the pinned `[email protected]`, `dist/chunks/coverage.DM_a_rWm.js:538-539`: ```js resolved.testTimeout ??= resolved.browser.enabled ? 15e3 : 5e3; resolved.hookTimeout ??= resolved.browser.enabled ? 3e4 : 1e4; ``` So after apache#7717 the per-test ceilings are jsdom 20s vs. browser 15s — the tighter limit sitting on the *slower* runtime, since driving real Chromium through playwright costs more than jsdom. Raised to 30s. `hookTimeout` stays absent: `browser.enabled` already resolves it to the 30s `vitest.config.ts` sets explicitly. **Left out:** capping `maxWorkers` on the macOS leg to cut memory pressure — it trades wall clock for stability and can't be measured from a non-macOS box. ### Any related issues, documentation, discussions? Closes apache#6073 `apache#6073` lists two follow-ups: raise the Vitest timeout, and set `fail-fast: false` on the frontend matrix. apache#7717 delivered the first for jsdom; this PR delivers it for browser mode and delivers the second. ### How was this PR tested? No production code is touched — the changes are CI config, a test-runner config, and a doc row. | Check | Result | | --- | --- | | conflict resolution | `git diff origin/main -- frontend/vitest.config.ts` is empty, so apache#7717's merged values stand unmodified | | `build.yml` parses | `yaml.safe_load` → `jobs.frontend['timeout-minutes'] === 45`, `strategy['fail-fast'] === false`; the same pass over every job confirms the opt-out set is exactly the five named above | | runner cost | `macos-latest` is a standard runner and this repo is public, so [GitHub's runner policy](https://docs.github.com/en/actions/reference/runners/github-hosted-runners) puts the usage at free and unlimited — the 10x multiplier is a billed-minutes rate for private repos. `orgs/apache` reports the `enterprise` plan, whose [limit](https://docs.github.com/en/actions/reference/limits) is 500 concurrent jobs but only 50 concurrent macOS, org-wide — that is the bound the comment names instead | | leg durations | measured from the Actions jobs API across the last eight `Required Checks` runs and per-step for the three macOS legs — not read off the run summary | | browser-mode defaults | read out of the pinned `[email protected]` in `node_modules`, not from the docs | | formatting | `prettier --check frontend/vitest.browser.config.ts` clean. `TESTING.md` is outside `format:ci`'s `src/**` glob and already fails `prettier --check` on main, so it is left as-is | The flake itself can't be reproduced on demand — that is what a runner stall is. What this PR asserts is verifiable: the browser leg's per-test ceiling doubles (15s → 30s), a failing leg no longer cancels its siblings, and a genuine hang ends at 45 minutes instead of 6 hours without threatening a green 21-minute macOS leg. ### Was this PR authored or co-authored using generative AI tooling? Generated-by: Claude Code (Opus 5)
What changes were proposed in this PR?
The
build / frontend (macos-latest)leg failed 6 times between 08-14 and 08-17, each time on a pure timeout in a different spec — never a failed assertion (details and per-failure table in #7713). The leg's own wall time swings ~2x run to run (9m17s–16m52s), and the same test that runs in ~400ms on ubuntu has been observed at 11s+ inside abeforeEachon a loaded macOS runner — while Vitest's default limits (5s test / 10s hook) are fixed absolute values that don't scale with runner load. Nothing in the frontend test setup changed in that window; the margin is simply thin enough that ordinary macOS runner variance crosses it.testTimeout: 20000andhookTimeout: 30000infrontend/vitest.config.ts(which previously set neither, inheriting the 5s/10s defaults) — roughly 4x/3x the worst observed times. Both are needed: 4 of the 6 failures hit the test timeout, 2 hit the hook timeout.vitest.browser.config.ts(the browser-mode leg) deliberately keeps the defaults — no timeout failures have been observed there.hub-search-result/searchstand up real child components to work around the coverage-attribution loss in Template coverage does not register for components whose spec calls TestBed.overrideComponent #7458; undoing that would revert test(frontend): render the dashboard search with its real children #7627 / test(frontend): render the hub workflow detail with its real children #7535).Any related issues, documentation, discussions?
Closes #7713.
How was this PR tested?
vitest.config.tsfor the full 202-spec / 4704-test suite.InlineConfigtypings (tsc --noEmitpasses — the option names and types are validated), andprettier --checkpasses, soformat:ciis unaffected.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code (claude-opus-4-8)