fix(scripts): preserve emoji in dev tooling previews (#109469)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
Leon-SK668
2026-07-16 18:56:18 -07:00
committed by GitHub
co-authored by Peter Steinberger
parent 3b1667e286
commit 2e3b4ab586
2 changed files with 6 additions and 1 deletions
+2 -1
View File
@@ -1,5 +1,6 @@
// Dev Tooling Safety script supports OpenClaw repository automation.
import path from "node:path";
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
import { redactSensitiveText } from "../../src/logging/redact.js";
const REDACT_OPTIONS = { mode: "tools" } as const;
@@ -13,7 +14,7 @@ export function previewForDevToolLog(value: string, maxChars = 400): string {
if (redacted.length <= maxChars) {
return redacted;
}
return `${redacted.slice(0, Math.max(0, maxChars - 3))}...`;
return `${truncateUtf16Safe(redacted, Math.max(0, maxChars - 3))}...`;
}
export function maskIdentifier(value: string | undefined, keepStart = 6, keepEnd = 4): string {
+4
View File
@@ -219,6 +219,10 @@ describe("dev tooling safety helpers", () => {
);
expect(maskIdentifier("session-key-abcdef123456")).toBe("sessio...3456");
});
it("does not split boundary emoji in script log previews", () => {
expect(previewForDevToolLog("123456😀tail", 10)).toBe("123456...");
});
});
describe("script-specific dev tooling hardening", () => {