Repository navigation
Fix stale JS bundle and E2E build blockers in Components AGENTS.md - #68800
Merged
Merged
Conversation
The documented path omitted the _framework segment, so the check never matched a real artifact. It also only tested for presence, which misses the common failure where pm run build:production was run alone and left a stale dist/Debug bundle that the .NET Debug build silently consumes. Replace it with a freshness comparison against the newest .ts source, in both PowerShell and bash. Co-authored-by: Copilot App <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Components agent guidance to verify JavaScript bundle freshness (not just presence) by comparing the built bundle’s timestamp against the newest TypeScript source, helping prevent Debug builds/tests from silently using stale dist/Debug outputs.
Changes:
- Rewrites “Check JS assets” guidance to validate that
dist/Debug/_framework/blazor.web.jsis newer than the newest.tssource. - Adds ready-to-run freshness checks for both PowerShell and bash.
- Updates Quick Reference and explicitly warns against using
npm run build:productionalone (since it can leavedist/Debugstale).
Suppressed comments (1)
src/Components/AGENTS.md:170
- Quick Reference step 2 tells readers to run
npm run buildwhen the bundle is stale, but doesn’t say where to run it. Since the step above explicitly says to run the check from the repo root (andnpm run buildat the root builds all workspaces), calling out the repo root here reduces ambiguity.
1. **First time only**: `.\eng\build.cmd` → create `artifacts\agent-sentinel.txt`
2. **Check JS assets are fresh**: Verify `src\Components\Web.JS\dist\Debug\_framework\blazor.web.js` is newer than the newest `.ts` source (see step 2 above for the command); run `npm run build` - never `build:production` alone - if `STALE`
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+113
to
+114
| - If it reports `STALE`, run `npm run build` from `src\Components\Web.JS`, then re-run the check. | ||
| - Always use `npm run build`. **Never** use `npm run build:production` on its own: it writes only `dist\Release` and leaves `dist\Debug` stale, so the Debug build keeps using your old code. |
The first E2E build in a fresh worktree fails twice: once on the uninitialized MessagePack submodule, and once on missing ANCM native assets. Neither was documented, so agents rediscover both the slow way. Co-authored-by: Copilot App <[email protected]>
Initializing submodules is now part of first-time setup, and -p:UseIisNativeAssets=false is baked into every documented dotnet build command rather than offered as an after-the-fact remedy. Co-authored-by: Copilot App <[email protected]>
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.
Three defects in
src/Components/AGENTS.md, all found by an agent actually hitting them during the investigation that shipped #68088 — not by reading the file.1. The JS asset path was wrong
src/Components/Web.JS/rollup.config.mjsmaps outputs under_framework/, so the real artifact isdist\Debug\_framework\blazor.web.js. The documented path omitted_frameworkand therefore never existed, which made the check useless as written.2. Presence is not freshness
npm run build:productionwrites onlydist/Releaseand has noprebuild/cleanof its own, so running it alone leaves a staledist/Debug. The .NET Debug build then silently consumes the old bundle and E2E tests behave exactly as if the.tschange were never made — no error message anywhere. In the #68088 investigation this burned a full E2E cycle chasing a fix that was never in the bundle under test.Section 2 now compares the bundle's timestamp against the newest
.tssource, in both PowerShell and bash, says to usenpm run buildand neverbuild:productionalone, and notes to re-check after agit stash,git checkout --, or branch switch that touches a.ts.3. Two build blockers that stopped the documented E2E command
The documented E2E build command fails twice on a fresh worktree, and the file pointed agents straight at it for exactly that case. In #68088 this cost ~21 minutes across two consecutive failures.
Rather than documenting these as symptoms to recognize after the fact, the guidance now steers around them up front:
git submodule update --init --recursiveis part of first-time setup, with a note that worktrees do not inherit submodules from the checkout they were created from. (Verified: in a fresh worktreegit submodule statusreports MessagePack-CSharp uninitialized and the directory is empty.)-p:UseIisNativeAssets=falseis now baked into every documenteddotnet build/dotnet runcommand, plus a short "Standard build flags" note and a Quick Reference entry saying to pass it unless you are working on IIS. The E2E section keeps a one-line explanation of why it is required there, and a pointer back to step 1 if the build fails on MessagePack instead.Components.TestServerreferencesMicrosoft.AspNetCore.Server.IIS, the project that raises the ANCM error, so itsdotnet runline gets the flag too.Verification
Both freshness checks were verified on a synthetic tree, no build required: bundle absent →
STALE; bundle touched after the.ts→fresh;.tstouched again →STALE; bundle removed →STALE. The literal text as it appears in the doc was re-run from a file to confirm the pasted form behaves identically.-print -quitwas deliberately avoided —-quitis a GNUfindextension and is absent on macOS/BSD. The snippet uses only POSIX predicates plushead -n 1, and guards the missing-bundle case before reachingfind -newer.The MSBuild claims were checked against the repo:
.gitmodulesdeclares the MessagePack submodule path, andUseIisNativeAssetsis what gates the ANCM error inMicrosoft.AspNetCore.Server.IIS.csproj:43and theValidateNativeComponentsBuilttarget inMicrosoft.AspNetCore.Server.IntegrationTesting.IIS.csproj:33.Documentation-only. No tests were run and none are needed.