refactor(build): one shared tools-hatch layering for every synthesized bundler config (xref row 13) - #495
Merged
Conversation
🦋 Changeset detectedLatest commit: 8353a2f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
… shared layering Extract compose-layers.ts: the profile -> tools.rsbuild -> tools.rspack -> framework invariants order that composeEntryLibConfig (Rslib) and composeMcpAppsRsbuildConfig (Rsbuild) each applied separately. Both now lift the same layers into their engine's merge. A unit test pins that a hatch reaches the MCP Apps config the same way it reaches an entry lib and that the invariants win on both paths. Behavior-preserving: artifact and package-build trees of examples/audiobook-curator and examples/host-test are byte-identical before and after (modulo the pre-existing staged-directory token Rspack writes into a NAMESPACE OBJECT comment).
ScriptedAlchemy
force-pushed
the
feat/xref-single-build-instance
branch
from
September 4, 2026 00:56
2c6a527 to
8353a2f
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cross-reference learning A (TanStack Start / React Router rsbuild-plugin matrix row 13, suggestion 6): run every environment through one composition path.
composeEntryLibConfig(Rslib: scripts, hooks, MCP entries, routed CLI bin, package build) andcomposeMcpAppsRsbuildConfig(Rsbuild: MCP App views) each applied theprofile → tools.rsbuild → tools.rspack → invariantslayering separately, and the MCP Apps layering had no unit coverage. This PR extracts the shared order intopackages/agent-bundle/src/build/compose-layers.ts(composeToolsLayers,frameworkInvariantLayer) and has both callers lift the same layers into their engine's merge (mergeRslibConfigkeyed by lib id /mergeRsbuildConfig).agent-bundle stays Rspack/Rsbuild/Rslib-only; no new abstraction over other bundlers.
Behavior preservation
tests/compose-layers.test.tspins: atools.rsbuildfragment reaches the MCP Apps config exactly as it reaches an entry lib; thetools.rspackhatch (fragment + mutator) runs before the frameworkenforceInvariantsmutator on both paths;output.cleanDistPathstaysfalseon both paths; without a hatch only profile + invariants compose.examples/audiobook-curatorandexamples/host-testrebuilt on this branch are byte-identical toorigin/main(c6db0ffe1) — modulo the pre-existing, per-build staged-directory token (.artifact.stage-XXXXXX) Rspack writes into a// NAMESPACE OBJECTcomment of MCP entries, which already makes the manifestsha256of those two files differ between two consecutive runs ofmain(noted for a follow-up; not introduced here).inspect --bundleroutput is unchanged (cli.test.ts"dumps the synthesized bundler configuration" passes;tools.rspackstill renders[hatch, "[function enforceInvariants]"]).build.test.ts,hooks.test.ts,mcp.test.ts,cli.test.ts(86/86 passing).Docs
No user-facing behavior change; the existing
toolsprose (docs/entry-conventions.md,website/docs/{en,zh}/reference/configuration.mdx) already describes the layering generically and stays accurate.Review status
2c6a527(PR opened): completed, no findings, no review threads.8353a2fdiffers from2c6a527only in the changeset's PR reference ((#492)→(#495)); no code changed. Per the maintainer's instruction this PR carries no comments, so the re-review request is recorded here rather than posted.8353a2f.