Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2.0 KiB
FAIL
-
[P1] crates/ely-files/src/save.rs:195; crates/ely-office/src/save.rs:24 — Simplifying the parent before joining a missing filename can change which file the completed path names. On Windows, with
guard.mdopen, exporting to the nonexistent extended path\\?\C:\…\guard.mdreturns success and overwritesguard.md: the parent loses its prefix, Win32 trims the filename's trailing space, andsame_fileincorrectly returns false. The intended literal target never exists. This violates FILE-06. The same branch also fails to save a new 273-UTF-16-unit path whose parent is short enough to simplify, violating FILE-09. Both scenarios reproduced against the rebuilt library; the original canonical-parent algorithm preserves the open file and successfully writes the long target. Preserve extended-path semantics until the complete prospective target is formed, then simplify only when the complete path is safe, in both helpers. Add Windows regression tests for the overwrite and new long target. Evidence:.work/R3.1-probe.log. -
[P2] crates/ely-files/src/save.rs:186 — Simplifying an existing target also breaks atomic saves when its sibling staging filename crosses Windows' path limit. Reproduced with a 250-UTF-16-unit directory and existing
a.md(255 units total):save_atomicreturns OS error 3, although the original algorithm succeeds. The target is short enough for dunce to strip its prefix, but tempfile's.tmpplus six random characters makes the staging path 261 units; tempfile passes that unprefixed path directly toSetFileAttributesWduring persistence. This affects ordinary saves and autosaves of existing documents (FILE-04/FILE-09), independently of the missing-target branch. Ensure the complete staging and destination paths used by Win32 persistence retain extended syntax whenever required, while keeping displayed paths simplified. Add a Windows regression test with an existing short filename in a directory near this limit. Evidence:.work/R3.1-probe.log,existing_short_file_in_long_directory_keeps_saving.