mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(release): validate the exact MCP registry package at checkpoints (#12550)
Co-authored-by: ShuaixinHuang <ShuaixinHuang@users.noreply.github.com>
This commit is contained in:
1 parent
2bfb5541c9
commit
4bebd9a5e1
2 files changed
+45
-10
No files matched your search
@@ -224,16 +224,16 @@ async function validateCandidate(git, sha, version, commits) {
|
||||
sha,
|
||||
"server.json",
|
||||
versionSchema.extend({
|
||||
packages: z.array(
|
||||
z.object({ identifier: z.string(), version: z.string() }),
|
||||
),
|
||||
packages: z.tuple([
|
||||
z.object({
|
||||
registryType: z.literal("npm"),
|
||||
identifier: z.literal("rea-agents"),
|
||||
version: z.string(),
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
);
|
||||
const npmPackage = server.packages.find(
|
||||
(entry) => entry.identifier === "rea-agents",
|
||||
);
|
||||
if (npmPackage === undefined)
|
||||
throw new Error("server.json is missing the rea-agents package.");
|
||||
const [npmPackage] = server.packages;
|
||||
versions.push(
|
||||
["server.json", server.version],
|
||||
["server.json rea-agents package", npmPackage.version],
|
||||
|
||||
@@ -76,7 +76,7 @@ async function metadata(
|
||||
".release-please-manifest.json": { ".": version },
|
||||
"server.json": {
|
||||
version,
|
||||
packages: [{ identifier: "rea-agents", version }],
|
||||
packages: [{ registryType: "npm", identifier: "rea-agents", version }],
|
||||
},
|
||||
"release-please-config.json": {
|
||||
...(versioning === undefined ? {} : { versioning }),
|
||||
@@ -891,7 +891,13 @@ it.each([
|
||||
: path === "server.json"
|
||||
? {
|
||||
version: "6.0.0",
|
||||
packages: [{ identifier: "rea-agents", version: "5.1.0" }],
|
||||
packages: [
|
||||
{
|
||||
registryType: "npm",
|
||||
identifier: "rea-agents",
|
||||
version: "5.1.0",
|
||||
},
|
||||
],
|
||||
}
|
||||
: { package: { version: "5.1.0" } },
|
||||
),
|
||||
@@ -906,6 +912,35 @@ it.each([
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
{
|
||||
label: "non-npm",
|
||||
packages: [
|
||||
{ registryType: "oci", identifier: "rea-agents", version: "6.0.0" },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: "ambiguous",
|
||||
packages: [
|
||||
{ registryType: "npm", identifier: "rea-agents", version: "6.0.0" },
|
||||
{ registryType: "npm", identifier: "rea-agents", version: "5.1.0" },
|
||||
],
|
||||
},
|
||||
])("refuses invalid MCP package entries: $label", async ({ packages }) => {
|
||||
const f = await fixture();
|
||||
await candidate(f, "6.0.0");
|
||||
await writeFile(
|
||||
join(f.directory, "server.json"),
|
||||
JSON.stringify({ version: "6.0.0", packages }),
|
||||
);
|
||||
await git(f.directory, ["add", "server.json"]);
|
||||
await git(f.directory, ["commit", "-m", "chore: inconsistent MCP package"]);
|
||||
await expect(verify(f)).rejects.toMatchObject({
|
||||
code: 1,
|
||||
stderr: expect.stringContaining("server.json"),
|
||||
});
|
||||
});
|
||||
|
||||
it.each(
|
||||
pluginManifestPaths.map((path) => ({
|
||||
path,
|
||||
|
||||
Reference in new issue
Block a user