refactor: consolidate coercion contracts (#122458)

* refactor: consolidate coercion contracts

Centralize exact string, record, numeric, date, Boolean, argument, and structured-error coercions while preserving call-site semantics.

Migrate canonical-name collisions and deprecated internal SDK bypasses, deleting 55 net production/tooling lines. Expand declaration ownership enforcement to 101 allowed helpers and add a narrow export-completeness audit.

* fix: preserve standalone script coercions

Keep copied Control UI tooling self-contained and retain the trusted release harness module-relative source seam when the harness runs against an old target cwd.
This commit is contained in:
Peter Steinberger
2026-08-11 23:26:37 -07:00
committed by GitHub
parent 66fe424590
commit b080dd1e76
276 changed files with 1685 additions and 1663 deletions
@@ -65,7 +65,7 @@ describe("scripts/check-deprecated-api-usage", () => {
}
});
it("bans internal imports of every deprecated reply facade", () => {
it("bans internal imports of every deprecated facade", () => {
const modulePaths = new Set(
BANNED_INTERNAL_PLUGIN_SDK_FACADE_MODULES.map((ban) => ban.modulePath),
);
@@ -74,6 +74,7 @@ describe("scripts/check-deprecated-api-usage", () => {
"src/plugin-sdk/channel-message",
"src/plugin-sdk/channel-reply-pipeline",
"src/plugin-sdk/inbound-reply-dispatch",
"src/plugin-sdk/text-runtime",
]) {
expect(modulePaths.has(facade), facade).toBe(true);
}
@@ -95,6 +96,7 @@ describe("scripts/check-deprecated-api-usage", () => {
'import { createChannelReplyPipeline } from "openclaw/plugin-sdk/channel-reply-pipeline";',
'export { runChannelInboundEvent } from "../plugin-sdk/inbound-reply-dispatch.js";',
'const facade = await import ("../plugin-sdk/channel-message.js", { with: {} });',
'const text = require("@openclaw/plugin-sdk/text-runtime");',
].join("\n"),
});
@@ -106,6 +108,7 @@ describe("scripts/check-deprecated-api-usage", () => {
"src/channels/probe.ts:2: ../plugin-sdk/inbound-reply-dispatch.js",
);
expect(result.stderr).toContain("src/channels/probe.ts:3: ../plugin-sdk/channel-message.js");
expect(result.stderr).toContain("src/channels/probe.ts:4: @openclaw/plugin-sdk/text-runtime");
});
it("allows canonical compat re-exports and test files", () => {