Skip to content

Commit 28b468e

Browse files
cliffhallclaude
andcommitted
test(release): pin the ./ tarball path npm publish needs
npm publish reads a bare dir/file argument as GitHub owner/repo shorthand and tries to clone it over SSH; the MCP Inspector's first release through the same split publish job failed that way (modelcontextprotocol/inspector#2551). release.yml already passes ./release-artifact/*.tgz; this asserts it, so the ./ cannot be lost in an edit. Reproduced locally with Node 24.21.0's npm: the bare path exits 128 on 'git ls-remote ssh://[email protected]/release-artifact/...', the ./ path dry-run-publishes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: cliffhall <[email protected]>
1 parent 4d13264 commit 28b468e

1 file changed

Lines changed: 30 additions & 2 deletions

File tree

‎scripts/release-npm-floor.test.mjs‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@
1111
// As in release-dist-tag.test.mjs, these tests read the step out of the
1212
// workflow file and run THAT, with `npm` on PATH replaced by a stub that
1313
// reports a chosen version. They also pin the job's shape: an exact Node
14-
// pin, the check ahead of the download and the publish, and no step that
15-
// installs a package.
14+
// pin, the check ahead of the download and the publish, no step that
15+
// installs a package, and the `./` that makes `npm publish` read the tarball
16+
// as a local file. Without it npm reads `release-artifact/x.tgz` as GitHub
17+
// `owner/repo` shorthand and tries to clone it over SSH: the MCP Inspector's
18+
// first release through the same split publish job failed exactly that way
19+
// (modelcontextprotocol/inspector#2551).
1620
//
1721
// The step's shell is bash, so those tests are skipped where there is none.
1822
// Run via `npm run test:scripts`.
@@ -160,3 +164,27 @@ test("publish-npm installs no package next to the OIDC credential", () => {
160164
);
161165
}
162166
});
167+
168+
test("publish-npm hands npm the tarball as a ./ path, not a bare dir/file", () => {
169+
const step = publishSteps().find((s) => s.name === "Publish package");
170+
assert.ok(step, "publish-npm has no `Publish package` step");
171+
const commands = step.run
172+
.split("\n")
173+
.filter((line) => !line.trim().startsWith("#"))
174+
.join("\n");
175+
assert.match(
176+
commands,
177+
/^\s*set -- \.\/release-artifact\/\*\.tgz\s*$/m,
178+
"the publish step must resolve the tarball as ./release-artifact/*.tgz",
179+
);
180+
assert.doesNotMatch(
181+
commands,
182+
/set -- release-artifact\//,
183+
"a bare release-artifact/ path makes npm read the tarball as a GitHub repo",
184+
);
185+
assert.match(
186+
commands,
187+
/npm publish "\$1"/,
188+
"npm publish must be given the ./ path resolved above",
189+
);
190+
});

0 commit comments

Comments
 (0)