Skip to content

Commit 4a8dafb

Browse files
committed
test(fleet-write): spell the replacement character as its escape, never the raw glyph
Claude-Session: https://claude.ai/code/session_01KTZmMfzVzjNvyaLyQ8mHvg Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4b33d80 commit 4a8dafb

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎scripts/pm/fleet-write/dispatch.mjs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ export function readBackTargets(payload) {
521521
return out;
522522
}
523523

524-
const replacementCount = (s) => (String(s ?? '').match(/�/gu) ?? []).length;
524+
const replacementCount = (s) => (String(s ?? '').match(/\uFFFD/gu) ?? []).length;
525525

526526
/**
527527
* One stored body against the bytes sent. Pure: `judge` is post-stamped's pair
@@ -1260,11 +1260,11 @@ export async function selfTest() {
12601260
t("the platform's footer block appended lands (post-stamped's footer-appended)", [J('issue_patch', SENT, `${TRIMMED}${PLATFORM_COMMENT_FOOTER}`).verdict, J('issue_patch', SENT, `${TRIMMED}${PLATFORM_COMMENT_FOOTER}`).cls], ['landed', 'footer-appended']);
12611261
t('a stripped trailing newline lands', J('comment', SENT, TRIMMED).verdict, 'landed');
12621262
const ell = Buffer.byteLength(SENT.slice(0, SENT.indexOf('…')), 'utf8');
1263-
const SPLIT_ELL = SENT.replace('…', '���');
1263+
const SPLIT_ELL = SENT.replace('…', '\uFFFD\uFFFD\uFFFD');
12641264
const e1 = J('issue_patch', SENT, SPLIT_ELL);
12651265
t("⭐ the card's first shape — '…' stored as three U+FFFD — is NOT STORED at the byte where '…' began, three extra replacement characters", [e1.verdict, e1.offset, e1.replacements], ['not-stored', ell, 3]);
12661266
const quan = Buffer.byteLength(SENT.slice(0, SENT.indexOf('全')), 'utf8');
1267-
const e2 = J('issue_patch', SENT, SENT.replace('全', '��'));
1267+
const e2 = J('issue_patch', SENT, SENT.replace('全', '\uFFFD\uFFFD'));
12681268
t("⭐ …and its second — '全' stored as two U+FFFD — at the byte where '全' began", [e2.verdict, e2.offset, e2.replacements], ['not-stored', quan, 2]);
12691269
t('a truncation is NOT STORED at the first byte the stored body lacks', [J('comment_edit', SENT, SENT.slice(0, 10)).verdict, J('comment_edit', SENT, SENT.slice(0, 10)).offset], ['not-stored', 10]);
12701270
t('a stored body that is not a string is unverified — never landed, never not-stored', [J('issue_patch', SENT, null).verdict, J('issue_patch', SENT, undefined).verdict], ['unverified', 'unverified']);
@@ -1366,7 +1366,7 @@ export async function selfTest() {
13661366
const strokeOf = (actions, repo = 'objectstack-ai/objectstack') => packRequest({ repo, session: SESSION, actions, requestId: 'fw-test-1' }).payload;
13671367
const OK_RUN = { runs: () => [RUN('completed', 'success')] };
13681368
const B = 'Body with a multi-byte tail: no… 全部\n';
1369-
const SPLIT = B.replace('全', '��');
1369+
const SPLIT = B.replace('全', '\uFFFD\uFFFD');
13701370
const AT = Buffer.byteLength(B.slice(0, B.indexOf('全')), 'utf8');
13711371
const patch = strokeOf([{ op: 'issue_patch', issue: 11041, body: B }], UI);
13721372
const ISSUE = `GET /repos/${UI}/issues/11041`;

0 commit comments

Comments
 (0)