Repository navigation
Ignore just-published npm releases in Docker CLI E2E shells - #21615
Jose Perez Rodriguez (joperezr) merged 2 commits into
Conversation
TypeScript AppHost scaffolds use floating npm ranges, so an E2E run that installs minutes after an upstream publish can resolve the new version from registry metadata before its tarball is downloadable and fail with E404 during 'aspire init' (JavaScriptPublishTests flake, #21600). Export npm_config_before (now - 1 day) in PrepareDockerEnvironmentAsync so range resolution picks settled releases. Tests that acquire the newest @playwright/cli by exact version opt out. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21615Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21615" |
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
🟡 Changes recommended
The new E2E test lacks a host npm prerequisite declaration and has a port-allocation race, causing failures when npm is absent or another process claims the port.
2 open issues
What changed in this PR
Reduces npm fresh-release failures in Aspire’s Docker-based CLI E2E tests, addressing part of the flaky-test effort tracked in #21600.
Changes:
- Applies a one-day npm release cutoff by default in Docker E2E shells.
- Exempts three scenarios that intentionally acquire the newest Playwright CLI release.
- Adds a local-registry regression test and a cutoff-formatting test.
| File | Description |
|---|---|
tests/Aspire.Cli.EndToEnd.Tests/SettledNpmReleasesTests.cs |
Tests fresh-release tarball failures and cutoff behavior. |
tests/Aspire.Cli.EndToEnd.Tests/PlaywrightCliInstallTests.cs |
Disables the cutoff for two latest-version installation scenarios. |
tests/Aspire.Cli.EndToEnd.Tests/NewWithAgentInitTests.cs |
Disables the cutoff for Playwright acquisition during project creation. |
tests/Aspire.Cli.EndToEnd.Tests/Helpers/CliE2EAutomatorHelpers.cs |
Exports the npm cutoff during Docker setup, with an opt-out. |
Review effort: Balanced
…site Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests selector1 / 100 PR test projects · 0 PR jobs, from 4 changed files. Selected PR test projects (1 / 100)
Selected PR jobs (0)none How these were chosen — grouped by what changed🧪 🧪 🧪 🧪 Job reasonsnone Selection computed for commit |
## Description Fixes a flake in `Aspire.Cli.EndToEnd.Tests.JavaScriptPublishTests.JavaScriptHostingApisRunFromTypeScriptAppHost`, tracked in #21600. The test started the AppHost with `aspire run > aspire-run.log 2>&1 &` and then immediately ran `verify-runtime.sh`. That script gives each resource 30 × 1s to write its `ready-port` file and answer HTTP. Because nothing waited for the AppHost first, the 30s budget also covered AppHost server preparation and startup. On busy CI runners those regularly take longer than 30s, so the test failed with `node-npm_FAIL` while `aspire-run.log` still showed `⚙️ Preparing Aspire server...`. Changes, all in this one test file: - Start the AppHost with `aspire start` (via `AspireStartAsync`), which returns once the AppHost and dashboard are up. - Run `aspire wait <resource> --status up --timeout 300` for each of `node-npm`, `javascript-pnpm`, `vite-yarn` and `next-bun`. - Then run the unchanged endpoint checks in `verify-runtime.sh`. These still verify that each package manager actually ran the app and that it serves HTTP. - Replace the failure diagnostics. They printed `aspire-run.log`, which no longer exists. They now print `aspire describe <name>` and `aspire logs <name>`. - Clean up with `aspire stop` instead of killing a PID. There are no sleeps, retries or loosened assertions. The npm/`AllPublishMethodsBuildDockerImages` failures are handled separately by #21615. That PR lists this failure mode as "not addressed here". This PR doesn't touch any of the files #21615 changes. ## Evidence **CI failures** (both on unrelated branches): - Run [41207387696](https://github.com/microsoft/aspire/actions/runs/41207387696/job/124557722651) - Run [41214363995](https://github.com/microsoft/aspire/actions/runs/41214363995/job/124579017281) From the terminal recording of the first one: - `aspire run &` is issued at t=68.08s. - `verify-runtime.sh` starts at t=68.33s. - `node-npm_FAIL` appears at t=98.37s, exactly 30s later. - At that point `aspire-run.log` only contains `⚙️ Preparing Aspire server...`. **Local repro with a real TypeScript AppHost.** I used the published Aspire CLI 13.6.4 with the same `addNodeApp`/`addJavaScriptApp` + `withNpm({ install: false })` fixtures and the same 30×1s verifier. Two settings matched CI: - The AppHost server cache (`.aspire/integrations`) was cleared, matching the first run in CI. - The 2-core machine was loaded with 4 busy loops to simulate a busy runner. **Before**, using the old flow (`aspire run &`, then verify immediately). This reproduces the CI signature: ``` t0 aspire run & node-npm_FAIL ===== tail aspire-run.log ===== ⚙️ Preparing Aspire server... verify exit=1 after 30403ms ``` **After**, using this PR's flow (`aspire start`, then `aspire wait --status up`, then verify): ``` t0 aspire start aspire start exit=0 at 52309ms ✅ Resource 'node-npm' is up (running). (0.0s) ✅ Resource 'javascript-npm' is up (running). (0.0s) node-npm_OK javascript-npm_OK RUNTIME_ALL_OK verify exit=0 at 54832ms ✅ apphost.mts stopped successfully. ``` A cold start took about 52s, well over the old 30s budget. With readiness gating, the endpoint probes pass within about 0.1s of the resources reporting up. **Tests** - `Aspire.Cli.EndToEnd.Tests` builds cleanly. - The changed test runs in this PR's CI as the `Cli.EndToEnd-JavaScriptPublishTests` job. ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [x] Yes - [ ] No - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
[automated] Starting natural paired Docker CLI E2E validation of this test-only change: 25 pre-fix and 50 post-fix fresh Ubuntu runners initially, one JavaScriptPublishTests class invocation per runner. If the original signature does not reproduce, cumulative sampling may increase to 250 provisioned runners per arm. Historical npm release windows and other failure causes will be reported separately; passing samples will not be treated as proof of zero flakiness. |
…21634) ## Description Fixes the npm fresh-release E404 part of the `Polyglot SDK Validation` TypeScript flake tracked in #21600. ### Root cause TypeScript AppHost scaffolds and fixtures declare floating npm ranges. The TypeScript validation container runs `npm install` without a release-age limit. If a run installs a few minutes after an upstream publish, npm picks the new version from the packument while its tarball still returns 404. `aspire init --language typescript` then fails with `npm error code E404` / `❌ The app could not be created.` In the last 7 days this caused 5 failed jobs across 3 unrelated branches (details in #21633). Each failure came 2–4 minutes after the upstream publish of `@typescript-eslint/typescript-estree@8.72.1` or `@types/estree@1.0.10`. These are the same publishes #21615 fixes for the CLI E2E Docker shells, but that PR doesn't cover this container. ### Fix The `Run TypeScript SDK validation` step now passes `npm_config_before=<now − 1 day>` into the container ([npm `before` config](https://docs.npmjs.com/cli/v11/using-npm/config#before)). This matches #21615. npm range resolution in `aspire init`, the fixture installs, the JavaScript app installer and the Nuxt fixture only selects releases that have had time to propagate. The global tool installs at image build time are unaffected. pnpm, Yarn and Bun don't read this setting. No retries, sleeps or skips are added. ### Validation - **Mock registry with npm 11.19.0 (the image's npm):** the packument lists `1.1.0` (published 2 minutes ago, tarball 404) and `1.0.0` (30 days old). - Without the cutoff, `npm install pkg@^1.0.0` fails with `npm error code E404`, the CI signature. - With the cutoff, it installs `1.0.0`. - **Real registry with npm 11.19.0 and the cutoff:** - The TypeScript scaffold's dependency set installs. - `playground/NuxtApp/web` installs, with 596 packages including `nuxt@4.5.2`. - All 58 npm-managed `tests/PolyglotAppHosts/*/TypeScript` and integration playground `package.json` files resolve. No ETARGET. - The pnpm fixture resolves. - **`actionlint`:** passes on `polyglot-validation.yml`. Other intermittent TypeScript validation failures from the same window have different causes and are not addressed here: the Nuxt dev-mode health wait timing out (3), `bun install` `ConnectionRefused` (2), and an MCR pull failure (1). Fixes #21633 ## Checklist - Is this feature complete? - [x] Yes. Ready to ship. - [ ] No. Follow-up changes expected. - Are you including unit tests for the changes and scenario tests if relevant? - [ ] Yes - [x] No (CI workflow configuration only; validated as described above) - Did you add public API? - [ ] Yes - [x] No - Does the change make any security assumptions or guarantees? - [ ] Yes - [x] No **🤖 Posted by AspireAgent (AI Agent)** Co-authored-by: davidfowl <95136+davidfowl@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Jose Perez Rodriguez (joperezr)
left a comment
There was a problem hiding this comment.
The one-day npm cutoff stabilizes external dependency inputs without changing the scaffold, publish, endpoint, or success assertions. Tests whose purpose is newest-release acquisition explicitly opt out. The tradeoff is delayed coverage of ordinary dependencies published within the last day, not relaxed application expectations. Additional paired-validation results can be considered separately for merge readiness.
|
✅ No documentation update needed. docs_optional → test_only. No signals triggered (signal_count == 0). All 4 changed files match |

Description
Fixes the npm part of the
Aspire.Cli.EndToEnd.Tests.JavaScriptPublishTests.AllPublishMethodsBuildDockerImagesflake. It is #5 under "Top unowned flakes" in #21600.Root cause
TypeScript AppHost scaffolds declare floating npm ranges (
TypeScriptLanguageSupport.cs:typescript-eslint ^8.57.1,eslint ^10.0.3,nodemon ^3.1.14, …). The Docker E2E shells runnpm installwith no age limit. If a run installs a few minutes after an upstream publish, npm resolves the new version from the packument while its tarball is still 404.aspire initthen fails withnpm error code E404, and the test times out waiting forCreated apphost.mtsor hits anERRprompt.Publish times compared with failure times:
@typescript-eslint/typescript-estree@8.72.1, published 2026-10-26T17:08:21ZJavaScriptHostingApisRunFromTypeScriptAppHost); 121723096663 at 17:12:51Z@types/estree@1.0.10, published 2026-10-29T04:34:27ZAll three failures came within 2–5 minutes of the publish, on unrelated branches.
7-day denominator
The job is
Cli.EndToEnd-JavaScriptPublishTests (ubuntu-latest). Window: 2026-10-24T20:00Z → 2026-10-31, 751 head SHAs.aspire initnpm installs that stalled without an E404 in the log (122678762903, 124617913801). They have the same symptom, but I can't prove the same cause.verify-runtime.shgiving up after its 30s budget whileaspire runstill showed "Preparing Aspire server..." (10-31). One is a 5-minute pipeline timeout.Fix
PrepareDockerEnvironmentAsyncnow exportsnpm_config_before=<now − 1 day>, using npm'sbeforeconfig. The E2E images ship npm 10;min-release-ageneeds npm ≥ 11.10. With the cutoff:npm viewignoresbefore. For example,RepositoryToolUpdateTestsstill sees the reallatest.npm packof an exact version newer than the cutoff fails with ETARGET. The three tests whose subject is acquiring the newest@playwright/cliby exact version therefore opt out withuseSettledNpmReleases: false:PlaywrightCliInstallTests×2 andNewWithAgentInitTests.No assertions are weakened, and the change adds no sleeps or retries.
Regression test
SettledNpmReleasesTestsstarts an in-process npm registry that reproduces the post-publish state.1.1.0is listed in the packument, published 2 minutes ago, and its tarball returns 404.1.0.0is 30 days old and downloadable.npm install pkg@^1.0.0fails withE404on the1.1.0tarball. This is the CI signature, and the test asserts this control case.GetSettledNpmReleasesCommand(now): the install succeeds with1.0.0.Local results:
GetSettledNpmReleasesCommandstubbed to a no-op, the test fails:npm error code E404 … GET http://127.0.0.1:…/aspire-e2e-settle-probe-1.1.0.tgz - Not found.E2E evidence
The change only affects the CLI E2E Docker shells, so the evidence is CI running real CLI/DCP with the cutoff active:
56c6ec1e: all 131 checks passed and 0 failed.Cli.EndToEnd-JavaScriptPublishTestsand every TypeScript/JavaScript CLI E2E class that runsaspire init/npm install.Cli.EndToEnd-SettledNpmReleasesTestsran with 2 succeeded and 0 skipped.33e39428: only changes the regression test (review feedback). Run 41242524837 passed with 130 checks passing and 0 failing, includingCli.EndToEnd-JavaScriptPublishTests.Cli.EndToEnd-SettledNpmReleasesTestsran with 2 succeeded and 0 skipped.PlaywrightCliInstallTestsandNewWithAgentInitTestsare[OuterloopTest], so PR CI doesn't run them. They opt out of the cutoff, which leaves their npm behavior unchanged.Checklist
🤖 Posted by AspireAgent (AI Agent)