Skip to content

fix(router): enable Strong hook and store bindings - #2086

Merged
trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:codex/strong-router-hooks-2059
Oct 15, 2026
Merged

trueadm merged 3 commits into
octanejs:mainfrom
openai-oss-forks:codex/strong-router-hooks-2059

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Enable Strong mode in Router's useStore, hook bindings, and router-state binding, removing three website dependency boundaries tracked in #2059. Preserve the existing APIs, authored slots, subscriptions, selector semantics, and stable navigation callbacks.

Strong previously skipped production memo lowering even for manually slotted modules. Reuse that compiler path after the existing guard rejects generated Strong cache slots; keep the development, server, signal, profiling, and universal exclusions intact. No new runtime cache or public option.

Extend existing subscription-lifetime and compiler coverage plus the hook-memo benchmark. Teardown counters now report absolute work because unchanged main's hook-free driver performs different cleanup; hit/miss controls and budgets are unchanged.

Fix a website cold-start defect exposed by CI: the isolated pnpm layout filtered out all ten transitive Devtools prebundle entries. Two owner-qualified imports now prebundle the host's full lazy graph and the native event client. Existing browser assertions and timeouts are unchanged.

Validation

  • Scoped formatting and pnpm sync (no generated changes).
  • Router conformance, SSR, and differential tests: 114 passed across 22 files; Router source/public API and core/benchmark typechecks passed.
  • All 12 paired helper emissions match main after normalization across client/server and development/production. All 13 other existing Strong/manual modules retain identical production output.
  • Actual website Strong analysis: 98 files, zero diagnostics; three Router dependency boundaries removed.
  • node benchmarks/bench.mjs --ratios hook-memo: 24 guards pass. Same final harness against main fails four guards: the Strong manual case creates 128 functions and 128 dependency arrays across 32 hits; the fix creates zero. Counts describe source creation events, not heap bytes or latency. The complete benchmark bundle changes +100 raw/−18 gzip bytes.
  • Focused core production/compiler/SSR tests: 393 passed across 11 files; benchmark observer tests: 2 passed. The new Strong manual compiler case failed before the fix (91 controls passed).
  • Matched actual website QA: 24 original navigation/DOM-adoption journeys, 8 public ordinary/compiled Router fixture flows, and 4 settled-history probes across main/candidate, development/production and desktop/narrow viewports. After the config fix, all 6 candidate development journeys pass stricter diagnostic assertions; 3 fresh interactive hydration captures also pass with no warnings. Baseline c6cb71a and integrated 1b1f78d have identical production inputs; their only difference is an MDX HMR test. See the original diagnostic limitation below.
  • Current signed head 235411f06: all required and relevant checks pass. CI passes all 27 jobs: 54,353 unit tests (2 skipped), 105/105 website tests, 616/616 Chromium tests, React parity/example shards, lint/types, compatibility and publication checks. Normal fresh dependency installation and validation of 123 tarballs pass. The benchmark workflow passes: all 64 work counters, 93 bundle values and 120 reachability values are unchanged. All 20 timing operations have no resolved verdict; wide intervals do not establish speed equivalence or improvement. Maintainer approval remains required.
  • perf-review: zero mechanical candidates and no independent-review source blockers for the hook/compiler change. All 25 paired module emissions preserve the existing hot paths. Complete production public JavaScript (614 files, summed per-file gzip level 9): 19,409,867 → 19,409,663 raw bytes (−204), 4,353,393 → 4,353,381 gzip bytes (−12). Four separate binary Lynx containers have unchanged raw size and +3 gzip bytes. These are complete emitted public assets, not an initial-route payload or latency result. Final head retains byte-identical production output to the browser-tested build: all 614 JavaScript files and four binary supplements have identical relative paths and SHA-256 hashes.
  • concise-code: independent review found no source blocker. Total diff: 13 files, +103/-36; shipped package source +9/-1 (client runtime +0/-0), website config +7/-19. New files are one changeset and one 13-line benchmark fixture retaining the non-Strong control. No new runtime state, imports, or public API. A binding-level cache rewrite was rejected because the compiler owns the lost optimization; the website uses its existing nested dependency-resolution mechanism.

Risk / follow-ups

Remaining website boundaries: Router compiled/Matches.tsrx, linkBinding.ts, scriptComponent.tsrx, and Three web/events.ts. This does not enable repository-wide Strong enforcement.

The original candidate development run recorded two Build Tools <code> hydration warnings despite passing its interaction assertions. Their original served client module was not retained, so their cause remains unknown. Final strict development journeys and fresh interactive captures have no warning; the relevant served client template, server markup and hydrated DOM match main exactly. This is not a claim that the original warning was fixed or was existing main behavior.

Back during the destination's native smooth scrolling can miss the original scroll position on both revisions. Waiting for native scrollend then pressing Back restores exactly 360px for all 45 observed frames, with matching settled screenshots at both sizes. Existing Lynx teardown diagnostics, theme-color behavior and deliberate 404 responses are retained separately.

Both local full-suite runs passed 104/105; the generated MDX live-edit assertion timed out, including with CHOKIDAR_USEPOLLING=1. A matched main/candidate check reproduces the timeout on both: disk changes, but the selected macOS file-event backend reports no change event, transform or HMR update. Vite reports both usePolling: true and useFsEvents: true and selects the latter handler. The current-head hosted Linux website job passes all 105 tests, including both live MDX edits and post-HMR hydration. A paired comparison with external server.watch={usePolling:true,useFsEvents:false} passes both edits on the first attempt on both revisions: file events, transforms, WebSocket updates, visible text, original DOM/counter state and fresh SSR/hydration all pass with no console/page errors. Sources were restored exactly. This bounds the local failure to file-event delivery on the selected backend; the underlying missing FSEvents notifications remain unexplained, and no native macOS watcher fix is claimed.

Local fresh installs were blocked by the configured dependency firewall; validation reuses an existing dependency graph after verifying all 514 manifests/lock/workspace inputs match and remapping workspace sources. Current-head hosted CI passes a normal fresh install. Router remains an existing exception in the separate strict packed-source TypeScript matrix; Router source/public typetests and real website builds pass. Existing upstream pristine parity remains recorded-unverified; differential and adapted type evidence are the exercised lanes.

Provenance

  • An agent produced this diff (agent-authored)

Codex task · implementation 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
Touches compiler Strong/memo policy and core router reactive adapters; behavior is heavily tested but affects production hook codegen and subscription wiring.

Overview
Turns on use strong for TanStack Router’s useStore, hook bindings, and router-state binding so those adapters run under Strong policy while keeping authored hook slots and existing subscription/selector behavior.

Compiler: production inline hook memo lowering now applies to manual-slot Strong modules (when generated declaration caches are already rejected), instead of Strong always skipping that path—restoring allocation-free memo hits for Router’s hand-slotted hooks.

Tests & benchmarks: parametrized Strong/manual-slot compiler coverage, a Strong manual-slot hook-memo fixture, and stricter router conformance around atom identity and subscriber lifetime; hook-memo unmount phases report absolute teardown counts (not net of the hook-free driver).

Website: narrows Vite optimizeDeps prebundle entries for the devtools island to workspace-owned nested roots so pnpm isolation doesn’t drop transitive deps and trigger mid-mount 504 optimize failures.

Reviewed by Cursor Bugbot for commit 235411f. 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 15, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 15, 2026 12:39
@github-actions

github-actions Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

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

Compares 1b1f78d24, the merge commit's first parent with db4f1e320 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 5.758 4.292 −5.9% −63.3% … +74.9% ⚪ within noise
octane-tsrx replace 11.492 7.942 −4.1% −20.8% … +4.1% ⚪ within noise
octane-tsrx add 5.042 4.300 −0.6% −10.3% … +2.8% ⚪ within noise
octane-tsrx update 0.243 0.221 +10.2% −16.5% … +42.8% ⚪ within noise
octane-tsrx select 0.010 0.013 +0.4% −5.7% … +26.3% ⚪ within noise
octane-tsrx swap 0.032 0.023 −4.3% −9.0% … +4.0% ⚪ within noise
octane-tsrx remove 0.031 0.024 −12.8% −44.9% … −2.1% ⚪ within noise
octane-tsrx runlots 38.783 42.092 +1.3% −6.3% … +22.9% ⚪ within noise
octane-tsrx select_lots 0.014 0.014 +0.7% −2.2% … +4.3% ⚪ within noise
octane-tsrx clear 53.558 60.758 +4.3% −5.2% … +14.2% ⚪ within noise
octane-jsx run 8.658 8.925 −3.7% −18.3% … +36.0% ⚪ within noise
octane-jsx replace 19.250 17.258 −6.4% −18.0% … +9.8% ⚪ within noise
octane-jsx add 7.158 5.633 −4.0% −7.6% … +7.1% ⚪ within noise
octane-jsx update 0.457 0.454 −3.4% −13.2% … +4.6% ⚪ within noise
octane-jsx select 0.258 0.257 −3.4% −6.5% … +1.8% ⚪ within noise
octane-jsx swap 0.347 0.312 −1.1% −6.1% … +0.4% ⚪ within noise
octane-jsx remove 0.352 0.335 +1.5% −1.0% … +2.9% ⚪ within noise
octane-jsx runlots 33.675 42.442 +2.8% +0.4% … +16.1% ⚪ within noise
octane-jsx select_lots 2.171 2.282 −0.0% −12.8% … +7.5% ⚪ within noise
octane-jsx clear 45.367 46.958 −4.9% −8.8% … +2.6% ⚪ 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 c54cfdd into octanejs:main Oct 15, 2026
34 checks passed
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