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 <noreply@anthropic.com>
This commit is contained in:
GamerDubz
2026-10-12 10:48:37 +02:00
co-authored by Claude Opus 5.5
parent 5806c94008
commit b22d5245b1
2 changed files with 33 additions and 21 deletions
+14 -11
View File
@@ -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,
@@ -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),
});
});