test(plugin-sdk): ratchet surface budget checks

This commit is contained in:
Vincent Koc
2026-06-16 02:33:28 +02:00
parent 9eed9c5758
commit d5c9e7ea99
6 changed files with 186 additions and 5 deletions

View File

@@ -131,6 +131,21 @@ describe("ci workflow guards", () => {
}
});
it("runs plugin SDK API and surface drift checks in workflow sanity", () => {
const workflow = readWorkflowSanityWorkflow();
const steps = workflow.jobs["generated-doc-baselines"].steps;
const stepNames = steps.map((step) => step.name);
expect(stepNames).toContain("Check plugin SDK API baseline drift");
expect(stepNames).toContain("Check plugin SDK surface budget");
expect(stepNames.indexOf("Check plugin SDK API baseline drift")).toBeLessThan(
stepNames.indexOf("Check plugin SDK surface budget"),
);
expect(steps.find((step) => step.name === "Check plugin SDK surface budget").run).toBe(
"pnpm plugin-sdk:surface:check",
);
});
it("bounds platform checkout fetches without GNU timeout", () => {
const workflow = readCiWorkflow();

View File

@@ -39,4 +39,22 @@ describe("plugin SDK surface report", () => {
);
expect(result.stderr).not.toContain("at ");
});
it("accepts exact deprecated export budget overrides by public entrypoint", () => {
const result = runSurfaceReport({
OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS_BY_ENTRYPOINT: JSON.stringify({ core: 2 }),
});
expect(result.status).toBe(0);
expect(result.stderr).toBe("");
});
it("rejects deprecated export growth by public entrypoint", () => {
const result = runSurfaceReport({
OPENCLAW_PLUGIN_SDK_MAX_PUBLIC_DEPRECATED_EXPORTS_BY_ENTRYPOINT: JSON.stringify({ core: 1 }),
});
expect(result.status).toBe(1);
expect(result.stderr).toContain("public deprecated exports in core 2 > 1");
});
});