{"version":81,"agent":"engine","message":"unseenIn compares a carriage return's next character in the same list it walks, so a CR not followed by a newline is found after emoji too. Tests with emoji before CR and CRLF.","time":1791613728793,"timeIso":"2026-10-10T06:28:48.793Z","changes":2,"change":985,"files":["worker/project/test/unseen.test.ts","worker/project/unseen.ts"],"draft":null,"diff":[{"path":"worker/project/test/unseen.test.ts","added":2,"removed":0,"diff":"--- a/worker/project/test/unseen.test.ts\n+++ b/worker/project/test/unseen.test.ts\n@@ -21,6 +21,8 @@\n \tassert.equal(unseenIn(`a${CR}b`), \"a control character at character 2\");\n \tassert.match(unseenIn(`abc${RLO}def`)!, /bidirectional embedding or override/);\n \tassert.equal(unseenIn(`emoji 🎉 counts as one character ${ESC}`), \"a control character at character 33\");\n+\tassert.equal(unseenIn(`😀😀😀\\nB${CR}X`), \"a control character at character 6\", \"a lone CR after emoji is found\");\n+\tassert.equal(unseenIn(`😀😀😀${CR}\\nB`), null, \"CRLF after emoji passes\");\n });\n \n test(\"publish, amend, land, starting notes and announcements refuse unseen characters before the engine sees them\", () => {"},{"path":"worker/project/unseen.ts","added":3,"removed":2,"diff":"--- a/worker/project/unseen.ts\n+++ b/worker/project/unseen.ts\n@@ -25,9 +25,10 @@\n  * \\n and \\t pass, and so does \\r before \\n, since a message file written on Windows ends its lines that way.\n  */\n export function unseenIn(text: string): string | null {\n-\tfor (const [i, ch] of [...text].entries()) {\n+\tconst chars = [...text];\n+\tfor (const [i, ch] of chars.entries()) {\n \t\tconst c = ch.codePointAt(0)!;\n-\t\tif (c === 0x0d && text[i + 1] === \"\\n\") continue;\n+\t\tif (c === 0x0d && chars[i + 1] === \"\\n\") continue;\n \t\tconst hit = UNSEEN.find(([lo, hi]) => c >= lo && c <= hi);\n \t\tif (hit) return `${hit[2]} at character ${i + 1}`;\n \t}"}],"ci":null}