Skip to content

fix(frontend): give unit tests timeout headroom for loaded macOS runners - #7717

Merged
mengw15 merged 3 commits into
apache:mainfrom
mengw15:fix/7713-frontend-test-timeout-headroom
Aug 17, 2026
Merged

mengw15 merged 3 commits into
apache:mainfrom
mengw15:fix/7713-frontend-test-timeout-headroom

Conversation

@mengw15

@mengw15 mengw15 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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 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. Nothing in the frontend test setup changed in that window; the margin is simply thin enough that ordinary macOS runner variance crosses it.

Any related issues, documentation, discussions?

Closes #7713.

How was this PR tested?

  • Config-only change with no executable code; the frontend CI legs themselves exercise it by loading vitest.config.ts for the full 202-spec / 4704-test suite.
  • Type-checked the edited config against Vitest's InlineConfig typings (tsc --noEmit passes — the option names and types are validated), and prettier --check passes, so format:ci is unaffected.
  • No spec sets a per-test timeout override (verified by grep), so the global raise applies uniformly.

Was this PR authored or co-authored using generative AI tooling?

Generated-by: Claude Code (claude-opus-4-8)

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.
@github-actions github-actions Bot added fix frontend Changes related to the frontend GUI labels Aug 17, 2026
@Yicong-Huang Yicong-Huang added the release/v1.2 back porting to release/v1.2 label Aug 17, 2026
@github-actions
github-actions Bot requested a review from xuang7 August 17, 2026 03:44
@github-actions

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. release/* labels drive the post-merge backport, so add or remove one to change where this fix lands.

Release branch Analysis
✅ release/v1.2 Change detected on this branch — label added; this fix is queued to backport here. Requested review from @xuang7.

Auto-label run.

@github-actions

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Contributors with relevant context: @Yicong-Huang
    You can notify them by mentioning @Yicong-Huang in a comment.

Copilot AI 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.

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.

Comment thread frontend/vitest.config.ts Resolved
@codecov-commenter

codecov-commenter commented Aug 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.93%. Comparing base (7a2c8d0) to head (fa005aa).

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     
Flag Coverage Δ *Carryforward flag
access-control-service 81.00% <ø> (ø) Carriedforward from 7a2c8d0
agent-service 98.62% <ø> (ø) Carriedforward from 7a2c8d0
amber 87.40% <ø> (ø) Carriedforward from 7a2c8d0
computing-unit-managing-service 73.67% <ø> (ø) Carriedforward from 7a2c8d0
config-service 86.73% <ø> (ø) Carriedforward from 7a2c8d0
file-service 68.90% <ø> (ø) Carriedforward from 7a2c8d0
frontend 92.43% <ø> (-0.01%) ⬇️
notebook-migration-service 83.74% <ø> (ø) Carriedforward from 7a2c8d0
pyamber 97.57% <ø> (ø) Carriedforward from 7a2c8d0
workflow-compiling-service 77.19% <ø> (ø) Carriedforward from 7a2c8d0

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Yicong-Huang Yicong-Huang 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.

🟡 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)

@mengw15
mengw15 added this pull request to the merge queue Aug 17, 2026
Merged via the queue into apache:main with commit e80add4 Aug 17, 2026
23 checks passed
@mengw15
mengw15 deleted the fix/7713-frontend-test-timeout-headroom branch August 17, 2026 08:24
@github-actions

Copy link
Copy Markdown
Contributor

Backport PR opened: draft #7736 (#7736) to release/v1.2, assigned to @mengw15 — needs manual work because the cherry-pick conflicts.

aglinxinyuan added a commit to aglinxinyuan/texera that referenced this pull request Aug 19, 2026
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.
renovate-bot pushed a commit to renovate-bot/apache-_-texera that referenced this pull request Aug 29, 2026
… 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix frontend Changes related to the frontend GUI release/v1.2 back porting to release/v1.2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

frontend: macOS test leg has too little timeout headroom — 6 timeout failures in 3 days across 5 different specs

4 participants