You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
serve: external edits to never-opened models skip the error check #478
When a model file changes on disk, the simlin-serve file watcher is meant to reject an external edit that introduces new compile errors and keep the last good version in memory.
For a model nobody has opened yet, the check does nothing: the in-memory copy is loaded from disk on first access, and by then the disk already holds the new content, so the edit is compared against itself and always passes.
The comment in the code claims the opposite.
Example
Start simlin-serve in a directory containing foo.stmx; do not open it in the browser or via MCP.
In another editor, save foo.stmx with a reference to an undefined variable.
The watcher broadcasts the change and the next GET returns the broken model.
If foo.stmx is opened first, step 2 is rejected as intended.
Why it matters
Found in code review, not seen in use.
For an unopened model there is no earlier version anyone has seen, and what is on disk is arguably the right thing to serve, so the practical harm is small.
The misleading comment is the bigger problem.
Fix
Make the behavior explicit: if the model was never loaded into memory, accept the disk content and log that no comparison was possible; fix the comment to match.
Alternative: load every model at startup scan so there is always a baseline; this costs parse time and memory for every file under the root.
Pointers
src/simlin-serve/src/watcher.rs, handle_model_change (the baseline match and its comment)
src/simlin-serve/src/registry.rs, get_or_init_doc (lazy load from disk)
changed the title [-]Watcher validation gate is a no-op for never-opened entries (first-touch baseline bug)[/-][+]serve: external edits to never-opened models skip the error check[/+]on Oct 12, 2026
Activity
[-]Watcher validation gate is a no-op for never-opened entries (first-touch baseline bug)[/-][+]serve: external edits to never-opened models skip the error check[/+]