fix(sem): accept a leading UTF-8 BOM in a compact snapshot

main

Commit

Suhaan Thayyil5d ago

On Windows, entire graph snapshot --format compact-ndjson saved through Windows PowerShell 5.1 (Out-File -Encoding utf8, Set-Content -Encoding utf8, or > wherever the profile makes UTF-8 the default) starts with a UTF-8 byte-order mark, and snapshot-query refused the file on its first byte:

load compact snapshot: compact snapshot line 1: invalid character '' looking for beginning of value

The same bytes saved through cmd.exe load and query fine.

DecodeCompactSnapshot now skips one leading BOM, the rule this package already applies to git config (TestGitMetadataGuardAllowsUTF8BOMAtConfigStart) and agentsetup applies to Claude settings. A second BOM, or one at the start of any later line, is still refused as malformed input.

Not addressed: stock Windows PowerShell 5.1 > writes UTF-16LE, which this does not decode. That is a different encoding, not a save artifact.