Stop wasm type-check feeds serving stale Salsa results
Merged
RE
4mo ago+113+113+012345678901234567890123456789-6-6-0123456789
type_check.spec.ts > "failing snippet does not execute and session survives" fails intermittently because Salsa treats a file as unchanged when its modified time is unchanged, and wasm's clock only ticks once a millisecond. So with two writes to the same file in a millisecond Salsa does not detect the change.
Observed in CI:
| Date | Branch | Run |
|---|---|---|
| 2026-08-13 | host-memory-probe | 31736318169 |
| 2026-08-14 | fix-chain-source-latch (#748) | 31837343813 |
Changes:
bump_revisionsis to bump Salsa revisions explicitly on write instead of relying on modified timesadjust_annotation_spanis a defensive clamp if invalid to prevent crash
š¤ Generated with Claude Code
Summary by cubic
Prevents wasm type-check feeds from reusing stale Salsa results and crashing by explicitly bumping file and directory revisions and clamping diagnostic spans to the source. Previously, consecutive writes could share an mtime-based revision in wasm, causing stale checks and TextSize wrap that killed the worker; now each write produces a fresh revision and span math is safe.
TypeChecker::{write_root_file,rewrite_root_file}callbump_revisionsafterwrite_file.bump_revisionswalks ancestor directories and sets the nextFileRevisionviasalsa::Setter, avoiding mtime reliance and fixing stub re-resolution afterreset.adjust_annotation_spantakessource_lenand clamps withchecked_sub/minto prevent wrap on injected import offsets.- Adds
crates/monty-js/__test__/wasm_type_check.spec.tsto verify session survivability and consistent diagnostics across repeated failures using@pydantic/monty/wasm.