Skip to content

fix: Prevent lockfile-aware yarn test from hanging on corepack downloads#12095

Merged
anthonyshew merged 1 commit into
mainfrom
shew/hanging-yarn-test
Mar 2, 2026
Merged

fix: Prevent lockfile-aware yarn test from hanging on corepack downloads#12095
anthonyshew merged 1 commit into
mainfrom
shew/hanging-yarn-test

Conversation

@anthonyshew
Copy link
Copy Markdown
Contributor

Summary

  • Adds COREPACK_ENABLE_STRICT=0 to test helpers alongside the existing COREPACK_ENABLE_DOWNLOAD_PROMPT=0, preventing corepack from downloading exact package manager versions during tests
  • Widens COREPACK_HOME to COREPACK_* in BUILTIN_PASS_THROUGH_ENV so all corepack configuration vars pass through to tasks in strict env mode

Context

The previous fix (#12090) set COREPACK_ENABLE_DOWNLOAD_PROMPT=0 on the turbo process to auto-approve corepack downloads. This prevents the stdin-prompt hang but still requires corepack to download the exact version from the network. On CI runners with slow or restricted network access, this download itself hangs — which is why test_lockfile_aware_caching_yarn was still hitting the >120s SLOW threshold.

COREPACK_ENABLE_STRICT=0 tells corepack to fall back to whatever package manager version is already installed rather than insisting on downloading the exact version from the packageManager field. Since these tests only need echo building to run, the exact yarn version is irrelevant.

Additionally, BUILTIN_PASS_THROUGH_ENV only included COREPACK_HOME, meaning COREPACK_ENABLE_DOWNLOAD_PROMPT and COREPACK_ENABLE_STRICT were silently dropped from child task processes in strict env mode. Widening to COREPACK_* (consistent with DOCKER_*, GITHUB_*, VERCEL_*) ensures users who set these vars in their environment get them passed through to tasks.

@anthonyshew anthonyshew requested a review from a team as a code owner March 2, 2026 06:46
@anthonyshew anthonyshew requested review from tknickman and removed request for a team March 2, 2026 06:46
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
examples-basic-web Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
examples-designsystem-docs Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
examples-gatsby-web Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
examples-kitchensink-blog Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
examples-nonmonorepo Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
examples-svelte-web Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
examples-tailwind-web Ready Ready Preview, Comment, Open in v0 Mar 2, 2026 6:46am
examples-vite-web Building Building Open in v0 Mar 2, 2026 6:46am
turbo-site Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
turborepo-agents Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am
turborepo-test-coverage Building Building Preview, Comment, Open in v0 Mar 2, 2026 6:46am

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 2, 2026

Coverage Report

Metric Coverage
Lines 83.78%
Functions 79.69%
Branches 0.00%

View full report

@anthonyshew anthonyshew merged commit bf516e4 into main Mar 2, 2026
55 checks passed
@anthonyshew anthonyshew deleted the shew/hanging-yarn-test branch March 2, 2026 07:00
anthonyshew added a commit that referenced this pull request Mar 2, 2026
Previous fixes (#12090, #12095) set COREPACK_ENABLE_DOWNLOAD_PROMPT=0
and COREPACK_ENABLE_STRICT=0, which prevented interactive prompts but
did not stop corepack from downloading PM binaries from the network.
On CI with a cold cache, these downloads cause tests to exceed the
240s timeout.

Add `corepack prepare <pm>@<version> --activate` during test setup so
the exact declared version is cached locally before any test runs.
This covers both setup_integration_test and setup_lockfile_test paths.
github-actions Bot added a commit that referenced this pull request Mar 2, 2026
## Release v2.8.13-canary.9

Versioned docs: https://v2-8-13-canary-9.turborepo.dev

### Changes

- fix: Treat `npm: alias` dependencies as external, not workspace
references (#12061) (`b179cb8`)
- test: Port 18 more prysk tests to Rust (other/ +
lockfile-aware-caching/) (#12062) (`7887af2`)
- release(turborepo): 2.8.13-canary.8 (#12063) (`2a5522a`)
- fix: Preserve file: protocol entries in pruned yarn v1 lockfile
(#12064) (`ae5c1a1`)
- perf: Use stack-allocated OidHash in FileHashes and skip expanded
hashes on normal runs (#12065) (`677b248`)
- test: Port all 8 find-turbo prysk tests to Rust (#12066) (`f827fca`)
- fix: Support pnpm per-workspace lockfiles in turbo prune (#12067)
(`23d047d`)
- test: Port final 2 prysk tests to Rust (100% complete) (#12068)
(`6d7e057`)
- fix: Resolve Berry prune failure when resolutions contain patch
overrides (#12069) (`6fe3c5e`)
- test: Add lockfile fixture for yarn berry resolution pruning (issue
#2791) (#12071) (`6cc1654`)
- chore: Remove prysk test framework entirely (#12070) (`ed2d05a`)
- refactor: Clean up test infrastructure and eliminate duplication
(#12072) (`338911d`)
- fix: Retain injected workspace package entries during pnpm lockfile
pruning (#12073) (`acbe869`)
- ci: Exclude turborepo-lsp and turborepo-schema-gen from test builds
(#12075) (`4ce12e2`)
- refactor: Clean up test infrastructure + improve test quality (#12074)
(`4571f2b`)
- ci: Remove redundant cargo build from coverage job (#12077)
(`3c9bbe2`)
- perf: Speed up lockfile test suite (#12078) (`20024df`)
- ci: Remove integration test serialization (#12079) (`24d7c02`)
- fix: Preserve `file:` and `link:` protocol entries in pruned bun
lockfile (#12076) (`2635d9a`)
- fix: Stop running unnecessary npm install in engines tests (#12081)
(`24e4905`)
- test: Add lockfile fixture for pnpm v9 injected workspace deps (issue
#8243) (#12082) (`4d4929b`)
- fix: Filter orphaned Yarn packageExtensions entries during lockfile
pruning (#12084) (`68eb223`)
- fix: Align experimentalObservability on object maps rather than arrays
(#12089) (`9b9d1e4`)
- examples: Upgrade with-react-native-web example to use latest versions
(#12085) (`980ca43`)
- fix: duplicate /signup? in Vercel URL (#12088) (`e865b51`)
- ci: Deduplicate Rust test compilation with nextest archive (#12083)
(`962cf39`)
- fix: Prevent yarn integration tests from hanging on corepack prompts
(#12090) (`29b0da7`)
- fix: Prevent turbo dev from hanging when daemon file watching fails
(#12091) (`b0d2f62`)
- ci: Skip pnpm install for Rust test jobs (#12092) (`ebd137f`)
- perf: Optimize npm lockfile parser (#12093) (`e4b4a66`)
- chore: Trim unused dependency features for faster compilation (#12094)
(`03b79e0`)
- fix: Prevent lockfile-aware yarn test from hanging on corepack
downloads (#12095) (`bf516e4`)
- fix: Exclude turborepo-repository from JS smoke test in release
workflow (#12097) (`fecc400`)

---------

Co-authored-by: Turbobot <turbobot@vercel.com>
anthonyshew added a commit that referenced this pull request Mar 2, 2026
…12099)

## Summary

- Previous fixes (#12090, #12095) set
`COREPACK_ENABLE_DOWNLOAD_PROMPT=0` and `COREPACK_ENABLE_STRICT=0` to
address hanging yarn tests, but neither flag prevents corepack from
downloading PM binaries from the network. On CI with a cold corepack
cache, these downloads cause tests like `test_single_package_build_yarn`
to exceed the 240s timeout.
- Adds `corepack prepare <pm>@<version> --activate` during test setup so
the exact declared version is cached locally before any test invokes it.
This covers both `setup_integration_test` and `setup_lockfile_test`
paths, fixing the hang for all PM-based integration tests.
- Removes the `COREPACK_ENABLE_STRICT=0` workaround that was based on a
misunderstanding of what that flag does (it controls cross-PM
enforcement, not version downloading).

## How to test

The `test_single_package_build_yarn` and
`test_lockfile_aware_caching_yarn` tests should no longer hang or appear
as SLOW in CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant