NEC-371: A drawing opened before its first sync write falls back to Markdown (empty file, FLAKE-15 after NEC-297) #335

Merged
nectenda-agent merged 2 commits from worktree-nec-371-a-drawing-opened-before-its-first-sync-w into main 2026-10-31 12:25:33 +00:00
Collaborator

Task: NEC-371 — https://projectron.nerchure.com/tasks/393

A drawing, canvas or base that a folder listing names, and this vault does not have yet, used to be created as an empty placeholder and filled once its document arrived. Opened in between (by a link, a quick-switcher pick, or the e2e suite), Excalidraw 2.27 parsed the empty file and showed the drawing as Markdown until reopened (FLAKE-15, CI run 1635). NEC-297's hold could not help: no write was under way. Such a file is now made by its first write, with its content, and never empty (SAFE-A52). A placeholder is kept only where a delete made here while sync was stopped is being finished. Review found two faults in the first version, both fixed and tested: a file made late missed the pinned listing, so a delete made while stopped came back everywhere; and a delete arriving mid-connect could be followed by a create that re-listed the file. Verified with the unit suites (mutation-checked), the local gate with container e2e, a 60-minute Excalidraw hardness run (seed 779315737; its one round-98 failure, a shape bouncing in B's live view where this change's code never ran, did not recur in 60-minute replays on main or on the branch) and a 60-minute canvas hardness run; the user tested the build in their own vaults.

Spec: docs/changes/NEC-371-drawing-opened-before-first-write/spec.md

Changelog

A drawing, canvas or base arriving from another vault no longer opens as Markdown when opened the moment it appears.

Task: NEC-371 — https://projectron.nerchure.com/tasks/393 A drawing, canvas or base that a folder listing names, and this vault does not have yet, used to be created as an empty placeholder and filled once its document arrived. Opened in between (by a link, a quick-switcher pick, or the e2e suite), Excalidraw 2.27 parsed the empty file and showed the drawing as Markdown until reopened (FLAKE-15, CI run 1635). NEC-297's hold could not help: no write was under way. Such a file is now made by its first write, with its content, and never empty (SAFE-A52). A placeholder is kept only where a delete made here while sync was stopped is being finished. Review found two faults in the first version, both fixed and tested: a file made late missed the pinned listing, so a delete made while stopped came back everywhere; and a delete arriving mid-connect could be followed by a create that re-listed the file. Verified with the unit suites (mutation-checked), the local gate with container e2e, a 60-minute Excalidraw hardness run (seed 779315737; its one round-98 failure, a shape bouncing in B's live view where this change's code never ran, did not recur in 60-minute replays on main or on the branch) and a 60-minute canvas hardness run; the user tested the build in their own vaults. Spec: `docs/changes/NEC-371-drawing-opened-before-first-write/spec.md` ## Changelog A drawing, canvas or base arriving from another vault no longer opens as Markdown when opened the moment it appears.
A file the folder listing names that this vault does not have was made as
an empty placeholder and filled once its document arrived. A drawing opened
in between was parsed empty by Excalidraw and shown as Markdown until it was
reopened (FLAKE-15, CI run 1635). NEC-297's hold could not help, since no
write was under way when the view loaded.

A structured file's write needs nothing on disk beforehand, so FileSync now
asks the connect to create the file, and StructuredSync's first write makes
it with its content. An unfilled document makes no file. A file that appears
at the path first is read in, not written over. A delete made here while sync
was stopped still places the file again, so it can be finished. SAFE-A52.

Task: NEC-371

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztaiNNy5ow2p3KGFF4X
Pin a structured file once made, and make it only while still listed
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 6m2s
CI / e2e (pull_request) Successful in 15m2s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 6m21s
CI / e2e (push) Successful in 15m0s
CI / promote (push) Successful in 32s
9c86bc1528
Found in review of the first-write create. The file is now made later than
the old placeholder was: after the connect, the fill and the write debounce,
and so after the pins the listing change saved. Pins name only files on disk,
so a drawing filled late stayed unpinned. A delete made here or elsewhere
while sync was stopped then read at the next start as a file new to the
folder, and the drawing came back everywhere. The create now asks FileSync to
save the pins.

A delete arriving while the file's connect was still under way is past
disconnectFile's reach, and was followed by a create of a file no longer
listed, which the watcher then listed again. The create now checks the
listing before it begins, and again with no await before vault.create.

Task: NEC-371

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztaiNNy5ow2p3KGFF4X
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Nectenda/nectenda!335
No description provided.