Repository navigation
test(octane): let drainProducers run host-budget yields - #1920
Merged
Merged
Conversation
Since #1875 a ready producer whose shared 5 ms host budget is spent waits for a host task (yieldForHostBudget). drainProducers() waited for a single setImmediate, so on a loaded CI shard a stream step could still be parked behind that task and the test saw a pending or stale value. It now runs four rounds of setImmediate plus a postHostTask task, so each round lets at least one parked producer continue. With the budget forced to 1e-9 ms (one unit per window), the old helper failed signals-inspection's stream-activity case, three signals-streams cases, and two signals-unified cases in both octane-signals and octane-signals-prod; three rounds is the minimum that passes them all. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 8, 2026 20:15
Contributor
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 60 measured values. Public-import reachability bundles (bytes)No changes across 111 measured values. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | c7930e6 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 08:44 PM |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | c7930e6 | Commit Preview URL Branch Preview URL |
Oct 08 2026, 08:46 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
drainProducers()intests/_fixtures/signals-async-controls.tsnow runs four rounds. Each round is asetImmediatefollowed by a task posted with the runtime's ownpostHostTask. Before, it waited for onesetImmediate.Why
yieldForHostBudgetinsrc/host-budget.ts). Once the window is spent, a producer waits for a host task. A singlesetImmediatedoesn't reliably cover that wait, so on a slow or loaded shard a test can read a pending value ("Unknown Error: Promise") or a stale one.signals-serialization.test.ts, after its new test file reshuffled the CI shards. It fixed only that file's localdrain(). The same latent failure exists in every suite that settles throughdrainProducers, so this fixes it in the shared helper rather than per test.Validation
Reproduced by temporarily setting
HOST_BUDGET_MS = 1e-9inhost-budget.ts, which this PR leaves at 5.signals-inspection"reports stream activity and retained quiet refresh without exposing payloads" (octane-signals-node).signals-streamscases (octane-signals-node): "does not cancel a data-owned stream when its last public subscription stops", and "reports a throwing iteration-result done getter" / "value getter through the resource".signals-unifiedcases, in bothoctane-signalsandoctane-signals-prod: "publishes stream yields and closes an obsolete iterator" and "keeps a selected watch live after adopting an action receipt".octane-signals-node,octane-signals,octane-signals-prod,octane-signals-strong: 1270/1272 passed. The 2 remaining failures are thesignals-serializationstream-adoption cases. They use that file's owndrain(), which perf(octane): render hookless control-flow arms without a Block #1903 fixes (e7fb961), so this PR leaves that file alone.drainProducersusers (7 hydration files pluscompiler/signal-attempt-reads) inoctane+octane-prod: 1499/1499 passed.pnpm format:files:checkandpnpm typecheck:fileson the fixturepnpm format:check/pnpm typecheck/pnpm test: not run in full locally; CI covers them.perf-review: not applicable. The diff is test-only and touches nopackages/octane/src, compiler output, or binding hot path.concise-code: src +0 −0 (runtime +0 −0). No new files or exports. It reusespostHostTaskinstead of adding another MessageChannel copy.drainProducerscaller).performance.nowper test (hides the yield path the tests would meet on a slow host).Risk / follow-ups
hostTask()copies (reader-task,signal-task,layout-effect-update-priority,conformance/async-actions, and perf(octane): render hookless control-flow arms without a Block #1903'ssignals-serialization). Once perf(octane): render hookless control-flow arms without a Block #1903 lands,signals-serializationcan usedrainProducers. These are outside this diff.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Low Risk
Test fixture only; no production runtime, compiler, or binding changes.
Overview
Test-only: shared helper
drainProducers()insignals-async-controls.tsno longer flushes producer work with a singlesetImmediate. It now runs four rounds, each awaitingsetImmediateand then a runtimepostHostTaskcallback.That matches how ready signal producers resume after
yieldForHostBudgetonce the per-host 5 ms window is spent, so signal/hydration/compiler tests that calldrainProducers()stop flaking on slow or loaded CI shards (stale reads / "Unknown Error: Promise"). Runtime and host budget are unchanged.Reviewed by Cursor Bugbot for commit c7930e6. Bugbot is set up for automated code reviews on this repo. Configure here.