Repository navigation
Retry VS Code unit-test yarn install on dnceng npm 429 - #21657
Conversation
The dnceng npm feed intermittently returns 429 Too Many Requests and Yarn 1 only retries 408/5xx. Mirror the bounded install retry that extension-e2e-tests.yml already uses so a single rate-limit response does not fail the Windows unit-test job. Tests themselves are not retried. Fixes #18691 Co-authored-by: Copilot <[email protected]>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 21657Or
iex "& { $(irm https://raw.githubusercontent.com/microsoft/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 21657" |
Tests selector1 / 100 PR test projects · 1 PR job, from 1 changed file. Selected PR test projects (1 / 100)
Selected PR jobs (1)
How these were chosen — grouped by what changed📄 Job reasons
Selection computed for commit |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the change adding bounded dependency-install retries to the Windows extension unit-test workflow.
No open issues 🎉
What changed in this PR
This PR reduces intermittent failures in Aspire’s Windows VS Code extension unit-test workflow caused by dnceng npm feed rate limiting, addressing #18691.
Changes:
- Retries dependency installation up to three times, with 30-second and 60-second delays.
- Logs retry attempts and fails the step after retries are exhausted.
- Leaves test execution unchanged; tests are not retried.
| File | Description |
|---|---|
.github/workflows/extension-unit-tests.yml |
Adds bounded retries around Yarn dependency installation, matching the existing extension E2E workflow approach. |
Review effort: Balanced
…file directories (#21660) ## Description Fixes #21659 Dependabot `npm_and_yarn` security-update PRs write internal dnceng `resolved` URLs into lockfiles that must use the public npm registry. Over the last 7 days, 4 of 5 such PRs failed CI on attempt 1, with 7–18 jobs failed per run: - `TemplatePackageLockTests.*_UsesPublicNpmRegistry` on every OS - Starter Validation - Docker `npm ci` E401 in the K8s TypeScript, PV and JavaScriptPublish E2E tests **Root cause:** if a package directory has no `.npmrc`, Dependabot walks up the parent directories to find one (dependabot-core `npm_and_yarn/file_fetcher.rb#npmrc` → `fetch_file_from_parent_directories`). It therefore uses the repo-root `.npmrc`, whose `registry=` is the dnceng feed. Local npm stops at the package root, so locally regenerated lockfiles stay on npmjs. Only Dependabot drifts. **Fix:** - Add a directory `.npmrc` with `registry=https://registry.npmjs.org/` to the 8 lockfile directories that must use the public registry: - `ts-starter`, `ts-starter/frontend`, `py-starter`, `py-starter/frontend`, `java-starter/frontend` - `aspire-ts-cs-starter/frontend` - `JsPublish/nextjs`, `JsPublish/npmscript` Dependabot reads the directory's own `.npmrc` first. - Don't ship these repo-only files to customers, so a user's own registry config isn't overridden: - `Aspire.Cli.csproj`: `EmbeddedResource Remove="Templating\Templates\**\.npmrc"` - `Aspire.ProjectTemplates.csproj`: `TemplateFiles` excludes `templates\**\.npmrc` - Repo-internal lockfiles that are meant to use dnceng are unchanged. **Selective CI:** a new `test-trigger-map.yml` path rule routes the JsPublish fixture `.npmrc` files to `test:Aspire.Cli.Tests`. The selector regression `TestTriggerMapTests.JsPublishFixtureNpmrcRunsCliPublicRegistryGuard` covers it: it fails with the rule reverted, and all 346 TestTriggerMap tests pass. **Regression tests** in `TemplatePackageLockTests`: - `PublicRegistryPackageLockDirectory_PinsPublicNpmRegistryForDependabot` (8 cases) - `CliTemplateResources_DoNotIncludeRepoOnlyNpmrc` ## Evidence **Before and after lockfile resolution.** This mirrors Dependabot's update on #21404: `npm install [email protected] --package-lock-only` on the ts-starter frontend from `main`. | `.npmrc` Dependabot sees | `resolved` hosts | vite 8.3.5 resolved | |---|---|---| | repo root (before) | 159 `registry.npmjs.org` + **17 `pkgs.dev.azure.com`** | `pkgs.dev.azure.com/dnceng/.../vite-8.3.5.tgz` | | directory `.npmrc` (after) | **177 `registry.npmjs.org`** | `registry.npmjs.org/vite/-/vite-8.3.5.tgz` | The "before" split is the same as the actual Dependabot commit on #21404 (17 dnceng URLs in this file). **Docker `npm ci`** (`node:22-alpine`, no credentials, `npm ci --ignore-scripts`): - Before lockfile: `npm error code E401 Unable to authenticate, your authentication token seems to be invalid` (exit 1). This matches CI. - After lockfile: `added 152 packages in 4s` (exit 0). **Tests and packaging:** - `TemplatePackageLockTests`: 33/33 pass locally. - With `ts-starter/frontend/.npmrc` removed, the new test fails as expected. - `dotnet msbuild Aspire.ProjectTemplates.csproj -getItem:TemplateFiles`: 303 items, 0 `.npmrc`, and the frontend `package-lock.json` is still included. **Out of scope:** the TypeScript SDK unit-test E401 comes from a lockfile that is meant to use dnceng and asks for versions the feed hasn't cached yet. dnceng 429 retries are covered by #18691 / #21657. ## 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 <[email protected]> Co-authored-by: Copilot <[email protected]>
|
✅ No documentation update needed. docs_optional → build_or_ci_only (proven false positive). Triggered signal: |
Description
Run VS Code extension unit tests (Windows)intermittently fails atInstall dependencieswhen the dnceng npm feed returns 429 Too Many Requests. Yarn 1.22 retries only 408 and 5xx responses (request-manager.js), so a single 429 fails the job.This PR gives that step the same bounded install retry that
extension-e2e-tests.ymlalready uses: 3 attempts with 30s and 60s backoff. It applies only to package installation.Run testsis not retried, and no assertions change.Fixes #18691
Evidence
Window:
ci.ymlattempt-1, 2026-10-25T13:15Z → 2026-11-01T13:23Z (840 runs). I scanned all 2,242 failed jobs (logs plus check-run annotations).Request failed "429 Too Many Requests"frompkgs.dev.azure.com/dnceng/.../dotnet-public-npm.Run VS Code extension unit tests (Windows), all atInstall dependencies. That lane had 315 decided jobs (main 62, PR 313) and 12 failures. Failing step lines:Validate VS Code extension bootstrap (Linux), which deliberately validates a cold Corepack cache. This PR leaves it unchanged.Retrying in 30s (attempt 2 of 3), and attempt 2 finished withDone in 6.76s.That job failed later, at the test step, for an unrelated reason.Validation
I extracted the exact
run:script from the workflow and ran it under pwsh 7.4.6 with GitHub's pwsh wrapper ($ErrorActionPreference = 'stop'plus the trailingexit $LASTEXITCODE). A native stubcorepackprinted the real 429 line for the first N calls.Start-Sleepwas stubbed to record the requested delays.failed after 3 attemptsOn this PR, CI runs the Windows unit-test job with the new step. A 429 can't be forced in CI, so the recovery path is shown by the local run above and by the E2E job's existing retry log.
Checklist
🤖 Posted by AspireAgent (AI Agent)