Skip to content

fix(browser): serialize headed file execution#1017

Merged
fi3ework merged 1 commit intomainfrom
fix/browser-headed-serial-files
Mar 6, 2026
Merged

fix(browser): serialize headed file execution#1017
fi3ework merged 1 commit intomainfrom
fix/browser-headed-serial-files

Conversation

@fi3ework
Copy link
Copy Markdown
Member

@fi3ework fi3ework commented Mar 6, 2026

Summary

Headed browser test execution previously ran all test files in parallel by
firing reloads concurrently and waiting on a single shared "all tests done"
promise. This PR replaces that approach with a HeadedSerialTaskQueue that
runs one file at a time, waits for iframe frames to be ready before starting,
and applies a per-file timeout instead of a single global timeout.

Behavior diff:

+------------------+----------------------------------------------+--------------------------------------------+
|  Aspect          |  Before                                      |  After                                     |
+------------------+----------------------------------------------+--------------------------------------------+
|  Execution order |  All files reloaded concurrently             |  Files run one-at-a-time via serial queue  |
|  Readiness sync  |  No frame-ready handshake; races possible    |  Host waits for onRunnerFramesReady RPC    |
|  Timeout scope   |  One global timeout (max × file count + 30s) |  Per-file timeout (testTimeout + 30s)      |
|  iframe src      |  Always set to runner URL                    |  Set to about:blank until runId is known   |
+------------------+----------------------------------------------+--------------------------------------------+

Changes:

  • headedSerialTaskQueue.ts — new module; serial promise queue that keeps
    draining on individual task failures
  • hostController.tswaitForRunnerFramesReady / markRunnerFramesReady
    handshake; per-file reloadTestFileWithTimeout; enqueueHeadedReload
    replaces direct rpcManager.reloadTestFile calls; watch-mode rerun also
    uses the queue
  • browser-ui/main.tsx — notifies host via onRunnerFramesReady once frames
    are mounted; defers iframe src to about:blank until runId is assigned;
    setActive called immediately on rerun trigger
  • HostRPC / HostRpcMethods — new onRunnerFramesReady method added to
    both the UI-side type and the host RPC handler

@fi3ework fi3ework enabled auto-merge (squash) March 6, 2026 06:42
@fi3ework fi3ework merged commit ead4ea5 into main Mar 6, 2026
11 checks passed
@fi3ework fi3ework deleted the fix/browser-headed-serial-files branch March 6, 2026 06:48
@9aoy 9aoy mentioned this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant