Skip to content

fix: retain named Strong values passed through component children - #2051

Merged
trueadm merged 1 commit into
octanejs:mainfrom
openai-oss-forks:fix/strong-deferred-named-literals
Oct 14, 2026
Merged

trueadm merged 1 commit into
octanejs:mainfrom
openai-oss-forks:fix/strong-deferred-named-literals

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Strong components can now retain an eligible setup-created object or array passed to a prop through another component's children. For example, const channel = { name: props.name } passed to a nested provider used to unsubscribe and resubscribe retained consumers on an unrelated parent update. That subscription now stays active until the name changes or the consumer unmounts.

Why

The literal proof found prop reads immediately below host elements, but stopped at every component's children. That excluded already-evaluated named values as well as expressions whose evaluation really does belong to the child.

Changes

Keep the existing literal, escape and mutation proof. Inside component children, collect only eligible identifier reads; never hoist an inline expression. Directives, callbacks and excluded built-in/member boundaries keep their previous behavior. No new runtime machinery or public API. Includes an Octane patch changeset.

Validation

  • pnpm format:check (repository-wide; scoped Prettier passed for all three files)
  • pnpm typecheck (repository-wide; pnpm typecheck:files passed for compiler and test)
  • pnpm test (repository-wide; targeted core suites used)
  • 794 tests pass across 12 dev/prod files: Strong hook caches/ownership, auto memo/calculation/callback, context, memo, hooks and refs.
  • Stock 0.13.4 fails all 8 new TSRX/TSX dev/prod nested-value lifecycle cases and all 4 hydrated cases through premature cleanup/resubscription. Candidate passes; input DOM and an edit made before hydration survive the update.
  • Removing the deferred-expression guard makes all 8 safety cases fail by reading an inline value while its child is hidden. Restoring the guard passes all 8. Existing mutable literal/callback cases remain green.
  • An unchanged compiled consumer Text suite improves from 7/8 on stock 0.13.4 to 8/8 on this compiler. This is consumer test evidence, not a general application latency claim.
  • Before/after benchmarks/template-call-memo: all visible output, keyed identity, event and teardown controls pass; every deterministic work count is unchanged. Compatibility compiled/gzip: 3817/62471 B; Strong: 4770/62944 B before and after.
  • pnpm sync, changed-file formatting, scoped typecheck and git diff --check pass. Sync produces no extra tracked changes. Independent complexity review has no unresolved findings.

Perf review

Compiler-scoped perf-review-scan reports 0 candidates. The changed walk runs during compilation on Strong component/entered-body trees; only eligible named literals gain an existing memo slot. No runtime shape, DOM, or scheduling code changes. Collateral deterministic work and size are measured above. Whole-application size, compiler throughput, and browser latency were not measured.

Risk / follow-ups

Nested Strong child trees cost a little more analysis at compile time. Admitted literals retain their existing memo slot until the owning render scope is released. Built-in boundaries and directive/callback scopes remain conservative. Server, native and universal paths keep their existing rules.

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.


Note

Medium Risk
Changes Strong compile-time literal retention and subscription lifetimes for nested JSX, but stays compiler-only with conservative deferred hoisting and broad regression coverage.

Overview
Strong setup values like const context = { name: props.name } can now keep their memo identity when passed to a prop inside another component's children (e.g. a nested <Channel value={context}>). Unrelated parent re-renders no longer force consumers to unsubscribe and resubscribe until the underlying value actually changes.

The compiler's hoistStrongRenderCalculations walk now threads a deferred mode through component child trees: it still records eligible identifier reads on child props for existing Strong literal memo slots, but it does not hoist inline expressions out of those children. Inline props such as value={{ name: read(props.name) }} continue to run only when the child actually renders (including when a wrapper withholds children).

Adds an Octane patch changeset and Strong hook/cache tests for nested named context, hydration, and deferred child evaluation.

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

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

Copy link
Copy Markdown
Contributor

Benchmark report

🟢 No byte growth, no added work, and no timing changes beyond ±3%.

Compares d83411a93, the merge commit's first parent with 7e9dfdb27 on the same runner. Any increase in a js-framework work counter fails this check; byte changes are a report. 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.650 2.633 ±0.0% −3.5% … +3.5% ⚪ within noise
octane-tsrx replace 8.342 8.242 −0.6% −4.4% … +3.7% ⚪ within noise
octane-tsrx add 2.558 2.642 +1.8% ±0.0% … +4.0% ⚪ within noise
octane-tsrx update 0.137 0.132 −0.8% −2.9% … +1.5% ⚪ within noise
octane-tsrx select 0.006 0.006 −0.0% −1.4% … +2.4% ⚪ within noise
octane-tsrx swap 0.017 0.017 +0.3% −2.2% … +1.1% ⚪ within noise
octane-tsrx remove 0.016 0.015 +0.0% −2.4% … +3.4% ⚪ within noise
octane-tsrx runlots 29.450 29.683 +0.4% −0.9% … +4.3% ⚪ within noise
octane-tsrx select_lots 0.007 0.007 −0.3% −2.8% … +1.8% ⚪ within noise
octane-tsrx clear 49.517 49.117 −0.5% −6.7% … +4.7% ⚪ within noise
octane-jsx run 3.617 3.633 +2.9% +0.0% … +5.5% ⚪ within noise
octane-jsx replace 7.883 7.792 −4.0% −6.3% … −0.8% ⚪ within noise
octane-jsx add 3.492 3.517 −1.0% −5.2% … +2.8% ⚪ within noise
octane-jsx update 0.268 0.272 ±0.0% −2.7% … +2.2% ⚪ within noise
octane-jsx select 0.138 0.140 +1.0% −1.6% … +2.3% ⚪ within noise
octane-jsx swap 0.179 0.175 −0.5% −3.8% … +1.8% ⚪ within noise
octane-jsx remove 0.176 0.180 −0.3% −1.8% … +2.0% ⚪ within noise
octane-jsx runlots 28.942 28.658 +0.7% −1.5% … +2.2% ⚪ within noise
octane-jsx select_lots 1.610 1.567 −3.1% −7.1% … +0.3% ⚪ within noise
octane-jsx clear 46.525 45.658 −0.6% −2.2% … +1.2% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

No changes across 93 measured values.

Public-import reachability bundles (bytes)

No changes across 120 measured values.

@trueadm
trueadm merged commit 7d003a4 into octanejs:main Oct 14, 2026
53 checks passed
trueadm added a commit that referenced this pull request Oct 15, 2026
Brings in #2047-#2051 (Strong literal stabilisation), #2054 (checked
compiled boundaries and a compiled router entry), #2055/#2057 (Strong
rejects descriptor APIs and .tsx/.jsx), #2056/#2060/#2061 (CLI Strong
reports), #2062 (Strong in the website and devtools), #2065 (no
browser-translation DOM accommodations) and Version Packages.

Conflicts, resolved so main's behaviour lands on the redesign's commit model:
- runtime.ts, #2065: setText keeps main's legacy host-only convention and the
  redesign's hydration writeText. The translator recovery is gone from
  renderText/commitText, setRenderText/commitSetText, commitHole,
  childTextHoleUpdate, recordHole and bindSignalChild; removeOnlyChildText
  still removes a committed Text at commit. resetOnlyChildHost and
  PENDING_HOST_TEXTS (which served only the host-only text writes) are deleted.
- compile.js, #2065: text updates call setRenderText(_txt, v), commit
  functions setText(_txt, v), and commitHole takes no host.
- runtime.server.ts, #2054: a compiled-only frame checks its output;
  ordinary frames keep the redesign's returned-value normalization.
- codes.json: main's 344-346 (CompiledContext, CompiledOutlet) keep their
  numbers; the redesign's codes move to 347 (server boundary error), 348
  (hydration protocol skew) and 349 (frontier rehome). Generated tables and
  CLI data are regenerated; docs/ssr.md names #348.

Adaptations:
- compiled-boundaries.test.ts: the server runs no error boundary (React's
  model), so an invalid CompiledOutlet under a catch-only @Try fails
  renderToString with the CompiledOutlet error; the client still shows the
  catch arm.
- scripts/render-writers.mjs drops resetOnlyChildHost.

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