Stop the post-release check installing this package into itself - #148
Conversation
RELEASING.md told the releaser to `mkdir verify && cd verify` and then `npm install google-tools-mcp@X.Y.Z`. A directory with no package.json does not make `npm install` fail. npm walks up the tree, finds this project's manifest, and installs there instead, adding `"google-tools-mcp": "^X.Y.Z"` to this package's own dependencies and lockfile and unpacking the tarball into the repo's node_modules. It prints an ordinary `added 1 package` and never says which directory it chose, so the only signal is `git status` afterwards. This is not hypothetical: it happened while verifying 3.4.5, during the step that runs after the release already looks finished, which is exactly when nobody is looking at the working tree. Caught by `git status` and reverted before it reached a commit; the published 3.4.5 tarball was checked and has no self-dependency. The steps now put the scratch directory outside the repository, run `npm init -y` before installing anything, and end by checking `git status` is clean. The failure mode and its recovery are written next to the commands rather than left for the next person to rediscover. Verified by running the corrected procedure end to end against the published 3.4.5: it installs into the scratch manifest, boots to the ready line, exits 0, and leaves package.json and package-lock.json untouched. Also swaps `(sleep 30)` for a `node` timer so the block works from PowerShell, which is what the rest of the file uses. Introduced in 066749b. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6c05f56348
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| mkdir -p ../gtm-verify && cd ../gtm-verify | ||
| npm init -y > /dev/null # load-bearing: see the warning below |
There was a problem hiding this comment.
Make the verification commands valid PowerShell
On Windows PowerShell—the shell used by the release steps above—this block cannot be run as claimed: Windows PowerShell 5.1 does not support &&, /dev/null is not its null sink, and the document otherwise deliberately invokes npm.cmd to avoid PowerShell's script-resolution problems. A maintainer following the established PowerShell workflow therefore fails before installing or verifying the tarball. Either provide PowerShell-native commands (using $null and npm.cmd) or state that this block requires Bash rather than claiming cross-shell compatibility.
Useful? React with 👍 / 👎.
The bug
RELEASING.mdtold the releaser to verify a fresh publish like this:verify/has nopackage.json, andnpm install <pkg>does not fail in a directory without one. npm walks up the tree, finds this project's manifest, and installs there instead. What you get:"google-tools-mcp": "^X.Y.Z"added to this package's owndependencies— a dependency on itselfpackage-lock.jsonnode_modules, not the scratch directoryadded 1 packageon stdout, with no mention of which directory npm pickedThe only signal that anything happened is
git statusafterwards.Why it matters more than it looks
This is the step that runs after the release is already out and green. Nobody is watching the working tree at that point, and the natural next action is to move on. A self-dependency committed on a later PR would be shipped in the next tarball.
It is not hypothetical. It happened during the 3.4.5 verification an hour ago. It was caught by
git status, reverted withgit checkout -- package.json package-lock.jsonbefore it reached a commit, and the published 3.4.5 tarball was checked against the registry and has no self-dependency:Introduced in 066749b. It has been the documented procedure since.
The fix
Three changes, each carrying its own weight:
npm init -ybefore installing. This is the actual guarantee. A manifest in the current directory stops the upward walk dead.git statusas the last step, so if it ever does go wrong the releaser sees it while they still remember what they ran.The failure mode and its recovery are now written directly next to the commands in a callout, rather than left for the next person to rediscover the way I did.
Also swaps
(sleep 30)for anodetimer. Same behavior, but the block now works from PowerShell, which is what every other command block inRELEASING.mduses.Verification
Ran the corrected procedure end to end against the published 3.4.5:
Plus the standard gates:
Release
Docs-only, so this does not need a tag.
package.jsonmoves to 3.4.6 per the one-bump-per-PR convention; it can ride along with whatever gets tagged next.🤖 Generated with Claude Code