Repository navigation
fix: preserve compatible workspace ranges and widen rejecting peers - #79
Merged
Merged
Conversation
Signed-off-by: Lucas Braum <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
Signed-off-by: Lucas Braum <[email protected]>
Merged
7 tasks done
lucasbraum
added a commit
that referenced
this pull request
Oct 11, 2026
## What and why `uptide fix react --target 19.3.0` on medusajs/medusa at `146c46b0ad` passed range preflight after #79, then crashed during usage analysis with `Cannot read properties of undefined (reading 'escapedName')`. Scoped `rootFiles` were added to ts-morph without respecting `allowJs`. The root workspace therefore retained a JavaScript syntax tree that TypeScript excluded from its program, leaving its property symbols unbound. Requesting the contextual type of an object passed to `JSON.stringify` in `www/packages/docs-ui/scripts/generate-mermaid-icons.mjs:109` dereferenced one of those missing symbols. The installed compiler was TypeScript 5.9.3; the crash occurred within ts-morph's bundled 6.0.2, not a TS 7/tsgo mismatch. Filter scoped JavaScript roots according to effective `allowJs`, including the `checkJs` default. Enabled JavaScript remains analyzed; compiler exceptions are not suppressed. Includes a patch changeset and is rebased onto main after #79. ## How it was verified - The minimal fixture (`JSON.stringify({ icons: {} })`) failed with the same `escapedName` error before the fix for `.js`, `.jsx`, `.mjs`, and `.cjs`. It now checks disabled/enabled JavaScript, implicit `checkJs`, explicit `allowJs: false`, and preserved TypeScript usages. - `pnpm lint` and `pnpm typecheck` passed. - Full package suites: `TMPDIR=/private/tmp pnpm -r test --maxWorkers=4` — **1,556 passed, 28 skipped** (1,170 core + 386 CLI). Running directly preserves canonical TMPDIR; Turbo's environment filtering caused an unrelated macOS `/var` versus `/private/var` release-test failure in the first attempt. - Integration build passed. After `corepack enable` and `yarn install --immutable`, the original #79 revision plus this fix completed Medusa analysis, ran its baseline test command, and reached dependency installation. The run then exited 2 because Yarn 3.2.1 rejects `yarn install --mode=skip-builds`. That separate package-manager blocker remains; this does not claim a successful migration. The original Medusa checkout stayed clean and no Medusa PR was created. Assisted edits were disabled with `--no-llm`. ## Checklist - [x] Tests for the change (a bug fix starts with a failing test) - [x] Lint, typecheck, and full package test suites pass (commands above) - [x] README and docs reviewed; no changes needed to restore the existing compiler-setting behavior - [x] Changeset added - [x] No new dependency - [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 Signed-off-by: Lucas Braum <[email protected]>
lucasbraum
pushed a commit
that referenced
this pull request
Oct 11, 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 ## [email protected] ### Patch Changes - [#79](#79) [`560d87d`](560d87d) Thanks [@lucasbraum](https://github.com/lucasbraum)! - Preserve workspace ranges that already accept upgrade targets, including companions, and report them as already compatible. Widen rejecting peer ranges without removing alternatives and give widening instructions for unsupported ranges. Fix the workspace-root command hint to retain the target and use positional package syntax without npx. Verify that installed target and companion versions exactly match the plan, including when ranges already accept the target. Preserve exact Yarn Berry resolutions without narrowing manifests and correct Yarn 3's build-suppression flag. Limit Yarn Berry descriptor pinning to unchanged compatible npm ranges and aliases, avoiding self-resolutions when an exact dependency is upgraded. Co-authored-by: uptide-release[bot] <338861287+uptide-release[bot]@users.noreply.github.com>
Merged
Merged
7 tasks done
lucasbraum
pushed a commit
that referenced
this pull request
Oct 12, 2026
… check A 0.7.4 regression from #79. upgradeInstall read sections in the order dependencies, devDependencies, optionalDependencies, peerDependencies, so a workspace declaring the moved package as a widened peer (`^18.3.1 || ^19.0.0`) next to a bumped devDependency (`^19.3.0`) had the peer range overwrite the installable one: - the post-install check looked the peer range up, which is no lockfile descriptor; Yarn read an old copy and fix stopped with "Requested [email protected], but packages/design-system/icons resolved 17.0.2" (medusajs/medusa); - npm and pnpm installed with the peer range rewritten to the exact version. Only dependencies, devDependencies and optionalDependencies now feed the install, `yarn set resolution` and the check; peer ranges are validated and widened in the manifest only. Fixture fixtures/lockfiles/peer-widened (npm, pnpm, Yarn 3, Yarn 4): all four cases fail on main and pass here. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EmiChUUtLdjbg6mNzKqVep Signed-off-by: Claude <[email protected]>
lucasbraum
added a commit
that referenced
this pull request
Oct 12, 2026
… check (0.7.4 regression) (#85) ## What and why A regression from #79, shipped in 0.7.4. `upgradeInstall` walked a workspace's sections in the order `dependencies`, `devDependencies`, `optionalDependencies`, `peerDependencies`. Take a workspace that declares the moved package as a widened peer (`^18.3.1 || ^19.0.0`, which #79 introduced) next to a bumped devDependency (`^19.3.0`). There, the peer range overwrote the installable one: - **The post-install check** looked up the peer range, which is no lockfile descriptor. Yarn then read an old copy kept by another package, and `fix` stopped. On medusajs/medusa (Yarn 3.2.1), `packages/design-system/icons` gave: `Requested [email protected], but packages/design-system/icons resolved 17.0.2; verification cannot use a different target.` - **npm and pnpm** installed with the peer range temporarily rewritten to the exact version (`peerDependencies.react: "19.3.0"`). Now only `dependencies`, `devDependencies` and `optionalDependencies` feed the install descriptors, `yarn set resolution` and the check. Peer ranges are validated and widened in the manifest only. A workspace that declares the package only as a peer isn't checked, since it doesn't install it. Rebased onto `main` after #84 landed; one commit, signed off. The only conflict was the Yarn Berry `set resolution` loop, which #84 had also changed. The result keeps #84's change (rewritten ranges are pinned too) and loops over the installed sections only. ## How it was verified New fixture `fixtures/lockfiles/peer-widened/` for npm (v3), pnpm (v9), Yarn 3 (lockfile v6) and Yarn 4 (v8). `packages/ui` declares `lib` as `devDependencies: ^2.0.0` (bumped) and `peerDependencies: ^1.0.0 || ^2.0.0` (widened), and `old-tool` keeps `[email protected]` in the lockfile. The test runs the real `upgradeInstall` with the manager mocked to write the after-lockfile. It asserts that the install succeeds, `lib` resolves to the target 2.0.0, and the peer range at every install is the widened one, never an install descriptor. | | npm | pnpm | Yarn 3 | Yarn 4 | |---|---|---|---|---| | `main` (with #84) | ✗ peer installed as `2.0.0` | ✗ peer installed as `2.0.0` | ✗ resolved 1.0.0 | ✗ resolved 1.0.0 | | this PR | ✓ | ✓ | ✓ | ✓ | The Yarn 3 fixtures from #84 and these, run together on the rebased branch: `subtree-swap`, `pinning-overrides`, `peer-widened` and `upgrade` all pass (44 tests). With `main`'s `upgrade.ts`, only the four `peer-widened` cases fail. On medusa, the same check passes with the dev range (`parseYarn` on medusa's lockfile: `^19.3.0` → 19.3.0, `^18.3.1 || ^19.0.0` → 17.0.2). This was the next stop after #84 on a local copy of medusa with its `@types/react` resolutions pin relaxed. `pnpm lint` (only the existing `biome.json` schema note), `pnpm build`, `pnpm typecheck`, `pnpm test`: core 1195 passed / 28 skipped, CLI 393 passed. ## Checklist - [x] Tests for the change (a bug fix starts with a failing test): all four fixture cases fail on `main` - [x] `pnpm lint && pnpm typecheck && pnpm test` pass - [x] README and docs updated if behavior changed (no documented behavior changes; the docs already say peers are widened in the manifest) - [x] Changeset added if a user would notice (`.changeset/peer-ranges-not-install-descriptors.md`, patch, names the 0.7.4 regression) - [x] No new dependency, or it was agreed in an issue - [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 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EmiChUUtLdjbg6mNzKqVep Signed-off-by: Claude <[email protected]> Co-authored-by: Claude <[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.
What and why
fix react --target 19.3.0rejected workspace ranges such as^18.3.1 || ^19.0.0before resolving the target and suggested replacing them with a narrower installed-version range.Validate each declaration against its actual planned target using semver's default prerelease exclusion. Compatible dependency, development, optional and peer ranges stay unchanged and appear in report notes as already compatible. Rejecting peer ranges retain every alternative and gain the target major; unsupported rewrites ask the user to add that major without dropping alternatives. The same path handles companions and pnpm catalogs. npm, pnpm and Yarn Berry still install the exact requested versions when compatible manifests need no edits. Yarn Berry now preserves those versions through its native
yarn set resolutioncommand only for unchanged, compatible npm ranges or aliases after temporary overrides are removed; otherwise restoring a broad range could select a newer release. Yarn 3 uses the supported--mode=skip-buildflag.fixandverifycheck the actual installed target and every planned companion in each declaring workspace, including local copies that shadow hoisted packages. Missing or different versions fail the run before migration/verification and are checked again after verification scripts finish.The workspace-subdirectory hint now preserves the target and prints
uptide fix react --target 19.3.0 --cwd <root>withoutnpxor--only.How it was verified
18.2.0, caret^18.2.0, peer union^18.3.1 || ^19.0.0, open peer>=16.8, and rejecting complex peer^17 || ^18 <18.3, for React and its three companions. Exact/caret dependencies move, compatible files remain byte-for-byte unchanged, and the complex peer becomes^17 || ^18 <18.3 || ^19.0.0.TMPDIR=/private/tmp COREPACK_DEFAULT_TO_LATEST=0 pnpm test --env-mode=loose -- --maxWorkers=2.^19.0.0and>=16.8byte-for-byte while moving React and@types/reactfrom 19.1.0 to exact 19.2.0 in the lockfile andnode_modules, surviving a frozen/immutable reinstall. Two additional Yarn cases upgrade exact pins, including the failing regression reproduced against 3161528. Yarn lock records match nativeyarn up --exact(apart from the intentionally preserved range descriptors), with no leftover manifest override or temporary descriptor. Three real-install checks verify build flags on Yarn 2.4.3, 3.2.1 and 4.9.2:--skip-buildsfor 2,--mode=skip-buildfor 3/4. Smoke itself uses Yarn 4.9.2. Command:UPTIDE_NETWORK=1 pnpm --filter @uptide/core exec vitest run src/fix/managers/compatible-ranges.test.ts. These cases run in Node 22 CI.pnpm lint,pnpm typecheck, build, docs links andgit diff --checkpass. Lint reports only the existing Biome schema-version notice. Public-tree scan is clean; the CI-only private-identifier denylist is unavailable locally.Smoke regression follow-up
The follow-up at
3161528ranyarn set resolutionon every moved dependency, including a newly rewritten exact pin. In the Yarn Berry smoke fixture this issuedyarn set resolution zod@npm:4.6.5 npm:4.6.5, creating a self-reference that makes Yarn 4.9.2 terminate during resolution. The harness then masked the CLI error by trying to read the missing migration branch. The fix compares each declaration with its pre-upgrade value, permits only unchanged compatible npm ranges/aliases, skips exact self-resolutions, and prints smoke assertion errors immediately. The Yarn 3 flag was valid and is retained.Underlying error, captured with the same packed
3161528CLI in the isolated Berry diagnostic run:The unmodified smoke harness surfaced
fatal: invalid object name 'uptide/zod-4.6.5'afterward. Local Docker comparisons:5a5026dpnpm smoke 223161528pnpm smoke 225f43abepnpm smoke 205f43abepnpm smoke 22The committed Yarn Berry lockfile diffs for both Zod and Stripe on both fixed smoke runs are byte-for-byte identical to the passing
5a5026dbaseline.Public Medusa reproduction: preflight and summary (initial range fix)
Fresh clone of medusajs/medusa, pinned to 146c46b0ad1146b40595c8ef586c4d5890982603.
corepack enable && yarn install --immutablesucceeded with Yarn 3.2.1 (warnings only). Ran the built CLI from the repository root, without--pr, with assisted fixes disabled:node "$UPTIDE_CLI" fix react --target 19.3.0 --no-llmPreflight passed the workspace range validation that previously aborted. Public-repository output:
The run continued beyond preflight but did not complete migration: it exited 2 during analysis with:
No completed migration summary was produced. The temporary clone was retained for diagnosis; the Medusa source checkout remained clean at the pinned commit, with no migration branch created. This verifies removal of the range-preflight blocker, not an end-to-end successful React migration.
Running the built CLI from
packages/design-system/iconsalso produced the corrected hint (temporary path abbreviated):The full optional network suite was not run; the targeted real-manager suite and Docker smoke checks above were run. Medusa was not rerun for the installed-version follow-ups; its earlier analysis limitation is documented above. No private-repository output or package lists are included.
Checklist
git commit -s