feat(build): MCP App views judged from compile evidence (#619 step 5) - #627
Merged
Conversation
🦋 Changeset detectedLatest commit: 5e07ff0 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 |
commit: |
ScriptedAlchemy
marked this pull request as ready for review
September 5, 2026 11:12
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Sep 5, 2026
ScriptedAlchemy
added a commit
that referenced
this pull request
Sep 5, 2026
11 tasks
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.
The MCP App slice of #619 step 5, split out because the manifest half of steps 4–5 (compile provenance rows,
definePrebuilt) waits on #604 and this piece does not. Raised as a Codex P2 on #623:compileMcpAppsis a separate Rsbuild compiler, so a function-form or mutatorexternalsin a view build escaped bothAB4725and the evidence path.What changes
src/build/mcp-apps.ts:composeMcpAppsRsbuildConfigcomposesArtifactDependencyAuditPluginin its framework invariant layer (after the consumer'stoolshatch, beside the meta-module and app-runtime replacements), always — soinspect --bundlershows what runs — with an optionalonCompilationEvidencerecorder.compileMcpAppscollects oneCompilationEvidenceper view (each App is its own Rsbuild environment, socompilation.compiler.nameis the App name) andassertViewsSelfContainedfails the build withAB6005for every external any view kept. A browser document has no allowable external: no Node built-ins, no sibling module.src/build/external-policy.ts:viewSelfContainmentDiagnostics— the view form ofAB6005:Compiled MCP App view "mcp-apps/<name>.html" keeps "<request>" external (<type>)[, imported as "<specifier>",] from <issuer>; a view inlines every module it loads.src/build/dependency-audit-plugin.ts: module classes come fromcompilation.compiler.rspackinstead of the@rslib/coreimport, so theinstanceofchecks hold whichever Rspack instance (Rslib's or Rsbuild's) created the compilation.src/core/paths.ts:posixRelativeWhenInside(project-relative issuer names) replacesrslib.ts's privateprojectIssuer; both compilers use it.docs/diagnostics.md(AB60xxsummary row,AB6005row,AB7014preamble),website/docs/{en,zh}/guide/distribution/validation.mdx. Oneminorchangeset.assertSelfContainedViews(emitted-file inventory, externalscript/linkURLs in the HTML) stays: it judges the document, not the module graph.Tests
tests/mcp-apps-compile.test.ts:config.externals = { 'react-dom/client': 'ReactDOMClient' }(Rsbuild web target, defaultexternalsType: 'var') → exactly oneAB6005onmcp-apps/status.html, message namesReactDOMClient,react-dom/client,views/status.ts.createRsbuild, asserts one record namedstatuswithexternals: []andviews/StatusPanel.tsxamong its modules.Existing 17
compileMcpAppstests unchanged and green (fallback path, templates, favicon, source maps, size advisories).Verification
Run on the merged tree (
origin/mainmerged before each gate):pnpm build && pnpm typecheck && pnpm lint && pnpm test:unit— pass.pnpm docs:site:build— pass (dead-link, anchor, image, language-parity checks).pnpm test:integration:run— pass.Deslop: cursor-grok-4.6-high-fast, 5 edits (two JSDoc blocks cut to one "why" sentence each, one restating sentence dropped,
records[0]!→ typed[record]guard, one test assertion that could pass vacuously tightened).Self-review
gpt-5.6-sol-medium on the deslopped diff:
instanceof rspack.ExternalModule/NormalModuleused the@rslib/coreRspack instance, while MCP Apps compile through@rsbuild/core; a second Rspack instance would make both checks reject every module and let externals through silently (pins currently dedupe, so the test passed). Fixed: classes read fromcompilation.compiler.rspack.AB60xxsummary row indocs/diagnostics.mdstill limitedAB6005to host-pack/package-build entries. Fixed.Checked and found fine by the reviewer: the development-mode fallback (the production recompile is a fresh
compileMcpAppscall with its own evidence array); a thrownrsbuild.build()(compileFailurerethrows beforeassertViewsSelfContained);afterOptimizeModulesfiring per environment andcompiler.namebeing the environment name;renderConfigValueon the plugin instance ininspect --bundler; readable mode leaving externals unchanged; export reachability and helper de-duplication; thevardefault behind the message; en/zh parity; the changeset.Pass 2 — claude-fable-5-1-thinking-high on the fixed diff: no blocker.
AB6005row's primary-form description indocs/diagnostics.md, attaching the Node-built-in rationale to views. Fixed: moved after the expression-request sentence; notes the, imported asclause applies to both forms.assertViewsSelfContainedcomment credited the invariant layer with naming the compiler; Rsbuild does, and nothing pinnedbundler.name, so a hatch settingconfig.namewould surface as the opaque "found 0 records" error. Fixed: comment reworded;assertResolvedViewConfignow requires the resolved bundler names to be exactly the App names (the existing "invalid self-contained MCP App configuration" path).keeps … external (…)[, imported as …,][ from …];fragment was written twice inexternal-policy.ts. Fixed:keptExternalClauseshared by both message forms.AB7014preamble. Fixed: rewrapped.Verified by the reviewer and unchanged:
compilation.compiler.rspackis typed and populated from the creating module for Rsbuild, Rslib, and child compilers (whichthisCompilationnever records anyway); neither new test can pass vacuously (compileFailurerethrows non-DiagnosticErrors;toEqualpins type,imported as, issuer,generatedPath,recovery); docs and changeset consistent withviewSelfContainmentDiagnostics;minoris right (a hatch-externalized view that passed now fails).