{"draft":null,"from":7,"to":318,"files":[{"path":"server/test/streamed-log-append.test.ts","added":27,"removed":0,"diff":"--- /dev/null\n+++ b/server/test/streamed-log-append.test.ts\n@@ -0,0 +1,27 @@\n+import assert from \"node:assert/strict\";\n+import { test } from \"node:test\";\n+import { LOG_PART_CHARACTERS, logParts, streamedLogParts } from \"../src/engine-project.ts\";\n+\n+test(\"streamed canonical rows exactly match legacy serialization and boundaries\", () => {\n+\tfor (const offset of [-2, -1, 0, 1, 2]) {\n+\t\tconst value = { text: \"x\".repeat(LOG_PART_CHARACTERS - 9 + offset) + '😀\\ud800\\n\"', rest: [null, false, 3] };\n+\t\tassert.deepEqual([...streamedLogParts(value)], logParts(JSON.stringify(value)));\n+\t}\n+\tconst value = { files: Array.from({ length: 100 }, (_, i) => `${i}:` + \"中\".repeat(20000)) };\n+\tassert.deepEqual([...streamedLogParts(value)], logParts(JSON.stringify(value)));\n+});\n+\n+test(\"canonical row streaming never stringifies a whole object or a large string\", (t) => {\n+\tconst stringify = JSON.stringify;\n+\tt.mock.method(JSON, \"stringify\", (value: unknown) => {\n+\t\tassert.ok(typeof value !== \"object\", \"whole-object serialization is forbidden\");\n+\t\tif (typeof value === \"string\") assert.ok(value.length <= 16384);\n+\t\treturn stringify(value);\n+\t});\n+\tlet length = 0;\n+\tfor (const part of streamedLogParts({ text: \"x\".repeat(6_000_000) })) {\n+\t\tassert.ok(part.length <= LOG_PART_CHARACTERS);\n+\t\tlength += part.length;\n+\t}\n+\tassert.equal(length, 6_000_011);\n+});"}],"unmatched":[]}