Files
stack/agents/researcher/work/queue-102/same-code-points.mjs
T
jason.woltjeandClaude Sonnet 5.5 486c4aad34 research: row 102 build packet, row 88 follow-up N1-N4 (#1596)
Header sentence, line 13 wrap, bidi escapes in three files, inertCheck U+200E/U+200F. Patch and evidence only; the change is not applied to the tree.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-13 16:12:24 -05:00

24 lines
1.4 KiB
JavaScript

// Row 102 (#1596) N3: the escaped lines mean what the literal lines meant. Run from the repo
// root of a tree whose HEAD still has the literals: node same-code-points.mjs
import { execFileSync } from 'node:child_process';
import { readFileSync } from 'node:fs';
const head = (f) => execFileSync('git', ['show', `HEAD:${f}`], { encoding: 'utf8' });
const line = (text, n) => text.split('\n')[n - 1];
const BUS = 'packages/webui/src/public/bus.js';
const unseen = (l) => new Function(`return ${/UNSEEN = (\/.*?\/g)/.exec(l)[1]}`)();
const oldRe = unseen(line(head(BUS), 13));
const newRe = unseen(line(readFileSync(BUS, 'utf8'), 13));
let matched = 0, differ = 0;
for (let u = 0; u <= 0xffff; u++) {
const c = String.fromCharCode(u);
const a = (oldRe.lastIndex = 0, oldRe.test(c)), b = (newRe.lastIndex = 0, newRe.test(c));
if (a) matched++;
if (a !== b) differ++;
}
console.log(`${BUS}:13 UNSEEN: old matches ${matched} of 65536 code units, new differs on ${differ}`);
for (const [f, n] of [['packages/webui/tests/bus.test.mjs', 20], ['packages/conversation/tests/flows.test.mjs', 495]]) {
const lit = (l) => new Function(`return ${/(['"])(?:(?!\1).|\\.)*\1/.exec(l.replace(/^.*?=\s*/, '').replace(/^.*?text:\s*/, ''))[0]}`)();
const a = lit(line(head(f), n)), b = lit(line(readFileSync(f, 'utf8'), n));
console.log(`${f}:${n}: string ${a === b ? 'identical' : 'DIFFERENT'} (${a.length} code units)`);
}