Skip to content

feat: support checked compiled boundaries and a compiled router entry - #2054

Merged
trueadm merged 4 commits into
octanejs:mainfrom
openai-oss-forks:feat/compiled-router-boundaries
Oct 14, 2026
Merged

trueadm merged 4 commits into
octanejs:mainfrom
openai-oss-forks:feat/compiled-router-boundaries

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

Applications that deliberately render only compiler-owned components at dynamic route or context boundaries still have to retain generic JSX, text, array, and portal handling. Add checked CompiledOutlet, CompiledContext, and createCompiledContext for this opt-in contract on client and server. Invalid returned output fails clearly. Ordinary rendering, including ordinary children inside a compiled component, keeps its existing contract.

Add @octanejs/tanstack-router/compiled: core base route constructors, a paired provider, outlet, hooks, and lazy route component. It uses the standard router and store lifecycle, handles matched/pending/error/not-found routes, and rejects shell options that would bypass the checked contract. Standard router imports keep their existing concrete route-bound APIs.

Client roots validate and snapshot initialSignals without serializing and parsing the entire manifest first. SSR wire-format checks remain in place. Includes package docs, minor changesets for both APIs, and generated catalogs.

Validation

  • Octane and router package/public API typechecks; affected runtime, router, compiler, SSR/hydration and signal-manifest tests (366 existing and new core tests, 99 router tests, 9 router SSR tests).

  • SSR nesting regression checked against the previous PR commit using the same full conformance suite: Node 24 went from 8 failed / 74 passed to 82/82 passed. Node 26 also passes 82/82. The new fixture covers ordinary child descriptors inside and after a compiled outlet; original conformance tests unchanged.

  • Existing initial-document signals production SSR/hydration guard.

  • Packed both packages; verified an isolated real consumer after dropping both first-party patches. All 28 component sources compile for client and server (56/56); all 12 existing history/retention and production composer tests pass, including SSR/hydration, draft/focus/selection, IME, lazy-load/rejection.

  • pnpm sync, full pnpm format:check plus formatting on later changes, changeset checks, Octane production package build/tests.

  • Full current-head CI: all four Node 24 test shards, full typechecks, lint, all React parity lanes, Chromium and heavy integration, examples, publishable packages, bundle checks, and CI provenance pass. 30/30 PR checks green for e01dfbdf14, including the benchmark.

  • Shard 1/4 rerun on the identical SHA cleared a single load-sensitive timeout in an existing behavior-root test. No timeout or test coverage changes.

Perf review: compiled-router-boundaries

git diff f7b41dcc HEAD -- packages/octane/src | node scripts/perf-review-scan.mjs --diff - --json: 0 runtime candidates. The scan's diff mode does not check class shape; manual review confirms no new BlockImpl or ScopeImpl fields. Router source scan: 14 candidates.

Hot paths: checked client slot/provider, once per compiled render; SSR frame, once per component; compiled router Matches, per active match. The SSR frame uses an optional internal true selector and a direct ordinary output call: defaulted callback dispatch reduced recursive depth and has been removed. Initial document validation runs once per root. No new scheduling or layout reads.

Severity Location Finding Evidence
report runtime.server.ts SSR frame; compiled router Matches New checked boundaries may change bundle retention/SSR cost. CI benchmark for e01dfbdf14: all 64 work counters unchanged; all 20 timed operations within noise. Repository Wayfinder complete JS gzip +20 B; full framework gzip +128 B; server-render import gzip +38 B. 84 other application and 113 other public-import values unchanged. Original production consumer complete bundle unavailable as noted below.

Dismissed: 12 rest/arguments hits in hookBindings.ts and one in routerStateBinding.ts move the existing slot-aware overloads into factories initialized once. The last in compiled/bindings.ts preserves that same compiler slot convention. They add no subscriptions or render hops. Standard and compiled provider tests cover them.

concise-code: new files publish the opt-in entry and its checked matches/contexts; shared hook, state, and lazy-loader modules avoid copying existing implementations. Required runtime exports are the three checked primitives and their generated errors. Type-only standard route chain declarations preserve bound hooks after addChildren/lazy options. A renderer-wide mode or a second copy of router hooks is unnecessary. Independent read-only complexity review: no must-fix findings.

Risk / follow-ups

Use the paired provider/hooks from the same entry and supply compiled route components, including lazy targets. We have source-compilation and existing consumer-test evidence, not a complete production build of the original application: an independent third-party patch series is incomplete in its draft checkout. No original-application complete-bundle or latency claim. Locally, full-workspace installation was blocked by unrelated registry policy dependencies; scoped runs used the approved lockfile with --config.verify-deps-before-run=false.

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
Opt-in APIs, but they extend core client/SSR render paths and require not mixing standard vs compiled router providers; invalid dynamic route components now throw instead of silently mis-rendering.

Overview
Adds checked compiled-only boundaries in Octane: createCompiledContext, CompiledContext, and CompiledOutlet for dynamically selected views that must be compiler-owned output (no returned JSX/text/descriptors). Client and SSR enforce the contract with new errors 344–346; the compiler treats real octane imports of these builtins as void-output slots (including under HMR).

Streamed document signal bootstrap now validates in-memory initialSignals via exported validateNativeSignalManifest instead of round-tripping through JSON parse.

Introduces opt-in @octanejs/tanstack-router/compiled: CompiledRouterProvider, router CompiledOutlet, lazyCompiledRouteComponent, and matching hooks on compiled-only contexts—same TanStack matching/navigation, rejects Wrap/InnerWrap/shellComponent. Standard router entry keeps descriptor-capable RouterProvider/Outlet; hook logic is factored into shared factories (hookBindings, lazyRouteLoader, routerStateBinding), and useTransitioner takes an explicit router instance.

Docs, changesets, conformance tests for boundaries, hydration, pending/lazy routes, and type tests for route addChildren/lazy ergonomics.

Reviewed by Cursor Bugbot for commit e01dfbd. 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 feat PR: new feature or capability labels Oct 14, 2026
@domgan-oai
domgan-oai marked this pull request as ready for review October 14, 2026 14:33
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🔴 bundle-size: 8 value(s) increased
  • 🔴 bundle-reachability: 5 value(s) increased

Compares f7b41dccc, the merge commit's first parent with 3e4bcd01c 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 3.917 4.117 −5.1% −17.0% … +7.1% ⚪ within noise
octane-tsrx replace 8.225 8.192 +4.9% −0.7% … +21.6% ⚪ within noise
octane-tsrx add 2.892 2.908 +1.6% −0.0% … +5.8% ⚪ within noise
octane-tsrx update 0.152 0.143 −4.5% −6.8% … −0.6% ⚪ within noise
octane-tsrx select 0.006 0.006 +0.5% −1.0% … +2.9% ⚪ within noise
octane-tsrx swap 0.021 0.020 ±0.0% −4.3% … +2.1% ⚪ within noise
octane-tsrx remove 0.018 0.019 +1.8% −2.5% … +8.3% ⚪ within noise
octane-tsrx runlots 30.925 29.708 +2.3% −8.1% … +9.6% ⚪ within noise
octane-tsrx select_lots 0.008 0.008 +5.5% −2.2% … +14.2% ⚪ within noise
octane-tsrx clear 71.800 67.867 −4.2% −10.8% … −0.6% ⚪ within noise
octane-jsx run 4.667 5.483 +7.0% −5.8% … +10.3% ⚪ within noise
octane-jsx replace 14.900 14.350 +1.7% −11.4% … +15.8% ⚪ within noise
octane-jsx add 4.567 4.700 +4.8% −4.9% … +7.6% ⚪ within noise
octane-jsx update 0.330 0.325 −0.9% −4.9% … +6.6% ⚪ within noise
octane-jsx select 0.192 0.175 −1.3% −8.3% … +4.0% ⚪ within noise
octane-jsx swap 0.258 0.240 +1.6% −9.8% … +4.9% ⚪ within noise
octane-jsx remove 0.269 0.261 −1.8% −9.8% … +8.0% ⚪ within noise
octane-jsx runlots 38.142 36.042 −2.3% −12.1% … +9.4% ⚪ within noise
octane-jsx select_lots 2.536 2.683 +9.4% +0.4% … +21.4% ⚪ within noise
octane-jsx clear 71.525 65.900 −3.2% −12.7% … +4.5% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx wayfinder_js_raw 457,429 457,420 −9 (−0.0%) 🟢
octane-tsrx wayfinder_js_gzip 148,823 148,843 +20 (+0.0%) 🔴
octane-tsrx wayfinder_js_brotli 128,982 129,016 +34 (+0.0%) 🔴
octane-tsrx full_fw_raw 568,767 569,483 +716 (+0.1%) 🔴
octane-tsrx full_fw_gzip 172,189 172,317 +128 (+0.1%) 🔴
octane-tsrx full_fw_brotli 145,030 145,152 +122 (+0.1%) 🔴
octane-jsx full_fw_raw 568,767 569,483 +716 (+0.1%) 🔴
octane-jsx full_fw_gzip 172,189 172,317 +128 (+0.1%) 🔴
octane-jsx full_fw_brotli 145,030 145,152 +122 (+0.1%) 🔴

84 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
server-render raw 64,032 64,153 +121 (+0.2%) 🔴
server-render gzip 22,031 22,069 +38 (+0.2%) 🔴
server-render brotli 19,943 20,001 +58 (+0.3%) 🔴
binding-base-ui-esbuild brotli 61,271 61,340 +69 (+0.1%) 🔴
binding-aria-esbuild gzip 3,139 3,138 −1 (−0.0%) 🟢
binding-aria-esbuild brotli 2,808 2,807 −1 (−0.0%) 🟢
binding-radix-esbuild brotli 61,167 61,253 +86 (+0.1%) 🔴

113 other measured values are unchanged.

@trueadm
trueadm merged commit 55376d8 into octanejs:main Oct 14, 2026
55 of 58 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 14, 2026
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 feat PR: new feature or capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants