Skip to content

fix: stabilize server function manifest build output#6763

Open
motopods wants to merge 3 commits intoTanStack:mainfrom
motopods:copilot/fix-unstable-build-output
Open

fix: stabilize server function manifest build output#6763
motopods wants to merge 3 commits intoTanStack:mainfrom
motopods:copilot/fix-unstable-build-output

Conversation

@motopods
Copy link

@motopods motopods commented Feb 25, 2026

generateManifestModule iterated serverFnsById via Object.entries without sorting, producing manifest map keys in insertion order — which varies across builds and causes non-deterministic build artifacts.

Changes

  • packages/start-plugin-core/src/start-compiler-plugin/plugin.ts: Sort manifest entries by key (alphabetically) before code generation.
const manifestEntries = Object.entries(serverFnsById)
  .sort(([a], [b]) => a.localeCompare(b)) // ensure stable key order
  .map(([id, fn]) => { ... })

Fix #6762

Summary by CodeRabbit

  • Chores
    • Emitted manifest entries are now produced in a deterministic, sorted order by function ID, improving consistency of build outputs and downstream tooling that rely on manifest ordering.

Copilot AI and others added 2 commits February 25, 2026 11:43
…ManifestModule

Co-authored-by: motopods <58200641+motopods@users.noreply.github.com>
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 25, 2026

📝 Walkthrough

Walkthrough

The manifest generation now sorts manifestEntries by function ID in ascending order before mapping them to string entries; no other logic, error handling, or public API changes were made.

Changes

Cohort / File(s) Summary
Manifest Sorting
packages/start-plugin-core/src/start-compiler-plugin/plugin.ts
Sorts manifestEntries by function ID (ascending) prior to mapping to string entries to produce a deterministic manifest order.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hop hop, the manifest's now aligned,
IDs in order, tidy and kind,
No scrambled lines, just neat design,
Builds hum smooth, hashes combine,
A little hop for code that's refined.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The PR title clearly and concisely summarizes the main change: stabilizing server function manifest build output by sorting entries deterministically.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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 and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@packages/start-plugin-core/src/start-compiler-plugin/plugin.ts`:
- Line 117: Replace the locale-dependent comparator in the Array.prototype.sort
call that currently uses a.localeCompare(b); instead use a deterministic UTF-16
code-unit comparator, e.g. change the comparator in the .sort(([a], [b]) => ...)
expression to return (a < b ? -1 : a > b ? 1 : 0) so ordering is reproducible
across runtimes.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c4027b6 and 5afbccf.

📒 Files selected for processing (1)
  • packages/start-plugin-core/src/start-compiler-plugin/plugin.ts

…ifest generation (#3)

* Initial plan

* Replace localeCompare with deterministic UTF-16 code unit comparison in generateManifestModule

Co-authored-by: motopods <58200641+motopods@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: motopods <58200641+motopods@users.noreply.github.com>
@schiller-manuel schiller-manuel changed the title Copilot/fix unstable server function manifest build output fix: stabilize server function manifest build output Feb 26, 2026
@schiller-manuel
Copy link
Contributor

please add a comment into the code why we are sorting here

@nx-cloud
Copy link

nx-cloud bot commented Feb 26, 2026

View your CI Pipeline Execution ↗ for commit fcfaec8

Command Status Duration Result
nx run tanstack-router-e2e-bundle-size:build --... ✅ Succeeded 1m 28s View ↗

☁️ Nx Cloud last updated this comment at 2026-02-26 16:26:54 UTC

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 26, 2026

More templates

@tanstack/arktype-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/arktype-adapter@6763

@tanstack/eslint-plugin-router

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

@tanstack/history

npm i https://pkg.pr.new/TanStack/router/@tanstack/history@6763

@tanstack/nitro-v2-vite-plugin

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

@tanstack/react-router

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

@tanstack/react-router-devtools

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

@tanstack/react-router-ssr-query

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

@tanstack/react-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start@6763

@tanstack/react-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-client@6763

@tanstack/react-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/react-start-server@6763

@tanstack/router-cli

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

@tanstack/router-core

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

@tanstack/router-devtools

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

@tanstack/router-devtools-core

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

@tanstack/router-generator

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

@tanstack/router-plugin

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

@tanstack/router-ssr-query-core

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

@tanstack/router-utils

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

@tanstack/router-vite-plugin

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

@tanstack/solid-router

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

@tanstack/solid-router-devtools

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

@tanstack/solid-router-ssr-query

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

@tanstack/solid-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start@6763

@tanstack/solid-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-client@6763

@tanstack/solid-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/solid-start-server@6763

@tanstack/start-client-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-client-core@6763

@tanstack/start-fn-stubs

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-fn-stubs@6763

@tanstack/start-plugin-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-plugin-core@6763

@tanstack/start-server-core

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-server-core@6763

@tanstack/start-static-server-functions

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

@tanstack/start-storage-context

npm i https://pkg.pr.new/TanStack/router/@tanstack/start-storage-context@6763

@tanstack/valibot-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/valibot-adapter@6763

@tanstack/virtual-file-routes

npm i https://pkg.pr.new/TanStack/router/@tanstack/virtual-file-routes@6763

@tanstack/vue-router

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

@tanstack/vue-router-devtools

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

@tanstack/vue-router-ssr-query

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

@tanstack/vue-start

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start@6763

@tanstack/vue-start-client

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-client@6763

@tanstack/vue-start-server

npm i https://pkg.pr.new/TanStack/router/@tanstack/vue-start-server@6763

@tanstack/zod-adapter

npm i https://pkg.pr.new/TanStack/router/@tanstack/zod-adapter@6763

commit: fcfaec8

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unstable build output due to unsorted manifest map keys in TanStack build artifact

3 participants