feat(routes): include generated route declarations by default (AB4834); reject duplicated framework plugins in tools.rsbuild (AB4724) - #497
Conversation
🦋 Changeset detectedLatest commit: 5ec3361 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
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 |
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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e664850bfb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // never dedupes plugins by name, so a framework-owned plugin supplied | ||
| // here would register twice. A config problem with one deterministic fix, | ||
| // so it is an error at validation time like the rest of the AB472x family. | ||
| for (const name of frameworkOwnedPluginCollisions(rsbuild.plugins)) { |
There was a problem hiding this comment.
Add the required package changeset
This commit adds user-facing behavior to both packages/agent-bundle and packages/create-agent-bundle but contains no .changeset/*.md file. The repository's Changeset-present CI gate will therefore fail, and AB4724, AB4834, and the scaffold changes will not receive the required release metadata; add exactly one patch changeset covering both publishable packages.
AGENTS.md reference: AGENTS.md:L97-L107
Useful? React with 👍 / 👎.
commit: |
23dc833 to
65ab46f
Compare
…ject duplicated framework plugins (AB4724)
…ns at composeToolsLayers
65ab46f to
5ec3361
Compare
Two small improvements from the agent-bundle ↔ TanStack / React-Router cross-reference.
Matrix rows
.agent-bundle/routes.d.tsaugmentsRegisterin@agent-bundle/runtime), but the file only took effect when a project's tsconfig happened to include it; the scaffold and several examples did not, sorenderRoutesilently degraded tostring/unknown. TanStack keepsrouteTree.gen.tsinsidesrc/so it is always in the program.pluginsarrays, sotools.rsbuild.plugins: [pluginReact()]silently doubled the framework's own@rsbuild/plugin-react.rsbuild-plugin-react-routershipsvalidation/validate-plugin-order.tsfor exactly this.Item 1 —
.agent-bundle/routes.d.tsin the program by default (AB4834)packages/create-agent-bundle/templates/{minimal,mcp-server,cli-tool}/tsconfig.jsonand every example tsconfig (examples/{audiobook-curator,host-test,mcp-app,rsc-agent-runtime,worktree-proximity}/tsconfig.json;mcp-appgained its tsconfig in chore(examples): drop stray host-test probe note; add mcp-app typecheck and make it pass --strict #491 and compiles no route graph, so the entry is inert there until it does) list".agent-bundle/routes.d.ts"ininclude. A literal entry, because TypeScript's**/*never descends into dot-directories;includerather thanfiles, because anincludeentry is inert until the first build publishes the file while a missingfilesentry is atscerror. The file stays gitignored (verified for every example and asserted for every template).packages/agent-bundle/src/routes/typegen-program.ts:routeTypesProgramDiagnostics(root)resolves the roottsconfig.jsonprogram the waytsc -pdoes (ts.parseJsonConfigFileContentoverts.sys:extends,files,include,exclude, plus one level of projectreferencesfor a solution-style root) and reportsAB4834(warning) when the published declaration is not among its root files. No root tsconfig, no published declaration (route-free and provider-free), or an unparsable tsconfig → nothing (no program to be missing from, ortscreports the parse failure itself).src/dev/project-service.ts#prepareright afterwriteRouteTypes, forcommand === 'validate'only — the same surface every other non-error source nudge uses, and the placement means the check judges the file that was just published against the real file system instead of re-implementing TypeScript's glob semantics.examples/audiobook-curator/tests/route-unit/context.test.ts: with the declaration in the program, the degraded-path test'sproviders: {}became a compile error (the generated augmentation makeslibraryrequired — exactly the silent gap this row is about). The deliberate contract violation is now an explicit cast with a comment.examples/worktree-proximity/tests/route-unit/routes.test.ts: same mechanism, other direction — the example gained anagentTopologyprovider onmain(chore(examples): use built-in framework surface over hand-rolled setup #473), and with the declaration in the program an explicitprovidersmap that only carriedgitWorktreeno longer compiles (CIExamples checkon3fe4c39). The fixture now carries every declared key through oneproviders(root)helper; the topology factory is pure and returns the same honest-unavailable value the harness mounts.Item 2 — framework-owned plugin collision (
AB4724)packages/agent-bundle/src/build/framework-plugins.ts: the set of Rsbuild plugins the framework registers (rsbuild:react→@rsbuild/plugin-react, fromrslib.tsfor every synthesized entry andmcp-apps.tsfor React-syntax views) andframeworkOwnedPluginCollisions(plugins), which flattens nested arrays the way Rsbuild does, skipsfalse/null/undefinedholes, and matches plugin objects byname. Promise-form plugins carry no name until awaited and are not inspected (documented).src/config/validate.ts#validateToolsemitsAB4724(error) naming the plugin and its package, with the fix. Error at validate time rather than a build-time warning because that is what the existing scheme does fortoolsconfig problems (AB4720–AB4723are validate-time errors from the same function): it is a config problem with one deterministic fix, reported once at the source before any bundler runs, and it gatesvalidate,build,inspect, anddevalike through the existinghasErrors(sourceDiagnostics)path. Verified against@rsbuild/core2.2.1'screatePluginManager.addPlugins(plainpush, no name check).tests/framework-plugins.test.tspins each literal topluginReact().name.Docs
docs/diagnostics.md(new "bundler escape hatch (AB4720–AB4724)" section,AB4834row and prose in the route-graph section, family table),docs/framework-mode.md,docs/entry-conventions.md,packages/agent-bundle/README.md, and en+zhguide/authoring/package-entries,guide/development/index,guide/development/testing,reference/configuration. The generated diagnostics reference page followsdocs/diagnostics.md.Tests
tests/route-types-program.test.ts(5 tests throughvalidate()/inspect()on temp projects: warning shape; silent for explicit include,.agent-bundle/**/*, andfiles;extendsandreferencesfollowed;**/*alone still warns; no tsconfig / no routes / broken tsconfig silent; validate-only).tests/framework-plugins.test.ts(name drift check, nested/hole flattening, unrelated/deferred plugins).tests/package-conventions.test.ts: duplicatepluginReact()→ oneAB4724; unrelated user plugins → no diagnostic.create-agent-bundle/tests/scaffold.test.ts: every template's tsconfigincludecarries the entry and.gitignoreignores.agent-bundle/.route-register-typegen.test.tsandprovider-typegen.test.tspass unchanged.Local:
pnpm build,pnpm lint,pnpm typecheck,pnpm test:unit(3117 passed),pnpm --filter './examples/*' check(all seven examples: validate → build → typecheck → tests),scaffold-packed.e2e+scaffold-packed-matrix.e2eunder the release packed pool (4/4; each scaffolded template runs its owncheck, sotscnow sees the generated declaration),pnpm docs:site:build(parity and dead-link checks green).Changeset
.changeset/typed-routes-by-default-and-plugin-collision.md— patch foragent-bundleandcreate-agent-bundle.Review status
Rebased onto
mainthree times: after #487 (release-audit gate removed), after #491/#494/#495/#504, and after #501 (create-agent-bundle on Effect FileSystem/Path — the scaffold include test was ported to theit.effect/readJsonstyle, the only conflict). Themaindocs-build fix this branch briefly carried was dropped in the last rebase because #507 landed the identical change. Per the working instructions for this PR, no comments are posted from this side; the review record lives here.chatgpt-codex-connectorreviewede664850(PR opened) with one P1 finding: no.changeset/*.mdin the commit. Addressed in the changeset commit (.changeset/typed-routes-by-default-and-plugin-collision.md, patch foragent-bundleandcreate-agent-bundle, summary ends(#497)); theChangeset presentcheck is the machine confirmation.e664850(pre-rebase; its content isae32e81after the rebases). Unreviewed since then: the changeset (02f7cbe), the worktree-proximity fixture (3da15e8), and the mcp-app include +framework-plugins.tsdoc comment pointing at refactor(build): one shared tools-hatch layering for every synthesized bundler config (xref row 13) #495'scomposeToolsLayers(5ec3361). No behavior change inpackages/**since the reviewed commit; the scaffold test port is mechanical.