mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
The Windows CI leg failed on the cross-process test with EPERM from renameSync. It is not a test artifact. Windows refuses a rename over a file another process holds open rather than waiting, with ERROR_ACCESS_DENIED or ERROR_SHARING_VIOLATION, and reads of these two files are deliberately lock-free on both sides. So any tray or app read that overlaps a writer's replace fails that write, and since this branch made writers report a failure instead of swallowing it, the outcome is exactly the lost update the lock exists to prevent, reached by another route. The test's reader thread only made it visible by reading the way both apps really do, continuously and without the lock. The replace is now retried on that error class, ten attempts about 20ms apart, on both sides: replace_file in settings.rs, used by settings patch and by the dock's write_state_at, and renameOnto behind writeFileAtomic in tray-settings.ts. The lock is already held at that point, so the wait can only ever be on a reader, never on another writer, and a read of one of these files is microseconds of open file. Once the budget is out the original error is returned unchanged and the caller cleans up as before. On POSIX, where a rename over an open file cannot fail this way, it compiles out in Rust and short-circuits on process.platform in Node. Reads stay lock-free, which is the right trade and the reason the files can be read at all without coordination; both read paths now say what it costs and where that cost is absorbed. The reader thread stays as it is, and is now the regression test for the retry as well: it is what puts a replace under a continuous reader. The retry itself is covered on the Node side by faking the platform and the rename, since a rename that fails this way cannot be produced on a Mac: a reader waited out and the write landing, the budget running out with the old file still whole, and an error a reader cannot cause not being waited out at all. The Rust half is compiled out off Windows, so CI is its only proof. |
||
|---|---|---|
| .. | ||
| capabilities | ||
| icons | ||
| src | ||
| wix | ||
| build.rs | ||
| Cargo.lock | ||
| Cargo.toml | ||
| tauri.conf.json | ||