From b22d5245b10bc11a9abe23117a3173c485499241 Mon Sep 17 00:00:00 2001 From: GamerDubz Date: Mon, 12 Oct 2026 10:48:37 +0200 Subject: [PATCH] fix(release): require the full package specifier in plugin launch validation The checkpoint stripped an optional rea-agents@ prefix before comparing, so a manifest launching a bare release number passed even though npx would fetch a package named after that number. Compare the whole specifier and report the launched value. Co-Authored-By: Claude Opus 5.5 --- scripts/lib/release-checkpoint.mjs | 25 +++++++++------- .../filesystem/releaseCheckpoint.test.ts | 29 ++++++++++++------- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/scripts/lib/release-checkpoint.mjs b/scripts/lib/release-checkpoint.mjs index bd6f2b6ba..47c140cc4 100644 --- a/scripts/lib/release-checkpoint.mjs +++ b/scripts/lib/release-checkpoint.mjs @@ -8,7 +8,7 @@ const PLUGIN_MANIFEST_PATHS = [ ".claude-plugin/plugin.json", ".codex-plugin/plugin.json", ]; -const PLUGIN_PACKAGE_SPECIFIER_PREFIX = "rea-agents@"; +const PLUGIN_PACKAGE_NAME = "rea-agents"; const pluginManifestSchema = versionSchema.extend({ mcpServers: z.object({ rea: z.object({ args: z.array(z.string()) }), @@ -201,18 +201,11 @@ async function validateCandidate(git, sha, version, commits) { ); // A stale manifest keeps the previous plugin cache key or launches the // previous server, so both are version authority like server.json. + const launches = []; for (const path of PLUGIN_MANIFEST_PATHS) { const manifest = await readJson(git, sha, path, pluginManifestSchema); - const specifier = manifest.mcpServers.rea.args[1]; - versions.push( - [path, manifest.version], - [ - `${path} rea-agents server launch`, - specifier?.startsWith(PLUGIN_PACKAGE_SPECIFIER_PREFIX) - ? specifier.slice(PLUGIN_PACKAGE_SPECIFIER_PREFIX.length) - : specifier, - ], - ); + versions.push([path, manifest.version]); + launches.push([path, manifest.mcpServers.rea.args[1]]); } // Catalogs are generated and checked from this candidate by the release job; // they are not version authority stored in the immutable source tree. @@ -235,6 +228,16 @@ async function validateCandidate(git, sha, version, commits) { ); } } + // Compare the whole specifier: a bare version would make npx fetch a + // package named after the release number. + const requiredLaunch = `${PLUGIN_PACKAGE_NAME}@${version}`; + for (const [location, launched] of launches) { + if (launched !== requiredLaunch) { + throw new Error( + `${location}@${sha} launches ${launched ?? "no package"}; release branch requires ${requiredLaunch}.`, + ); + } + } const notes = releaseNotes( await git(["show", `${sha}:CHANGELOG.md`]), version, diff --git a/tests/boundary/filesystem/releaseCheckpoint.test.ts b/tests/boundary/filesystem/releaseCheckpoint.test.ts index ef17a4a3d..49403c6ee 100644 --- a/tests/boundary/filesystem/releaseCheckpoint.test.ts +++ b/tests/boundary/filesystem/releaseCheckpoint.test.ts @@ -24,11 +24,9 @@ const pluginManifestPaths = [ ".codex-plugin/plugin.json", ] as const; -const pluginManifest = (version: string, launchVersion = version) => ({ +const pluginManifest = (version: string, launch = `rea-agents@${version}`) => ({ version, - mcpServers: { - rea: { args: ["-y", `rea-agents@${launchVersion}`, "mcp"] }, - }, + mcpServers: { rea: { args: ["-y", launch, "mcp"] } }, }); async function metadata( @@ -584,14 +582,27 @@ it.each([ it.each( pluginManifestPaths.flatMap((path) => [ - { path, stale: "version", manifest: pluginManifest("5.1.0", "6.0.0") }, + { + path, + stale: "version", + manifest: pluginManifest("5.1.0", "rea-agents@6.0.0"), + failure: "declares 5.1.0; release branch requires 6.0.0", + }, { path, stale: "server launch", - manifest: pluginManifest("6.0.0", "5.1.0"), + manifest: pluginManifest("6.0.0", "rea-agents@5.1.0"), + failure: + "launches rea-agents@5.1.0; release branch requires rea-agents@6.0.0", + }, + { + path, + stale: "server launch without the package name", + manifest: pluginManifest("6.0.0", "6.0.0"), + failure: "launches 6.0.0; release branch requires rea-agents@6.0.0", }, ]), -)("rejects a stale plugin $stale in $path", async ({ path, manifest }) => { +)("rejects a plugin $stale in $path", async ({ path, manifest, failure }) => { const f = await fixture(); await candidate(f, "6.0.0"); await writeFile(join(f.directory, path), JSON.stringify(manifest)); @@ -599,9 +610,7 @@ it.each( await git(f.directory, ["commit", "-m", "chore: stale plugin manifest"]); await expect(verify(f)).rejects.toMatchObject({ code: 1, - stderr: expect.stringContaining( - "declares 5.1.0; release branch requires 6.0.0", - ), + stderr: expect.stringContaining(failure), }); });