fix(parser): detect shebang language from the parsed byte snapshot (#746)
A file saved while it is being indexed could be silently under-indexed: parse_bytes hashed and parsed one byte snapshot, but for extension-less shebang scripts detect_language re-read the file from disk. A save (truncate+rewrite) racing that probe made a complete snapshot parse to zero nodes, stored under the snapshot's final file hash, leaving the graph missing the file while it looked up to date. detect_language now accepts the pre-read source bytes and sniffs the shebang from them; parse_bytes passes its snapshot through, so every parse decision and the stored hash derive from the same read. Path-only callers (change filters) keep the on-disk probe. Regression tests simulate the race by patching the on-disk probe and the parse-stage read, covering both the extension-less script wipe and the stored-hash-of-parsed-snapshot invariant on the incremental path. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FmPUotoqsNWWt3b41FMjwv
T
Tirth Kanani committed
076db6322f3256ab443495806dbf056f35389110
Parent: f88f26e