Skip to content

Commit 5817f8f

Browse files
committed
test(slack): prove inbound preview UTF-16 boundary
1 parent ee74e4d commit 5817f8f

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

extensions/slack/src/monitor/message-handler/prepare.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,14 @@ describe("slack prepareSlackMessage inbound contract", () => {
188188
expect(prepared.ctxPayload.BodyForAgent).toContain(body);
189189
});
190190

191+
it("keeps inbound previews UTF-16 safe at the truncation boundary", async () => {
192+
const prefix = "a".repeat(159);
193+
const prepared = await prepareWithDefaultCtx(createSlackMessage({ text: `${prefix}😀tail` }));
194+
195+
assertPrepared(prepared);
196+
expect(prepared.preview).toBe(prefix);
197+
});
198+
191199
it("logs inbound metadata without logging message content", async () => {
192200
const body = "confidential acquisition target: northstar; do not include this text in logs";
193201
shouldLogVerboseMock.mockReturnValue(true);

extensions/slack/src/monitor/message-handler/prepare.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Slack plugin module implements prepare behavior.
12
import {
23
resolveAckReaction,
34
shouldAckReaction as shouldAckReactionGate,
@@ -34,7 +35,6 @@ import {
3435
normalizeOptionalString,
3536
} from "openclaw/plugin-sdk/string-coerce-runtime";
3637
import { enqueueSystemEvent } from "openclaw/plugin-sdk/system-event-runtime";
37-
// Slack plugin module implements prepare behavior.
3838
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
3939
import { resolveSlackReplyToMode } from "../../account-reply-mode.js";
4040
import type { ResolvedSlackAccount } from "../../accounts.js";

0 commit comments

Comments
 (0)