Dashboard › opencode-lore › Responses streaming JSON.parse parity
01a09671-47ef-76cf-bb60-39e3967b8798Responses streaming and native parsing must have identical public behavior across STREAMING_PARSE_SPOOL_BYTES. Trap: rejecting only a raw BOM at byte zero looks sufficient because a BOM normally starts a document, but @streamparser/json accepts a BOM after leading JSON whitespace while JSON.parse rejects it. Fix: use non-fatal UTF-8 decoding with ignoreBOM:true, reject U+FEFF outside JSON strings, then tokenize re-encoded text; retain native parsing below 256 KiB. Test threshold crossings, leading-whitespace BOM, malformed UTF-8, roots, duplicate keys, trailing data, split escapes, and split multibyte characters.