Files
openclaw/test/scripts/plugin-boundary-report.test.ts
Peter Steinberger b2f6ecc2a9 chore(compat): date the annotated deprecation families and expose removal-pending debt (#114002)
* chore(compat): date the annotated deprecation families and expose removal-pending debt

Adds 10 dated compat-registry records for shipped deprecated surfaces that
previously had @deprecated annotations only (removeAfter 2026-10-01 per the
approved 60-day window), extends the beta5 session-store record with the
package-root aliases, surfaces removal-pending records with due dates,
blockers, and readers in the plugin boundary report, and converts undated
cleanup obligations (CI timing job, zizmor excessive-permissions, staged
Codex CI auth, memory-host legacy state dir, agent-DB schema-ladder floors)
into dated markers visible to the weekly dated-TODO sweep. Metadata,
diagnostics, and docs only - no runtime behavior change.

* fix(compat): keep extension src test paths out of core string literals

The core import guardrail forbids extensions/*/src/ path shapes in core
production string literals; cite the package-root google-meet test and the
registry test for official-plugin-export-aliases instead.
2026-07-25 21:01:20 -07:00

93 lines
3.3 KiB
TypeScript

// Plugin Boundary Report tests cover plugin boundary report script behavior.
import { beforeAll, describe, expect, it } from "vitest";
import {
createPluginBoundaryReport,
type PluginBoundaryReportResult,
} from "../../scripts/plugin-boundary-report.js";
function requirePluginSdkSummary(summary: {
pluginSdk?: {
crossOwnerReservedImportCount?: unknown;
unusedReservedCount?: unknown;
};
}) {
if (!summary.pluginSdk) {
throw new Error("Expected plugin SDK summary");
}
return summary.pluginSdk;
}
describe("plugin-boundary-report", () => {
let summaryResult: PluginBoundaryReportResult;
beforeAll(() => {
summaryResult = createPluginBoundaryReport([
"--summary",
"--json",
"--fail-on-cross-owner",
"--fail-on-unclassified-unused-reserved",
]);
});
it("emits compact CI-safe summary JSON", () => {
const summary = JSON.parse(summaryResult.stdout) as {
compat?: {
removalPendingCount?: unknown;
removalPendingDueCount?: unknown;
removalPending?: Array<{
code?: unknown;
removeAfter?: unknown;
blocker?: unknown;
readerCount?: unknown;
readerSample?: unknown;
dueForReview?: unknown;
}>;
};
pluginSdk?: {
crossOwnerReservedImportCount?: unknown;
unusedReservedCount?: unknown;
};
memoryHostSdk?: {
implementation?: unknown;
};
};
expect(summaryResult.exitCode).toBe(0);
expect(summaryResult.stderr).toBe("");
expect(summary.compat?.removalPendingCount).toBe(5);
expect(summary.compat?.removalPendingDueCount).toEqual(expect.any(Number));
expect(summary.compat?.removalPending?.map((record) => record.code)).toEqual([
"agent-harness-sdk-alias",
"plugin-sdk-media-understanding-public-demotion",
"plugin-sdk-memory-host-core-public-demotion",
"plugin-sdk-plugin-config-runtime-public-demotion",
"plugin-sdk-tool-plugin-public-demotion",
]);
for (const record of summary.compat?.removalPending ?? []) {
expect(record.removeAfter).toMatch(/^\d{4}-\d{2}-\d{2}$/u);
expect(record.blocker).toEqual(expect.stringMatching(/retain|replacement/iu));
expect(record.readerCount).toEqual(expect.any(Number));
expect(record.readerSample).toEqual(expect.arrayContaining([expect.any(String)]));
expect((record.readerSample as unknown[]).length).toBeLessThanOrEqual(5);
expect(record.dueForReview).toEqual(expect.any(Boolean));
}
const pluginSdk = requirePluginSdkSummary(summary);
expect(pluginSdk.crossOwnerReservedImportCount).toBe(0);
expect(pluginSdk.unusedReservedCount).toBe(0);
expect(["private-core-bridge", "private-package-core-integrated"]).toContain(
summary.memoryHostSdk?.implementation,
);
});
it("renders removal-pending blockers and reader references without changing fail gates", () => {
const result = createPluginBoundaryReport(["--summary"]);
expect(result.exitCode).toBe(0);
expect(result.stderr).toBe("");
expect(result.stdout).toContain("removalPending=5");
expect(result.stdout).toContain("removal-pending 2026-07-25 agent-harness-sdk-alias");
expect(result.stdout).toMatch(/blocker=.*retain the public/iu);
expect(result.stdout).toMatch(/readerRefs=\d+ readers=/u);
});
});