Repository navigation
fix(compiler): allow ref access and state getters in Strong effect setup - #1849
Merged
Merged
Conversation
Strong mode reported OCTANE_STRONG_EFFECT_HIDDEN_DEPENDENCY when effect setup read a ref's `current` (unless the ref was attached or passed somewhere) or called a state getter. Neither is an effect dependency: a ref holds a value the effect uses without re-running, and a getter reads the latest state without subscribing. Previous-value refs, ref counters, callback-ref element maps, useLazyRef stores, and getter calls therefore failed to compile in useEffect, useLayoutEffect, and useInsertionEffect. Both report paths are removed. The value-ref classification that fed only this rule goes with them; host-element classification, which the resource-leak check uses, stays. The diagnostic still reports a reassigned module variable read in effect setup, and render-time ref access and getter calls stay errors. Co-Authored-By: Claude Opus 5.5 <[email protected]>
trueadm
marked this pull request as ready for review
October 7, 2026 15:21
Contributor
Benchmark report
Compares js-framework: 1k/10k row operations
All 20 timed operations (19 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 108 measured values. |
trueadm
added a commit
that referenced
this pull request
Oct 7, 2026
Conflict: the user-apps-v1 manifest.jsonl, regenerated by pnpm sync for the 0.11.1 package versions. The merge takes #1849 and the Version Packages release (#1850); the Lynx-lanes changeset with the 0.18.0 parser pin stays unreleased. #1849's three Strong test files pass on this branch (683 tests). Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
Fixes a Strong mode bug:
OCTANE_STRONG_EFFECT_HIDDEN_DEPENDENCYrejected effect setup that read or wrote a ref'scurrent, or called a state getter. Neither is an effect dependency. A ref holds a value the effect uses without re-running, and a getter reads the latest state without subscribing; the inferred dependency arrays already exclude both. Ordinary React patterns failed to compile inuseEffect,useLayoutEffect, anduseInsertionEffectsetup as a result:Changes
strong-mode.js: removed the value-ref reports (member reads, destructuredcurrent, and compound updates) and the getter-call report in effect setup.strong-effects.js: removed the value-ref classification (escaped,isValueRef, the use classifier, and the dependency-list table) that fed only this rule. Host-element classification stays, including callback-ref attachment validity, because the resource-leak check uses it to require cleanup for listeners on attached elements.let/varread in effect setup. Render-time ref reads and writes and render-time getter calls (OCTANE_STRONG_RENDER_REF_READ,_REF_WRITE,_STATE_GETTER_CALL) are unchanged.docs/strong-compiler-checks.md,docs/tsrx-basics.md, the MCPreact-divergencesskill, and the Strong guide are updated; the website reference,llms.txt, MCP catalog, and CLI data are regenerated bypnpm sync.octaneand@octanejs/mcp-server.mainalready carries the 0.11.0 bump, so this releases as 0.11.1.Tests
useLazyRefstores. They failed before the fix.strong-hook-policy.test.tsthat attached a ref to a<div>only to get past the old rule.Validation
pnpm format:files:checkon changed files (not the repo-widepnpm format:check)pnpm typecheck:fileson the changed compiler and test files (not the fullpnpm typecheck)pnpm test(not run locally; left to CI)strong-effects,lazy-ref-strong,strong-hook-policy,strong-diagnostics-catalog,strong-mode(1,633 passed,--project octane)pnpm sync,pnpm strong:diagnostics:checkRisk / follow-ups
useEffectEventor attaching a ref only to make it readable, still compile; they were not swept.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Note
Medium Risk
Narrows a core Strong diagnostic and ref classification used by resource-leak proofs; behavior change is intentional but could affect teams that relied on the old hidden-dependency errors or workarounds.
Overview
Strong mode no longer treats ref
currentaccess or state getter calls in effect setup as hidden dependencies, aligning with React: those reads are intentional non-reactive escapes and are not inferred effect dependencies.OCTANE_STRONG_EFFECT_HIDDEN_DEPENDENCYnow applies only to reassigned modulelet/varreads in synchronoususeEffect/useLayoutEffect/useInsertionEffectsetup. Compiler changes drop the old “value ref” escape analysis (isValueRef,escaped, getter/ref reports instrong-mode.js) while keeping host-ref attachment tracking forOCTANE_STRONG_EFFECT_RESOURCE_LEAK(callback-ref attachment cases now assert leak behavior instead of hidden-dependency).Emitted code is unchanged—diagnostics and docs/catalogs (
strong-diagnostics, MCP, CLI data, website) are updated accordingly; tests flip previously rejected patterns (previous-value refs, ref counters,getCount(),useLazyRefstores) to accepted.Reviewed by Cursor Bugbot for commit 67758c0. Bugbot is set up for automated code reviews on this repo. Configure here.