Skip to content

fix(router-generator): make buildRouteTree route ordering deterministic#7751

Open
0x80 wants to merge 6 commits into
TanStack:mainfrom
0x80:fix/deterministic-route-tree-sort
Open

fix(router-generator): make buildRouteTree route ordering deterministic#7751
0x80 wants to merge 6 commits into
TanStack:mainfrom
0x80:fix/deterministic-route-tree-sort

Conversation

@0x80

@0x80 0x80 commented Jul 7, 2026

Copy link
Copy Markdown

Fixes #7750.

Problem

buildRouteTree sorts route nodes with multiSortBy, whose final accessor was (d) => d — comparing whole route-node objects:

const sortedRouteNodes = multiSortBy(acc.routeNodes, [
  (d) => (d.routePath?.includes(`/${rootPathId}`) ? -1 : 1),
  (d) => (d.routePath === undefined ? undefined : countSlashSeparatedParts(d.routePath)),
  (d) => { /* index-token check */ },
  (d) => d,            // <-- whole object
])

multiSortBy's comparator ends with return ao > bo ? 1 : -1. For two distinct route-node objects, both coerce to "[object Object]", so ao === bo is false and ao > bo is false → it returns -1 for both (a, b) and (b, a). That's an inconsistent comparator, so Array.prototype.sort leaves routes that tie on the earlier keys (same segment-count, same index-token status — e.g. /account/beta-features vs /account/busy-guard) in an order that depends on the engine's sort implementation, the input order, and the array size. The result: routeTree.gen.ts reorders non-deterministically across machines and Node versions, dirtying committed route trees with semantically-identical churn.

Fix

Change the final tiebreaker from (d) => d to (d) => d.routePath, mirroring the pre-sort earlier in the same file (which already ends with (d) => d.routePath). routePath is unique per node, so this gives a total order and makes generation byte-identical regardless of Node version or route-set composition.

A changeset is included (@tanstack/router-generator, patch).

Tests

The buildRouteTree tiebreaker sort is extracted into an exported pure sortRouteNodes(routeNodes, indexTokenSegmentRegex) helper (behavior-identical to the previous inline multiSortBy call) so it can be unit-tested directly. New tests in router-generator/tests/utils.test.ts:

  • Stable ordering — feeds a route set that ties on every key before routePath (e.g. /account/beta-features vs /account/busy-guard, /about vs /posts) through every input permutation and asserts identical output, proving the sort is independent of input order, engine sort implementation, and array size. This test fails against the old (d) => d tiebreaker and passes against (d) => d.routePath.
  • Tiebreaker + precedence — asserts tied siblings order by routePath, and that root / segment-count / index-token precedence still apply ahead of the tiebreaker.

Regenerated snapshots

The deterministic tiebreaker changes the order in which route nodes are emitted, so the 38 committed routeTree.snapshot.* files under tests/generator/ are regenerated. This is expected: the previous snapshots captured the arbitrary order the inconsistent comparator happened to produce on the machine that generated them. The buggy sort was stable run-to-run for a fixed input order and engine, so CI kept passing — the non-determinism only appeared across machines/Node versions (issue #7750).

The snapshot diffs are pure emission-order reordering: every route's id, path, and parentRoute is unchanged, and the route-tree structure (built from acc.routeTree, not the sorted list) is untouched — only the order of imports and route declarations shifts. In other words, the regenerated snapshots are exactly the semantically-identical churn this fix eliminates going forward, applied once.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed non-deterministic route-tree generation when routes are equivalent, ensuring consistent ordering across runs and machines.
    • Stabilized tie-breaking so generated route outputs no longer vary based on engine/input quirks.
  • Tests
    • Added new unit tests to validate deterministic sorting across permutations and tie scenarios.
    • Updated generated route-tree snapshots to match the new stable ordering.

The final sort tiebreaker in buildRouteTree compared whole route-node
objects ((d) => d). Two objects both coerce to "[object Object]", so the
comparator returns -1 for both (a, b) and (b, a) — an inconsistent
comparator. Routes tying on segment-count and index-token were then left
in an engine- and input-order-dependent order, producing
non-deterministic routeTree.gen.ts diffs across machines and Node
versions. Compare routePath instead, mirroring the pre-sort's final
accessor, for a stable total order.
Copilot AI review requested due to automatic review settings July 7, 2026 20:05
@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5bffb87f-35d4-44b2-b1f9-d474967d9457

📥 Commits

Reviewing files that changed from the base of the PR and between 9817319 and 09e70aa.

📒 Files selected for processing (1)
  • packages/router-generator/src/utils.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/router-generator/src/utils.ts

📝 Walkthrough

Walkthrough

The route generator now uses a shared deterministic route-node sorter with routePath as the final tiebreaker. Utility tests verify permutation-independent ordering, and generated route-tree snapshots are regenerated accordingly.

Changes

Deterministic route ordering

Layer / File(s) Summary
Sorting helper and generator integration
packages/router-generator/src/utils.ts, packages/router-generator/src/generator.ts
Adds sortRouteNodes with root, segment-count, index-token, and routePath ordering rules, then delegates buildRouteTree sorting to it.
Validation and generated outputs
packages/router-generator/tests/utils.test.ts, packages/router-generator/tests/generator/*/routeTree.snapshot.*, .changeset/deterministic-route-tree-sort.md
Tests deterministic ordering across permutations and regenerates route-tree declarations and FileRoutesByPath mappings with the new order.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related issues

Suggested labels: package: router-generator

Suggested reviewers: nlynzaad, schiller-manuel, chorobin, sheraff, seancassiere

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: making buildRouteTree route ordering deterministic in router-generator.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes non-deterministic route ordering during route-tree generation in @tanstack/router-generator by ensuring buildRouteTree uses a consistent, total ordering when sorting route nodes. This prevents semantically-identical routeTree.gen.ts churn across different Node/V8 versions and machines.

Changes:

  • Replace the final multiSortBy tiebreaker in buildRouteTree from comparing whole route-node objects to comparing routePath.
  • Ensure sibling routes that tie on earlier sort keys still sort deterministically by a stable string key.
  • Add a patch changeset for @tanstack/router-generator documenting the determinism fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/router-generator/src/generator.ts Fixes buildRouteTree sorting by using routePath as the final tiebreaker for deterministic generation.
.changeset/deterministic-route-tree-sort.md Adds a patch changeset describing the deterministic route ordering fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@schiller-manuel

Copy link
Copy Markdown
Collaborator

can you please add unit tests that prove stable sorting?

…apshots

Extract the buildRouteTree tiebreaker sort into an exported pure
`sortRouteNodes` helper and cover it with unit tests. The key test feeds a
route set that ties on every key before `routePath` through all input
permutations and asserts identical output, proving the sort is order- and
engine-independent.

Regenerate the 38 generator snapshots whose ordering changes under the
deterministic tiebreaker. The diffs are pure emission-order reordering
(every route's id/path/parentRoute is unchanged) -- the same
semantically-identical churn the fix eliminates going forward.
@0x80

0x80 commented Jul 8, 2026

Copy link
Copy Markdown
Author

@schiller-manuel added — pushed in 85b7e95.

To make the sort testable I pulled the buildRouteTree tiebreaker out into an exported pure sortRouteNodes(routeNodes, indexTokenSegmentRegex) (behavior-identical to the old inline multiSortBy call) and covered it in router-generator/tests/utils.test.ts. The stable-sort test builds a route set that ties on every key before routePath (/account/beta-features vs /account/busy-guard, /about vs /posts, …), runs it through every input permutation, and asserts identical output — so it's independent of input order, engine sort implementation, and array size. It fails against the old (d) => d tiebreaker and passes against (d) => d.routePath. A second test pins the routePath tiebreak plus the root / segment-count / index-token precedence ahead of it.

Heads-up: the deterministic order also changes route emission order, so I had to regenerate the 38 routeTree.snapshot.* fixtures under tests/generator/. The diffs are pure reordering — every route's id/path/parentRoute and the tree structure are unchanged. The old snapshots captured the arbitrary order the inconsistent comparator produced on whatever machine generated them (stable run-to-run for a fixed input, which is why CI stayed green — the non-determinism only showed up across machines, #7750). More detail in the updated PR description.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/router-generator/tests/utils.test.ts`:
- Around line 982-984: The one-line `if` in `permutations<T>` violates the
project’s brace-required control-flow style. Update the `if (arr.length <= 1)`
branch in `permutations` to use curly braces around its body, keeping the same
return behavior while matching the coding guidelines for all `if`/`else`
statements.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ceac5fba-5751-4ad3-8b46-5c6144b193f8

📥 Commits

Reviewing files that changed from the base of the PR and between 67049ac and 85b7e95.

📒 Files selected for processing (42)
  • packages/router-generator/src/generator.ts
  • packages/router-generator/src/index.ts
  • packages/router-generator/src/utils.ts
  • packages/router-generator/tests/generator/add-extensions-custom/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/custom-scaffolding/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/custom-tokens/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/dot-escaped/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/escaped-custom-tokens/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/escaped-special-strings/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/export-variations/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/file-modification/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/flat-route-group/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/flat/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/invalid-param-names/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/nested-layouts/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/nested/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/numbers-in-path/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/physical-pathless-layout-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/prefix-suffix/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/regex-tokens-inline/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/regex-tokens-json/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/regex-tokens-plus-json/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/root-export-specifier/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/routeFileIgnore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/routeFilePrefix/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/single-level/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/types-disabled/routeTree.snapshot.js
  • packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-inside-nested/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-pathless-layout-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-physical-layout-and-index/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-physical-no-prefix/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-with-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual/routeTree.snapshot.ts
  • packages/router-generator/tests/utils.test.ts
✅ Files skipped from review due to trivial changes (34)
  • packages/router-generator/tests/generator/escaped-custom-tokens/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/single-level/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/regex-tokens-inline/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-physical-empty-path-merge/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/add-extensions-custom/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-with-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/types-disabled/routeTree.snapshot.js
  • packages/router-generator/tests/generator/export-variations/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/regex-tokens-json/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/custom-scaffolding/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/invalid-param-names/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/regex-tokens-plus-json/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-physical-layout-and-index/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-nested-layouts-with-virtual-route/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/routeFileIgnore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/numbers-in-path/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/file-modification/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/flat-route-group/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/root-export-specifier/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-inside-with-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/nested-route-groups-with-layouts-before-physical/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-default-export/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/escaped-special-strings/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-named-export/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/dot-escaped/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/flat/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-pathless-layout-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/virtual-config-file-tsconfig-paths/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/custom-tokens/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/nested/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/nested-layouts/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/physical-pathless-layout-escaped-underscore/routeTree.snapshot.ts
  • packages/router-generator/tests/generator/route-groups/routeTree.snapshot.ts

Comment thread packages/router-generator/tests/utils.test.ts Outdated
Follow the AGENTS.md control-statement convention (no one-line if bodies).
Comment thread packages/router-generator/src/index.ts Outdated
removeUnderscores,
resetRegex,
multiSortBy,
sortRouteNodes,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you intend to make this a public API?  Tests already import it from utils so if extraction is only for unit testing, can we keep it internal and omit this re-export?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that was unintentional — the extraction was only for unit testing, and both the test and generator.ts import it directly from ./utils. Dropped the re-export in a07c93c so it stays internal.

… re-export

Tests import sortRouteNodes directly from ../src/utils and the only
runtime consumer (generator.ts) imports it from ./utils, so the public
re-export from the package entry point served no purpose. Removing it
keeps the extraction internal to unit testing as intended.

@LadyBluenotes LadyBluenotes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Going to wait for @schiller-manuel to give the final sign off :)

@nx-cloud

nx-cloud Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 9817319

Command Status Duration Result
nx affected --targets=test:eslint,test:unit,tes... ✅ Succeeded 15m 46s View ↗
nx run-many --target=build --exclude=examples/*... ✅ Succeeded 2m 13s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-13 22:19:26 UTC

@pkg-pr-new

pkg-pr-new Bot commented Jul 13, 2026

Copy link
Copy Markdown
More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/@tanstack/arktype-adapter@7751

@tanstack/eslint-plugin-router

npm i https://pkg.pr.new/@tanstack/eslint-plugin-router@7751

@tanstack/eslint-plugin-start

npm i https://pkg.pr.new/@tanstack/eslint-plugin-start@7751

@tanstack/history

npm i https://pkg.pr.new/@tanstack/history@7751

@tanstack/nitro-v2-vite-plugin

npm i https://pkg.pr.new/@tanstack/nitro-v2-vite-plugin@7751

@tanstack/react-router

npm i https://pkg.pr.new/@tanstack/react-router@7751

@tanstack/react-router-devtools

npm i https://pkg.pr.new/@tanstack/react-router-devtools@7751

@tanstack/react-router-ssr-query

npm i https://pkg.pr.new/@tanstack/react-router-ssr-query@7751

@tanstack/react-start

npm i https://pkg.pr.new/@tanstack/react-start@7751

@tanstack/react-start-client

npm i https://pkg.pr.new/@tanstack/react-start-client@7751

@tanstack/react-start-rsc

npm i https://pkg.pr.new/@tanstack/react-start-rsc@7751

@tanstack/react-start-server

npm i https://pkg.pr.new/@tanstack/react-start-server@7751

@tanstack/router-cli

npm i https://pkg.pr.new/@tanstack/router-cli@7751

@tanstack/router-core

npm i https://pkg.pr.new/@tanstack/router-core@7751

@tanstack/router-devtools

npm i https://pkg.pr.new/@tanstack/router-devtools@7751

@tanstack/router-devtools-core

npm i https://pkg.pr.new/@tanstack/router-devtools-core@7751

@tanstack/router-generator

npm i https://pkg.pr.new/@tanstack/router-generator@7751

@tanstack/router-plugin

npm i https://pkg.pr.new/@tanstack/router-plugin@7751

@tanstack/router-ssr-query-core

npm i https://pkg.pr.new/@tanstack/router-ssr-query-core@7751

@tanstack/router-utils

npm i https://pkg.pr.new/@tanstack/router-utils@7751

@tanstack/router-vite-plugin

npm i https://pkg.pr.new/@tanstack/router-vite-plugin@7751

@tanstack/solid-router

npm i https://pkg.pr.new/@tanstack/solid-router@7751

@tanstack/solid-router-devtools

npm i https://pkg.pr.new/@tanstack/solid-router-devtools@7751

@tanstack/solid-router-ssr-query

npm i https://pkg.pr.new/@tanstack/solid-router-ssr-query@7751

@tanstack/solid-start

npm i https://pkg.pr.new/@tanstack/solid-start@7751

@tanstack/solid-start-client

npm i https://pkg.pr.new/@tanstack/solid-start-client@7751

@tanstack/solid-start-server

npm i https://pkg.pr.new/@tanstack/solid-start-server@7751

@tanstack/start-client-core

npm i https://pkg.pr.new/@tanstack/start-client-core@7751

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/@tanstack/start-fn-stubs@7751

@tanstack/start-plugin-core

npm i https://pkg.pr.new/@tanstack/start-plugin-core@7751

@tanstack/start-server-core

npm i https://pkg.pr.new/@tanstack/start-server-core@7751

@tanstack/start-static-server-functions

npm i https://pkg.pr.new/@tanstack/start-static-server-functions@7751

@tanstack/start-storage-context

npm i https://pkg.pr.new/@tanstack/start-storage-context@7751

@tanstack/valibot-adapter

npm i https://pkg.pr.new/@tanstack/valibot-adapter@7751

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/@tanstack/virtual-file-routes@7751

@tanstack/vue-router

npm i https://pkg.pr.new/@tanstack/vue-router@7751

@tanstack/vue-router-devtools

npm i https://pkg.pr.new/@tanstack/vue-router-devtools@7751

@tanstack/vue-router-ssr-query

npm i https://pkg.pr.new/@tanstack/vue-router-ssr-query@7751

@tanstack/vue-start

npm i https://pkg.pr.new/@tanstack/vue-start@7751

@tanstack/vue-start-client

npm i https://pkg.pr.new/@tanstack/vue-start-client@7751

@tanstack/vue-start-server

npm i https://pkg.pr.new/@tanstack/vue-start-server@7751

@tanstack/zod-adapter

npm i https://pkg.pr.new/@tanstack/zod-adapter@7751

commit: 09e70aa

@codspeed-hq

codspeed-hq Bot commented Jul 13, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 51.08%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 3 improved benchmarks
❌ 1 regressed benchmark
✅ 176 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation client-route-tree-scale navigation loop (react) 74.2 ms 77.2 ms -3.87%
Memory mem server error-paths redirect (vue) 832.9 KB 306 KB ×2.7
Memory mem server error-paths not-found (solid) 792.7 KB 414.9 KB +91.04%
Memory mem server server-fn-churn (solid) 273.8 KB 262.8 KB +4.22%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing 0x80:fix/deterministic-route-tree-sort (09e70aa) with main (58c005f)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (4d4171f) during the generation of this report, so 58c005f was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@0x80

0x80 commented Jul 14, 2026

Copy link
Copy Markdown
Author

Note on the failing checks

All three red checks are environmental artifacts of this PR coming from a fork, not defects in the change. The code checks — Test, Benchmark PR, all CodSpeed benchmark runs, CodeRabbit, Socket, zizmor, Preview — are green.

labeler and Upsert PR Comment both fail with 403 Resource not accessible by integration. On a fork PR, GitHub hands the workflow a read-only GITHUB_TOKEN (Contents: read, PullRequests: read), so neither setting labels nor posting the benchmark comment is permitted. These pass once run with write scope in the upstream context; there is nothing in the diff to change.

CodSpeed Performance Analysis flags a single regressed benchmark, client-route-tree-scale navigation loop (react), at 74.2 ms → 77.2 ms (-3.87%) — against 3 improved benchmarks, 176 untouched, and a net +51% overall. This is almost certainly measurement variance: the only change here is the tiebreaker in the generator's sortRouteNodes ((d) => d(d) => d.routePath), which alters the textual order of route declarations in routeTree.gen.ts. The runtime router re-sorts routes by score at load time, so generator ordering has no effect on the navigation matching loop this benchmark exercises. Happy to acknowledge it on CodSpeed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

buildRouteTree sorts sibling routes with an inconsistent comparator ((d) => d), producing non-deterministic routeTree.gen.ts ordering

4 participants