Repository navigation
fix(fix): run a pinned Yarn Berry through corepack when the yarn on PATH is classic - #54
Merged
Merged
Conversation
…ATH is classic A repository that pins yarn@2 or later in packageManager failed to install under fix and verify when the global yarn was classic 1.x (or absent): Yarn stopped with "the current global version of Yarn is 1.22.22". The same failure CI had on tldraw's ground truth. - availability.ts: needsCorepack says when the pinned Berry cannot run through the yarn on PATH (classic, another version, or none); throughCorepack runs the same install as `corepack yarn ...` with COREPACK_ENABLE_DOWNLOAD_PROMPT=0 and COREPACK_ENABLE_AUTO_PIN=0, without `corepack enable` or any change to the user's global config; COREPACK_NPM_REGISTRY from the environment passes through. A matching Berry on PATH is used as it is. - Without corepack the run stops before cloning (PACKAGE_MANAGER_UNAVAILABLE, exit 2) with "Next: corepack enable"; when corepack cannot fetch the pinned version, the message names COREPACK_NPM_REGISTRY and the manual activation command. - manager.ts: PackageManager.via marks the corepack route; updateArgs prefixes `yarn` then. - fixtures/repos/yarn-berry-pinned: a synthetic repository pinning yarn@4.7.0 with a Berry lockfile, used by the unit tests for detection, command selection and the messages. - docs/troubleshooting.md: "Yarn 4 says the global Yarn is 1.x". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018u9b3Pp5H68DdYZGp5Qg1U Signed-off-by: Lucas Braum <lucas.braum@deskfy.io>
lucasbraum
marked this pull request as ready for review
October 10, 2026 01:45
Merged
lucasbraum
pushed a commit
that referenced
this pull request
Oct 10, 2026
This PR was opened by the [Changesets release](https://github.com/changesets/action) GitHub action. When you're ready to do a release, you can merge this and publish to npm yourself or [setup this action to publish automatically](https://github.com/changesets/action#with-publishing). If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated. # Releases ## uptide@0.6.1 ### Patch Changes - [#56](#56) [`c64ba2c`](c64ba2c) Thanks [@lucasbraum](https://github.com/lucasbraum)! - The HTML report's light theme uses `#6A675F` for dimmed text (5.1:1 on the page background, was 4.2:1, below WCAG AA's 4.5:1), and the package's homepage is https://uptide-dev.github.io/docs. - [#54](#54) [`c502cc8`](c502cc8) Thanks [@lucasbraum](https://github.com/lucasbraum)! - `fix` and `verify` install a repository that pins Yarn 2 or later in `packageManager` even when the `yarn` on PATH is classic 1.x or absent: the pinned version runs through corepack (`corepack yarn install ...`, download prompt off) without enabling corepack or changing anything on your machine outside corepack's cache. Before, Yarn stopped the run with "the current global version of Yarn is 1.22.22". When corepack is missing, the run stops before cloning with exit code 2 and the command to run (`corepack enable`); when corepack cannot fetch the pinned version, the message names `COREPACK_NPM_REGISTRY` for corporate mirrors. Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.com>
This was referenced Oct 10, 2026
lucasbraum
added a commit
that referenced
this pull request
Oct 10, 2026
…st (#59) ## What and why Closes #58. `forwards real workspace worker events without serializing the callback` (`packages/core/src/check/progress.test.ts`) imported the shared `packages/core/dist/index.js`. `pnpm build` runs tsup with `clean: true`, which deletes and rewrites `dist/`. A build running at the same time as the test (the PR #54 case: lint and build in parallel) can remove the bundle while the child process imports it. This was not a timing problem. There are no sleeps or fixed timeouts, and event order is fine: progress messages and the result share one worker port, so they arrive in order. Both failures I reproduced are the same `ERR_MODULE_NOT_FOUND`: ``` Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/user/uptide/packages/core/dist/index.js' imported from /home/user/uptide/packages/core/[eval1] ``` The test exists to run the **built** worker (`dist/worker.js`), which the source-based suite never runs, so it still needs a real build. It now builds its own copy: - tsup with the package's own config, `--no-dts --no-sourcemap` (about 1 s), into a fresh `mkdtemp` directory under `packages/core/node_modules/`. Being inside the package lets the bundle's bare imports (`ts-morph`, …) resolve. - The directory is removed in `afterAll`. No published code changes, so there is no changeset. ## How it was verified Each loop is 50 runs of `vitest run src/check/progress.test.ts -t 'forwards real workspace'` on a 4-core machine: | Load | Before | After | |---|---|---| | Busy loop on every core | 0 / 50 failed | not rerun (time was never the cause) | | `pnpm build` and `pnpm lint` looping in parallel | **2 / 50 failed (4%)**, both `ERR_MODULE_NOT_FOUND` | **0 / 50 failed** | At a 4% rate, 0 failures in 50 runs could still happen by chance (about 13%), so I also checked the mechanism directly. With `packages/core/dist` deleted, the original test fails with the same error and the new one passes. ## Checklist - [x] Tests for the change (with `dist/` removed: the old test fails, the new one passes) - [x] `pnpm lint && pnpm typecheck && pnpm test` pass (core 927 passed / 15 skipped, cli 350 passed) - [x] README and docs updated if behavior changed (no behavior change) - [x] Changeset added if a user would notice (test-only, none) - [x] No new dependency (tsup is already a devDependency of `@uptide/core`) - [x] No private code, names or paths in fixtures, tests or docs - [x] The rules in CONTRIBUTING.md ("Rules that do not bend") still hold Not changed here: other tests that read a package's `dist/` (for example `packages/cli/src/list-registry.test.ts` and `telemetry/sender.test.ts`) could hit the same race when a build runs alongside them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EmiChUUtLdjbg6mNzKqVep --- _Generated by [Claude Code](https://claude.ai/code/session_01EmiChUUtLdjbg6mNzKqVep)_ Signed-off-by: Claude <noreply@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com>
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.
What and why
On a repository whose
package.jsonpins"packageManager": "yarn@4.x"(any Yarn 2 or later) while the globalyarnis classic 1.x, or there is none,uptide fixanduptide verifyfailed to install: Yarn stopped with "This project's package.json defines packageManager yarn@4.7.0. However the current global version of Yarn is 1.22.22". The same failure the pack-test job had on tldraw's ground truth (#53), fixed there with corepack in CI.The installer used by
fixandverify(packages/core/src/fix/managers/availability.ts) now:yarnon PATH cannot run: classic 1.x, another version than the pin, or no yarn at all (needsCorepack). A Berry on PATH at the pinned version is used as before.corepack yarn install --immutable --mode=skip-build, withCOREPACK_ENABLE_DOWNLOAD_PROMPT=0andCOREPACK_ENABLE_AUTO_PIN=0(throughCorepack). Nothing on the user's machine changes outside corepack's own cache: nocorepack enable, no shim, no rewrite ofpackageManager. Every later install in the run (updateArgs, the plaininstall) goes through the same route (PackageManager.via).PACKAGE_MANAGER_UNAVAILABLE, raised byrun.tsbefore any clone), with the exact command:COREPACK_NPM_REGISTRYfrom the environment (it passes through to the corepack call as it is) and names it only when corepack could not fetch the pinned version, together with the manual activation command.docs/troubleshooting.mdgains "Yarn 4 says the global Yarn is 1.x", and the "Package manager not available" section points to it.packs/tooling/truth.ts(ground-truth installs forpack test) is unchanged; CI handles that withcorepack enablesince #53.How it was verified
Unit tests in
availability.test.ts, against a new fixturefixtures/repos/yarn-berry-pinned(synthetic: pinsyarn@4.7.0, Berry lockfile, node-modules linker, nothing installed):corepack yarn install --immutable --mode=skip-build, prompt off,via: 'corepack',updateArgsprefixed withyarn;yarn --version,corepack --version,corepack yarn --version) and thatcorepack enableis never run;Next: corepack enable; corepack unable to fetch → message withCOREPACK_NPM_REGISTRYand the activation command (and the registry hint absent when corepack is simply missing); a corepack yarn at the wrong version →PACKAGE_MANAGER_VERSION.pnpm lint,pnpm typecheck,pnpm docs:links, the private-material guard, core (928 tests) and CLI (350 tests) pass. One unrelated test (check/progress.test.ts, worker-event forwarding) failed once while the suite shared the machine with the build, and passed three times in isolation.Checklist
pnpm lint && pnpm typecheck && pnpm testpasspnpm changeset): patch🤖 Generated with Claude Code
https://claude.ai/code/session_018u9b3Pp5H68DdYZGp5Qg1U
Generated by Claude Code