Skip to content

Commit 34bcfbd

Browse files
committed
fix: point numeric coercion to number runtime
Make boundary and declaration diagnostics recommend the canonical numeric facade, with failing-before coverage for both guidance paths.
1 parent ffdf335 commit 34bcfbd

4 files changed

Lines changed: 7 additions & 7 deletions

‎scripts/check-coercion-helper-declarations.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ export function runCoercionHelperDeclarationGuard(
523523
);
524524
writeLine(
525525
io.stderr,
526-
"Plugin production code: use openclaw/plugin-sdk/string-coerce-runtime or error-runtime.",
526+
"Plugin production code: use openclaw/plugin-sdk/string-coerce-runtime, number-runtime, or error-runtime.",
527527
);
528528
writeLine(
529529
io.stderr,

‎scripts/check-extension-plugin-sdk-boundary.mts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,13 @@ function recommendedCoercionFacade(resolvedPath: string): string | undefined {
105105
ownerPath.endsWith("/string-normalization") ||
106106
ownerPath.endsWith("/record-coerce") ||
107107
ownerPath.endsWith("/boolean-coercion") ||
108-
ownerPath === "src/utils/boolean" ||
109-
ownerPath.endsWith("/number-coercion")
108+
ownerPath === "src/utils/boolean"
110109
) {
111110
return "openclaw/plugin-sdk/string-coerce-runtime";
112111
}
112+
if (ownerPath.endsWith("/number-coercion")) {
113+
return "openclaw/plugin-sdk/number-runtime";
114+
}
113115
if (ownerPath.endsWith("/error-coercion") || ownerPath === "src/infra/errors") {
114116
return "openclaw/plugin-sdk/error-runtime";
115117
}

‎test/extension-import-boundaries.test.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ describe("production plugin normalization ownership boundary", () => {
124124
kind: "dynamic-import",
125125
specifier: "@openclaw/normalization-core/number-coercion",
126126
resolvedPath: "packages/normalization-core/src/number-coercion.ts",
127-
facade: "openclaw/plugin-sdk/string-coerce-runtime",
127+
facade: "openclaw/plugin-sdk/number-runtime",
128128
},
129129
{
130130
name: "error import",
@@ -188,9 +188,6 @@ describe("production plugin normalization ownership boundary", () => {
188188
resolvedPath,
189189
});
190190
expect(entries[0]?.reason).toContain(facade ?? "matching public openclaw/plugin-sdk facade");
191-
if (resolvedPath.includes("number-coercion")) {
192-
expect(entries[0]?.reason).not.toContain("number-runtime");
193-
}
194191
},
195192
);
196193

‎test/scripts/check-coercion-helper-declarations.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ describe("coercion helper declaration AST guard", () => {
287287
expect(output).toContain("expected 1 function declaration(s), found 0");
288288
expect(output).toContain("Core/package/UI/workspace-script code");
289289
expect(output).toContain("Plugin production code");
290+
expect(output).toContain("number-runtime");
290291
expect(output).toContain("Dependency-free, copied, generated, or serialized code");
291292
});
292293

0 commit comments

Comments
 (0)