The GitHub Actions job "Required Checks" on texera.git/main has succeeded.
Run started by GitHub user github-merge-queue[bot] (triggered by 
github-merge-queue[bot]).

Head commit for run:
2a152549ed68c726ad1ab44925b9bc04e7f38c04 / Meng Wang <[email protected]>
fix(frontend): fork test ProxyZone from the root zone to bound nesting (#6600)

### What changes were proposed in this PR?

Frontend unit tests intermittently failed on CI with `RangeError:
Maximum call stack size exceeded` in unrelated specs (e.g.
`notification.service.spec.ts`,
`filters-instructions.component.spec.ts`). The cause is in
`frontend/src/test-zone-setup.ts`, which wraps Vitest's `it`/`test` so
each spec body runs inside an Angular ProxyZone (needed for
`fakeAsync`/`waitForAsync`). It forked a new ProxyZone from
`Zone.current` for every test. When an async spec resolves, its
continuation can leave the forked proxy as the current zone, so the next
fork nests inside it; across the many spec files a Vitest worker runs,
the proxy chain grows without bound and eventually overflows the stack
inside the `ProxyZoneSpec.onInvoke -> _ZoneDelegate.invoke` delegate
chain.

Because the depth reached depends on how Vitest packs test files onto
workers, the failure is flaky and OS-dependent (observed on
`macos-latest` while `ubuntu-latest`/`windows-latest` pass on the same
commit), and it can evict an otherwise-green PR from the merge queue.

The fix aligns `test-zone-setup.ts` with zone.js's own framework
integrations: fork a single ProxyZone from `Zone.root` once, reuse it
for every test, and reset its delegate between tests. Forking from the
root zone keeps the proxy exactly one level deep regardless of prior
test state, so the chain can no longer grow.

### Any related issues, documentation, discussions?

Closes #6593.

### How was this PR tested?

Added `frontend/src/test-zone-setup.spec.ts`, which asserts the proxy is
present and forked directly under the root zone (bounded depth) and that
`fakeAsync`/`waitForAsync` still work through the wrapper. Ran all
ProxyZone-sensitive specs (every `fakeAsync`/`waitForAsync` spec)
locally with and without the change: the new tests pass and no existing
test regresses. The flake is not deterministically reproducible from a
single spec, so it is not reproduced as a unit test.

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

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

Report URL: https://github.com/apache/texera/actions/runs/29771844198

With regards,
GitHub Actions via GitBox

Reply via email to