Skip to content

fix(octane): keep captured queries lazy through guarded rerenders - #1768

Merged
trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/lazy-captured-queries
Oct 5, 2026
Merged

trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/lazy-captured-queries

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Depends on #1784; do not merge before it. This branch tracks landed main (3754039) while #1784 is in progress. Once #1784 lands, integrate its final main and run pinned current-head CI again. #1776 is on hold pending those measurements, not a prerequisite.

Keep guarded queries lazy across unrelated renders, even when the query is captured by a derived computation. Previously, comparing captures during a re-render resolved an unopened query and started its loader. Capture comparison now checks the existing normalized scope node first; an unread query declines equality without being initialized, so opening the guard still uses the latest selection.

Adds a patch changeset and a compiled regression with two object-valued deriveds. The test changes the query selection while closed and verifies that opening starts only the current request. Existing pending-capture convergence behavior is preserved.

Validation

Risk / follow-ups

Full workspace and locked-toolchain CI still needed. Local scoped typecheck could not read the project (the fallback compiler does not support --runExternalCode); binding-vanilla measurement lacked a binding dependency. No full browser or deployed-app claim.

Historical main fb404c2 breached the old deferred-hydration raw cap. #1784 substantially changes that output; validate against its landed, pinned build before considering any budget increase.

Provenance

  • An agent produced this diff (agent-authored)

Codex task · host com-79386


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

Medium Risk
Changes core derived/query capture comparison in the signals facade, which controls when loaders run and how redeclarations commit across renders.

Overview
Guarded query$ handles no longer start loading during unrelated rerenders when they are captured by a derived$ branch that is not being read yet. Capture equality in Descriptor[SIGNAL_SAME_CAPTURE] now resolves the normalized scope and checks for an existing cell before treating a capture as the same; if the query was never read, comparison returns false without initializing the loader.

When the guarded branch is first entered, the closure re-runs with the latest selection (e.g. after props change while still inactive), instead of reusing a stale capture from an earlier render.

Adds a GuardedQuery regression (nested object-valued deriveds, tick + prop update while closed, then open) and an octane patch changeset.

Reviewed by Cursor Bugbot for commit 3627fba. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Oct 5, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 5, 2026 12:36
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 2 value(s) increased within budget

Compares 9c8429317, the merge commit's first parent with a2a54141b on the same runner. A byte value over its committed budget or any increase in a js-framework work counter fails this check. Wall time is a report: base and head samples alternate in one browser, and an operation is called slower or faster only when the 95% confidence interval of its ratio excludes ±3%. Workflow run

js-framework: 1k/10k row operations

All 20 timed operations (20 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 2.567 2.508 ±0.0% −0.0% … +0.0% ⚪ within noise
octane-tsrx replace 5.483 5.483 −0.9% −3.6% … +4.4% ⚪ within noise
octane-tsrx add 2.342 2.333 ±0.0% −4.0% … +4.3% ⚪ within noise
octane-tsrx update 0.124 0.119 −2.9% −4.6% … −1.6% ⚪ within noise
octane-tsrx select 0.005 0.005 +1.1% ±0.0% … +2.3% ⚪ within noise
octane-tsrx swap 0.034 0.034 −1.1% −1.7% … +0.3% ⚪ within noise
octane-tsrx remove 0.018 0.017 −1.1% −2.3% … ±0.0% ⚪ within noise
octane-tsrx runlots 25.950 25.900 +1.4% −1.0% … +3.5% ⚪ within noise
octane-tsrx select_lots 0.006 0.006 −0.3% −2.1% … +1.2% ⚪ within noise
octane-tsrx clear 50.325 50.250 +1.6% −3.6% … +3.3% ⚪ within noise
octane-jsx run 5.325 5.267 −4.0% −14.4% … +3.5% ⚪ within noise
octane-jsx replace 9.783 9.617 −1.4% −5.3% … +3.4% ⚪ within noise
octane-jsx add 3.258 3.275 +2.7% −2.7% … +5.1% ⚪ within noise
octane-jsx update 0.256 0.246 −0.7% −2.1% … +0.7% ⚪ within noise
octane-jsx select 0.136 0.137 −1.0% −2.8% … +1.0% ⚪ within noise
octane-jsx swap 0.254 0.287 +1.0% −0.7% … +4.4% ⚪ within noise
octane-jsx remove 0.185 0.183 −0.5% −2.2% … +0.5% ⚪ within noise
octane-jsx runlots 30.433 29.950 +0.2% −4.6% … +1.3% ⚪ within noise
octane-jsx select_lots 1.407 1.440 −0.6% −3.0% … +2.4% ⚪ within noise
octane-jsx clear 46.750 48.042 +2.7% +0.4% … +5.5% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx bindings_js_gzip 239,552 239,539 −13 (−0.0%) 🟢
octane-tsrx bindings_js_brotli 204,091 204,213 +122 (+0.1%) 🔴
octane-tsrx bindings_app_gzip 121,383 121,370 −13 (−0.0%) 🟢
octane-tsrx bindings_app_brotli 101,517 101,639 +122 (+0.1%) 🔴

56 other measured values are unchanged.

Public-import reachability bundles (bytes)

No changes across 105 measured values.

@trueadm
trueadm merged commit ba46692 into octanejs:main Oct 5, 2026
50 of 54 checks passed
trueadm added a commit that referenced this pull request Oct 5, 2026
…#1772 and #1794

Same method as before: each budget is main's value minus the measured
esbuild-to-Oxc difference on the merged source, never raised (131
lowered, 28 unchanged). The baseline record and home summary follow the
new bytes; every ratio guard still holds with the ceilings already cut.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm added a commit that referenced this pull request Oct 6, 2026
* ci(bench): measure bundle sizes with Vite 8's default minifier

The bundle-size and bundle-reachability harnesses forced Vite's
`minify: 'esbuild'`. That mode turns Rolldown's own minifier off, and with
it the dead-code elimination that removes branches guarded by a
never-written module flag, so the numbers were not what a Vite app ships.

- run.mjs builds every framework with `minify: 'oxc'` (Vite 8's default
  client minifier), still identical settings for every target.
- run-minimal.mjs builds its Vite scenarios with `'oxc'`; the esbuild
  bundler scenarios keep esbuild's `minify: true`. The async-identity
  encoder check accepts Oxc's template-literal quotes.
- Every budget is ratcheted down (144 lowered, 15 unchanged, 0 raised),
  the bundle-size baseline is re-recorded, the 18 cross-framework ratio
  guards are re-cut, and the website summary and copy follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): re-measure the Oxc budgets on main with #1761 and #1782

Budgets move by the measured esbuild-to-Oxc difference on the same
source (budget - max(0, esbuild - oxc)), so the methodology change
lowers 131 values, keeps 28, raises none, and leaves the headroom #1782
granted to #1783 in place. The baseline, ratio guards and website
summary are recomputed from the merged source.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(website): compare home summary ceilings at stable precision

The smoke test rounds each summary row to 15 significant digits because
Math.log/exp can differ by one ULP between libc implementations, but it
compared the bundle-size range ends exactly. Those ends are geometric
means too: the recorded Solid ceiling was 0.9500824085923075 on macOS and
0.9500824085923076 on the Linux runner. Round them the same way.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): re-derive the Oxc budgets on main with #1766, #1768, #1770, #1772 and #1794

Same method as before: each budget is main's value minus the measured
esbuild-to-Oxc difference on the merged source, never raised (131
lowered, 28 unchanged). The baseline record and home summary follow the
new bytes; every ratio guard still holds with the ceilings already cut.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): re-derive the Oxc budgets on main with #1783

#1783 landed and spent the headroom #1782/#1793/#1794 granted it. Each
budget is again main's value minus the measured esbuild-to-Oxc
difference on the merged source (131 lowered, 28 unchanged, none
raised). The baseline record, home summary and refresh note follow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* ci(bench): re-cut the cross-framework ratio guards after #1784

With #1784's hydrating flag folded by Oxc, Octane's totals shrink 8.5-10%
instead of about 5%, so the total-gzip ceilings had grown about 6% loose.
They are re-cut at about 1.5% headroom on the merged-source measurement;
application-code ceilings are unchanged. All 72 bundle-size guards hold.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants