Skip to content

feat(tanstack-router): own compiled failures in catch boundaries - #2160

Merged
domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:feat/strong-router-failure-2059
Oct 20, 2026
Merged

domgan-oai merged 1 commit into
octanejs:mainfrom
openai-oss-forks:feat/strong-router-failure-2059

Conversation

@domgan-oai

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

Copy link
Copy Markdown
Contributor

Summary

The website's Strong compiled Router tree still reached a compatibility-mode failure component whenever a route or global boundary caught an error. Move failure selection and presentation into the Strong match tree, and let the active catch arm own synchronous, once-per-entry error reporting. This preserves the existing boundary topology, ancestor propagation, not-found placement and match-identity recovery. Related to #2059.

The new __runOnCatch is a binding-infrastructure operation, backed by catch-entry state only on the exceptional path. The route selects its fallback before invoking user reporting; callback errors continue to the enclosing boundary. SSR runs the operation once per catch pass.

Validation

  • pnpm format:check — repository-wide run omitted; changed-file formatting passed.
  • pnpm typecheck — repository-wide run omitted; all six selected production source files passed. Forced-inclusion test checks and the Router consumer program retained the same diagnostics as exact main (14 core, 8 Router, and 5 consumer respectively).
  • pnpm test — repository-wide run omitted; focused isolated Vitest projects passed 44 core tests (development and production), 44 Router client/hydration/navigation tests, and 12 Router SSR tests. Both changed Router behavior cases also passed against main 3c8272e52 using an in-memory test overlay.
  • Production website build and matched Chromium failure/recovery: injected a one-shot render failure into the real Benchmarks route; six visible-state snapshots matched main, including the error UI, browser Back, reload to Core APIs, and a real Docs link to Quick start. Both had two document requests (initial load and reload), zero browser errors, and direct coverage of the affected failure path. Source hashes stayed stable through build and QA.
  • octane analyze --strong-dependencies --json on the same 54 tracked website components: main reported compiled/MatchLifecycle.tsrx through three importers; this branch reports no compatibility dependencies or diagnostics.
  • pnpm sync, generated error-code validation, and independent complexity review.
  • Current-head CI and benchmark completed successfully for e0db2ad7e.
  • perf-review: scan found no candidates. Both client and SSR retain four boundary sites; normal-route topology and scheduling are unchanged. Added token/frame work runs only after a catch. The suspense-transition production reachability scenario grew 64 raw / 32 gzip / 5 brotli bytes. The complete website public-JS inventory grew 1,143 raw / 290 summed per-file gzip bytes across 621→622 files; these inventory totals are not route transfer sizes. Browser latency was not benchmarked.
  • The CI benchmark report found all 64 work counters unchanged and flagged octane-tsrx replace at +8.3% (95% CI +3.1% to +21.4%). Matched local production builds of that exact benchmark target produced byte-identical complete JavaScript (105,425 bytes; SHA-256 7863e89828b50a6766734a98471cea7c010ad5b1d33db43f2a44aa027444f65c); CI executable artifacts were not retained, so the timing result cannot be attributed or dismissed conclusively. CI measured suspense-transition at +64 raw / +35 gzip / +5 brotli bytes and Pagecraft Oxc at +64 raw / +36 gzip / +155 brotli bytes.
  • concise-code: source +132/-68 (runtime +58/-7); one binding-infrastructure export supplies the synchronous lifecycle, and the sole new authored file is the two-package patch changeset. A post-commit effect would alter callback timing and propagation; adding a second boundary changed the real website's recovery behavior. Unbundled compiled Router modules shrink by 351 client / 114 server bytes; the complete-build measurements above include runtime cost.

Risk / follow-ups

  • Main and this branch both retain two fallback views after browser Back from the injected failure; reloading recovers. This pre-existing recovery defect is outside this change.
  • The Strong fallback may run its guarded layout effect when the reset function identity changes; it still resets only when the match identity changes.
  • The Router and Octane patch releases must be consumed together for the new internal operation. This does not claim whole-package Strong compliance or descriptor elimination.

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 core error-boundary and compiled Router failure paths on client and SSR, including when route onCatch runs and how not-found errors propagate.

Overview
Moves compiled TanStack Router route/global failure UI and onCatch reporting into the Strong @catch arms in Matches.tsrx, and removes the separate compatibility CompiledFailure module.

Octane adds exported __runOnCatch: a binding hook that runs a callback once per catch entry, synchronously, only while the direct catch arm is active (client and SSR). Misuse throws error #350. Catch props now carry internal catch-entry state so re-renders of an already-shown fallback do not re-fire reporting; nested components cannot report on behalf of a parent boundary.

resolveFailure keeps not-found vs error component selection, ancestor propagation when the owning route cannot handle the error, and match-identity-driven reset on the compiled failure view. Router docs/status mark failure presentation and synchronous reporting as Strong-owned.

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

Copy link
Copy Markdown
Contributor

Benchmark report

  • 🟡 js-framework: 1 timed operation(s) slower beyond ±3%
  • 🔴 bundle-size: 31 value(s) increased
  • 🔴 bundle-reachability: 15 value(s) increased

Compares 3c8272e52, the merge commit's first parent with b19d16763 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

target operation base ms head ms head/base 95% CI
octane-tsrx replace 12.875 12.808 +8.3% +3.1% … +21.4% 🟡 slower
All 20 timed operations (19 without a verdict)
target operation base ms head ms head/base 95% CI
octane-tsrx run 6.183 6.567 +2.8% −13.5% … +21.5% ⚪ within noise
octane-tsrx replace 12.875 12.808 +8.3% +3.1% … +21.4% 🟡 slower
octane-tsrx add 2.842 2.717 +0.0% −11.2% … +5.6% ⚪ within noise
octane-tsrx update 0.104 0.100 −2.3% −6.5% … +2.2% ⚪ within noise
octane-tsrx select 0.006 0.007 +1.0% −3.8% … +7.1% ⚪ within noise
octane-tsrx swap 0.022 0.021 −1.2% −3.7% … +1.5% ⚪ within noise
octane-tsrx remove 0.024 0.023 +1.9% −8.2% … +16.2% ⚪ within noise
octane-tsrx runlots 32.808 29.342 +2.7% −3.9% … +16.7% ⚪ within noise
octane-tsrx select_lots 0.008 0.008 −1.3% −5.1% … +4.5% ⚪ within noise
octane-tsrx clear 77.458 79.650 −2.7% −11.2% … +10.0% ⚪ within noise
octane-jsx run 5.400 6.675 +9.6% −1.7% … +32.5% ⚪ within noise
octane-jsx replace 12.717 12.567 −7.8% −19.2% … +6.1% ⚪ within noise
octane-jsx add 5.258 5.050 +4.9% −9.0% … +12.3% ⚪ within noise
octane-jsx update 0.208 0.235 −2.8% −7.5% … +5.3% ⚪ within noise
octane-jsx select 0.126 0.129 −0.3% −14.8% … +15.8% ⚪ within noise
octane-jsx swap 0.217 0.231 +9.9% −4.8% … +14.1% ⚪ within noise
octane-jsx remove 0.192 0.169 −4.8% −14.0% … +4.0% ⚪ within noise
octane-jsx runlots 36.442 42.708 +5.8% −7.2% … +15.4% ⚪ within noise
octane-jsx select_lots 2.313 2.367 +9.9% −7.3% … +23.9% ⚪ within noise
octane-jsx clear 84.867 74.750 −4.6% −8.9% … +3.3% ⚪ within noise

All 64 work counters are unchanged.

Application bundle size (bytes)

target metric base head Δ
octane-tsrx weather_js_raw 135,032 135,106 +74 (+0.1%) 🔴
octane-tsrx weather_js_gzip 44,937 44,979 +42 (+0.1%) 🔴
octane-tsrx weather_js_brotli 39,900 39,896 −4 (−0.0%) 🟢
octane-tsrx weather_app_gzip 8,628 8,627 −1 (−0.0%) 🟢
octane-tsrx weather_app_brotli 7,286 7,291 +5 (+0.1%) 🔴
octane-tsrx weather_fw_raw 109,962 110,036 +74 (+0.1%) 🔴
octane-tsrx weather_fw_gzip 36,309 36,352 +43 (+0.1%) 🔴
octane-tsrx weather_fw_brotli 32,614 32,605 −9 (−0.0%) 🟢
octane-tsrx wayfinder_js_raw 442,103 442,167 +64 (+0.0%) 🔴
octane-tsrx wayfinder_js_gzip 145,955 145,990 +35 (+0.0%) 🔴
octane-tsrx wayfinder_js_brotli 127,368 127,481 +113 (+0.1%) 🔴
octane-tsrx pagecraft_oxc_js_raw 544,655 544,719 +64 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_gzip 171,380 171,416 +36 (+0.0%) 🔴
octane-tsrx pagecraft_oxc_js_brotli 145,410 145,565 +155 (+0.1%) 🔴
octane-tsrx pagecraft_esbuild_js_raw 577,261 577,325 +64 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_gzip 186,754 186,796 +42 (+0.0%) 🔴
octane-tsrx pagecraft_esbuild_js_brotli 158,822 158,940 +118 (+0.1%) 🔴
octane-tsrx full_fw_raw 527,837 528,050 +213 (+0.0%) 🔴
octane-tsrx full_fw_gzip 165,012 165,126 +114 (+0.1%) 🔴
octane-jsx shell_js_raw 331,529 331,593 +64 (+0.0%) 🔴
octane-jsx shell_js_gzip 108,098 108,139 +41 (+0.0%) 🔴
octane-jsx shell_js_brotli 93,866 93,844 −22 (−0.0%) 🟢
octane-jsx shell_app_brotli 654 660 +6 (+0.9%) 🔴
octane-jsx shell_fw_raw 330,436 330,500 +64 (+0.0%) 🔴
octane-jsx shell_fw_gzip 107,336 107,377 +41 (+0.0%) 🔴
octane-jsx shell_fw_brotli 93,212 93,184 −28 (−0.0%) 🟢
octane-jsx shell_client_js_raw 280,389 280,453 +64 (+0.0%) 🔴
octane-jsx shell_client_js_gzip 90,843 90,900 +57 (+0.1%) 🔴
octane-jsx shell_client_js_brotli 79,440 79,529 +89 (+0.1%) 🔴
octane-jsx shell_client_app_gzip 769 772 +3 (+0.4%) 🔴
octane-jsx shell_client_app_brotli 662 663 +1 (+0.2%) 🔴
octane-jsx shell_client_fw_raw 279,288 279,352 +64 (+0.0%) 🔴
octane-jsx shell_client_fw_gzip 90,074 90,128 +54 (+0.1%) 🔴
octane-jsx shell_client_fw_brotli 78,778 78,866 +88 (+0.1%) 🔴
octane-jsx full_fw_raw 527,837 528,050 +213 (+0.0%) 🔴
octane-jsx full_fw_gzip 165,012 165,126 +114 (+0.1%) 🔴

57 other measured values are unchanged.

Public-import reachability bundles (bytes)

target metric base head Δ
deferred-hydration raw 182,068 182,132 +64 (+0.0%) 🔴
deferred-hydration gzip 59,465 59,507 +42 (+0.1%) 🔴
deferred-hydration brotli 52,053 52,051 −2 (−0.0%) 🟢
hydrate-frame raw 344,509 344,573 +64 (+0.0%) 🔴
hydrate-frame gzip 110,670 110,709 +39 (+0.0%) 🔴
hydrate-frame brotli 96,234 96,245 +11 (+0.0%) 🔴
suspense-transition raw 114,697 114,761 +64 (+0.1%) 🔴
suspense-transition gzip 37,584 37,619 +35 (+0.1%) 🔴
suspense-transition brotli 33,509 33,514 +5 (+0.0%) 🔴
split-shell raw 395,440 395,504 +64 (+0.0%) 🔴
split-shell gzip 128,901 128,970 +69 (+0.1%) 🔴
split-shell brotli 112,267 112,360 +93 (+0.1%) 🔴
split-shell-runtime raw 318,803 318,867 +64 (+0.0%) 🔴
split-shell-runtime gzip 102,654 102,718 +64 (+0.1%) 🔴
split-shell-runtime brotli 88,714 88,802 +88 (+0.1%) 🔴
binding-base-ui-esbuild brotli 59,044 59,066 +22 (+0.0%) 🔴

107 other measured values are unchanged.

@domgan-oai
domgan-oai merged commit 2c635ad into octanejs:main Oct 20, 2026
54 checks passed
@github-actions github-actions Bot mentioned this pull request Oct 20, 2026
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.

1 participant