Repository navigation
fix: restore lockfile resolution broken by the v11.23.0 release - #7831
Conversation
The release re-resolved vitest for @trpc/tanstack-react-query against vite 8.3.5. That added a second vitest whose expect type lacks the jest-dom matchers, so typecheck failed on toHaveTextContent. Co-authored-by: alexander <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters: 1
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including
|
trpc-bot
left a comment
There was a problem hiding this comment.
typecheck passes on this head, and so do lint and the full test suite locally. The E2E checks still pending here will run in the merge queue.
…ck before pushing (trpc#7834) <!-- CURSOR_AGENT_PR_BODY_BEGIN --> ## Why - The v11.23.0 release commit (c3c5ebb) rewrote 89 lines of `pnpm-lock.yaml`. Only 30 were version bumps. The other 59 came from lerna's `syncWorkspaceLock`, which runs `pnpm install --lockfile-only`. That re-resolved vitest for `packages/tanstack-react-query` against vite 8.3.5 and broke `pnpm typecheck-packages` on main. trpc#7831 fixed the lockfile. - Nothing caught it: release commits are pushed straight to main, and typecheck only runs on PRs and in the merge queue. - A release bumps versions. It has no reason to resolve dependencies or touch the lockfile at all. ## What - **Packages depend on each other with `workspace:*`.** That covers the 15 `@trpc/*` entries in `dependencies` and `devDependencies` under `packages/*`. They used to be exact pins like `11.23.0`, so pnpm wrote `specifier: 11.23.0` into the lockfile and every release had to change those lines. With `workspace:*`, the lockfile entry is `specifier: workspace:*` / `version: link:../server`, which no version bump changes. - Published packages still get exact versions. lerna-lite's publish replaces `workspace:*` with the version it publishes (`resolveLocalDependencyWorkspaceProtocols`), then restores `package.json`. `pnpm publish` does the same. - `peerDependencies` keep their exact pins, which `scripts/version.ts` updates as before. pnpm doesn't record a workspace package's peers in the lockfile. - `scripts/version.ts` now leaves `workspace:` ranges alone. - **No lockfile sync on release.** `syncWorkspaceLock` is gone from `lerna.json`, so `lerna version` no longer runs `pnpm install`. - **Checks before anything is pushed:** `scripts/check-release-commit.ts`, written in Effect. - As the root `preversion` script, before lerna writes any version, it requires a clean tree. lerna commits the index, so an earlier edit to a `package.json` would otherwise ride along in the release commit. With `--force-publish`, which the release job uses, lerna-lite skips its own clean-tree check. Canary publishes don't run `preversion`. - As the root `postversion` script, after lerna commits and tags the release and before it pushes or publishes, it fails if: - the release commit changes `pnpm-lock.yaml`, or any file other than `lerna.json` and `packages/*/package.json`; - any of those files changes more than its `version` and its pinned `@trpc/*` ranges; - the tree has changes outside the release commit, since the checks below wouldn't then describe what gets pushed; - `pnpm install --frozen-lockfile --ignore-scripts` rejects the lockfile for the bumped manifests, or changes any file; - `pnpm typecheck-packages` fails or changes any file. It's the same command as CI's typecheck job, and it takes seconds. lerna builds and packs the working tree next, so the tree must still match the release commit. - When `postversion` fails, it deletes the release commit and tag it checked, so a later run can't push them. Nothing reaches GitHub or npm, and edits in the tree are kept. If the tree had other changes, only the release commit's files are restored. Otherwise it removes the commit with `git reset --keep`. If an edit touches the release commit's files, that reset refuses, and it falls back to `git reset --mixed`, which leaves the files as they are. Fix main, then run the release again. - **`effect` and `@effect/platform-node` (4.1.1) are in the default catalog** and in the root `package.json`, for the check. - **The lockfile changes in this PR are edits by hand:** the 15 specifier lines, and the catalog and root entries for the two Effect packages, which were already in the lockfile at 4.1.1. Nothing was re-resolved, and `pnpm install --frozen-lockfile` accepts the file unchanged. The release job works as before: Actions → Release Packages → `latest` + `patch`/`minor`. Canary publishes don't commit, so the checks don't run for them, and they no longer touch the lockfile either. ## Links None. This PR changes the release tooling only; no docs page or example changes. ## Alternatives considered - **Keep `syncWorkspaceLock` and allow only `@trpc/*` specifier lines in the diff.** It works, but the release still runs a resolving install and depends on pnpm touching nothing else. With `workspace:*` there is nothing to sync, and the check can simply require an unchanged lockfile. - **`workspace:*` in `peerDependencies` too.** It would let the version script go, but peers aren't in the lockfile, so it doesn't help here. It's a bigger change to what users see, so it's out of scope. - **`--offline` on the check's install.** `--frozen-lockfile` already stops pnpm from resolving or writing the lockfile. pnpm 12's supply-chain check fetches registry metadata whenever the lockfile differs from what was last installed, so `--offline` could fail a good release. - **Run full CI on release commits.** That's worth doing as well, but it reports after the push, while this check stops a bad release before it. The stack on top of this PR adds it. ## Testing All runs used a clone whose `origin` is a local bare repo, with `pnpm lerna version patch --force-publish --yes`. - On a clean tree, it made `v11.23.3`, and again `v11.23.4` with the latest check. The commit changes only `lerna.json` and 8 `package.json` files, with no lockfile. Every check passed, including the frozen install and typecheck, and the tree was clean after both. - With an unstaged edit to `packages/client/package.json`, `preversion` stopped the release. Nothing was bumped, committed or tagged, and the edit was still there. - With a `version` script that also edits and stages that manifest's description, `postversion` failed with "The release commit changes more than versions in: packages/client/package.json". The commit and tag were gone, and nothing was pushed. - With a `version` script that also edits `pnpm-lock.yaml`, the check failed with "The release commit changes pnpm-lock.yaml". The remote's `main` and tags didn't move, and the local commit and tag were gone. - With a modified `README.md` and an untracked file present after the commit, the check failed with "The working tree has changes outside the release commit". The commit and tag were gone, the manifests were back at their old versions, and both files were still there. - With a `typecheck-packages` script that appends to `CONTRIBUTING.md`, the check failed with "The working tree changed during pnpm typecheck-packages". The commit and tag were gone, the manifests were back at their old versions, and the `CONTRIBUTING.md` edit was still there. - With a `typecheck-packages` script that edits `packages/server/package.json`, `git reset --keep` refused, and the `--mixed` fallback removed the commit and tag. The edited description and the other bumped manifests were left in the tree. - `pnpm lerna publish --canary --dry-run` with an untracked file present went through without running `preversion`. A real canary publish to a local verdaccio registry published all 7 packages. Each published `package.json` has exact versions for its `@trpc/*` dev and peer dependencies (e.g. `@trpc/next` → `"@trpc/client": "11.23.2-guard.0.988a40445"`), with no `workspace:` left, and lerna restored the working tree. - `pnpm install --frozen-lockfile --ignore-scripts` passes on this branch and leaves `pnpm-lock.yaml` unchanged. <!-- CURSOR_AGENT_PR_BODY_END --> <div><a href="https://cursor.com/agents/bc-cb6005fa-19d7-58ea-86ec-b7b556b5c662?cursor_ref=pr_footer&cursor_cta=open_in_web"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-cb6005fa-19d7-58ea-86ec-b7b556b5c662&cursor_ref=pr_footer&cursor_cta=open_in_cursor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </div> <!-- codesmith:footer --> --- <a href="https://backend.blacksmith.sh/track/enable-autofix?expires=1796238288&installation_model_id=443568&pr_number=7834&ref=codesmith_pr_footer&repository=trpc%2Ftrpc&return_to=https%3A%2F%2Fgithub.com%2Ftrpc%2Ftrpc%2Fpull%2F7834&signature=dec180f4dba658702a3a5374971d68a495d3e1cb57a2952322950f4138584230"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-light.svg"><img alt="Autofix with [code]smith" src="https://pr-comments-assets.blacksmith.sh/codesmith/autofix-with-codesmith-dark-3x.png" width="190" height="28"></picture></a> <sup><a href="https://app.blacksmith.sh/trpc/codesmith/trpc/pr/7834?autoLogin=true&ref=codesmith_pr_footer">Open in [code]smith</a> · Need help on this PR? Tag <code>@codesmith-bot</code> with what you need.</sup> <!-- codesmith:autofix:disabled --> <!-- /codesmith:footer --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Chores** * Release checks now verify the working tree is clean before versioning and validate release changes, frozen-lockfile installation, and package type checks afterward. If post-version checks fail, the release commit and its tags are removed. * Internal package development dependencies now use workspace versions, and versioning preserves workspace-based dependency ranges. * Version configuration no longer synchronizes the workspace lockfile. * Added Effect packages to the root dependency catalog. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor Agent <[email protected]>
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Why
pnpm-lock.yaml.vitestforpackages/tanstack-react-queryfrom vite 8.3.0 to vite 8.3.5. This added a second copy of vitest, whoseexpecttype has no jest-dom matchers.pnpm typecheck-packagesfails on main: 95TS2339: Property 'toHaveTextContent' does not existerrors in the@trpc/tanstack-react-querytests. The release's own CI run skipped typecheck, so main went red without anyone noticing. Every PR in the merge queue now failstypecheck.What
11.22.1→11.23.0workspace specifier bumps.pnpm-lock.yamlonly: 4 lines added, 55 removed. It drops the extra vite 8.3.5 / vitest /@vitest/mockerentries and restores theexpress-rate-limitpeer resolution.Links
None
Alternatives considered
pnpm dedupealso fixes typecheck, but rewrites about 4,800 lockfile lines. That's a much larger change to review right after a release.Testing
pnpm install --frozen-lockfilepasses, so the lockfile matches every package.json.pnpm buildandpnpm typecheck-packagespass. On c3c5ebb without this change,typecheck-packagesfails as described above.Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.