NEC-311: A failed backup outside the write is ignored, and content replaced with no copy #317

Merged
nectenda-agent merged 19 commits from worktree-nec-311-a-failed-backup-outside-the-write-is-ign into main 2026-10-25 11:17:42 +00:00
Collaborator

Task: NEC-311 — https://projectron.nerchure.com/tasks/330

When a backup copy made before overwriting a note or its shared document could not be written, the overwrite went ahead anyway, so content could be replaced with no copy kept. Now nothing is replaced until its copy is kept: the note and its document are left as they are, the user is told once, and the copy is retried.

Ride-alongs from the same work: NEC-330 (typing that could not be replayed at a bind is held until its copy can be kept), NEC-331 (properties are not rewritten before their copy is kept), NEC-332 (the Markdown hardness run resolves a raced copy whose path the log scrubbed), NEC-333 and NEC-334 (a note or structured file deleted here while sync was stopped stays deleted when sync stops again before the delete is carried out), and NEC-336 (Obsidian's copy of one pane over another, when two panes of a note change within ~30 ms, is no longer taken when the copied pane holds typing, so a collaborator's change is no longer deleted from every vault).

Verified locally: gate-local.sh passed at b7ed7ddb (unit suites, lint, typecheck, mirror check, full container e2e). Markdown hardness 60 min on seed 1995616556, which failed at rounds 68 and 319 on main: 347 rounds passed. Canvas hardness 60 min on seed 536275601: 270 rounds passed. Each new rule mutation-checked; the NEC-336 e2e fails with the fix off.

Spec: docs/changes/NEC-311-copy-failed-outside-write/spec.md

Also fixes NEC-333: A delete made here while stopped is forgotten when sync stops again before it is carried out
Also fixes NEC-334: A structured file's delete made here while stopped is forgotten when sync stops again before it is carried out
Also fixes NEC-336: A second pane's save deletes a collaborator's text with no copy, after a bind replays the other pane's typing

Changelog

A note or its shared document is no longer replaced when the backup copy made before replacing it cannot be written; you are told, and it retries.

Task: NEC-311 — https://projectron.nerchure.com/tasks/330 When a backup copy made before overwriting a note or its shared document could not be written, the overwrite went ahead anyway, so content could be replaced with no copy kept. Now nothing is replaced until its copy is kept: the note and its document are left as they are, the user is told once, and the copy is retried. Ride-alongs from the same work: NEC-330 (typing that could not be replayed at a bind is held until its copy can be kept), NEC-331 (properties are not rewritten before their copy is kept), NEC-332 (the Markdown hardness run resolves a raced copy whose path the log scrubbed), NEC-333 and NEC-334 (a note or structured file deleted here while sync was stopped stays deleted when sync stops again before the delete is carried out), and NEC-336 (Obsidian's copy of one pane over another, when two panes of a note change within ~30 ms, is no longer taken when the copied pane holds typing, so a collaborator's change is no longer deleted from every vault). Verified locally: gate-local.sh passed at b7ed7ddb (unit suites, lint, typecheck, mirror check, full container e2e). Markdown hardness 60 min on seed 1995616556, which failed at rounds 68 and 319 on main: 347 rounds passed. Canvas hardness 60 min on seed 536275601: 270 rounds passed. Each new rule mutation-checked; the NEC-336 e2e fails with the fix off. Spec: `docs/changes/NEC-311-copy-failed-outside-write/spec.md` Also fixes NEC-333: A delete made here while stopped is forgotten when sync stops again before it is carried out Also fixes NEC-334: A structured file's delete made here while stopped is forgotten when sync stops again before it is carried out Also fixes NEC-336: A second pane's save deletes a collaborator's text with no copy, after a bind replays the other pane's typing ## Changelog A note or its shared document is no longer replaced when the backup copy made before replacing it cannot be written; you are told, and it retries.
Before an editor binds, and before a file is read into its document, text
sync keeps a copy in .nectenda-backups of whatever is about to be replaced.
backupLocalFile reports a copy it could not make by returning false, and
these places went ahead regardless: the reconcile before a bind, a view's
save kept aside, the document kept before a file with no base, a large save
kept before a one-change merge, and SAFE-A39's copy of a board before a
raced save.

Now none of them replaces anything without its copy. The reconcile reports
the failure, and the Markdown editor and the canvas card stay unbound and
try again after 30 seconds, doubling to five minutes; their edits are logged
and replayed when they bind. A read-in whose copy failed reads nothing in
and is tried again on the same wait, and a write that met it does not go
over the file. A second reader of a save being kept aside waits on that
copy. The user is told once per note until a copy is made, at the NEC-310
write sites too.

Task: NEC-311
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
A save whose parts a closed view showed were passed over is kept in
.nectenda-backups, since those parts are not read in. The copy was fired and
forgotten: on a full disk the write that puts the file in line with its
document went over it, and the parts were in no copy at all. It is now owed
as a clashed save's copy is, so no write replaces the file until it is made.

Owed copies, and a save of another file's content whose copy failed, are
also tried again on their own after the shared wait. With a view bound the
view writes the file itself, so there is no write of ours to try them first.
A write that gives up for a copy tells the user once until a write lands.

Task: NEC-311
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
When an editor binds and the typing made while it was unbound cannot be
replayed exactly, the editor's whole text is kept in .nectenda-backups and
the bind sets the editor from the document (SAFE-B5). The copy was fired
and its result never looked at, so on a full disk the typing was in no copy
and no longer in the editor.

The bind cannot wait for the copy, so the text is now held and the copy
tried again on the shared wait, 30 seconds doubling to five minutes, until
it is made, by path, so a sync restart does not drop it. The user is told
once, and told to keep Obsidian open meanwhile: quitting is the one thing
that still loses it.

Task: NEC-311
Also-fixes: NEC-330
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
FrontmatterSync keeps a copy of the note before it prunes a property from
the merged values, removes a leftover second block, moves characters glued
in front of the opening line, or rewrites a block whose lines held a comment
or another value. The copy was fired from inside the transaction handler and
never checked, so on a full disk the change was made with no copy.

The host now says whether the copy was made. A change that needs one waits
for it: nothing changes, the reconcile runs again once the copy lands, or
after the shared wait if it failed, and the user is told once. The decision
to settle the text to the map is carried to that run; without it, the retry
read the merge's text as an older client's edit and wrote it into the map.

Task: NEC-311
Also-fixes: NEC-331
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
SAFE-A30 now states the rule every site follows: a change made after a copy
into .nectenda-backups is not made when the copy could not be, the user is
told once, and it is tried again on the shared wait; content held nowhere
else is held and its copy retried. SAFE-C1, SAFE-B5, SAFE-A39 and SAFE-A23
say what that means for the bind, the editor's text, a raced board save and
a note's properties. SAFE-A39 no longer reads a save in after its copy
failed. The NEC-311 limitation is fixed, with the one case left open: an
editor's text held in memory is lost if Obsidian quits first.

Task: NEC-311
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
Obsidian's lint rule: a popout window has timers of its own.

Task: NEC-311
Also-fixes: NEC-331
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
Two holes found in review. A raced save (SAFE-A39) whose copy failed relied
on the view guard's mark for its retry, and the mark goes when the view
closes: closed after the notice, the board's save was read in with no copy.
The note now owes that copy itself until one is made.

And readIn can now wait on a copy, so another reader can act on the file
meanwhile. The write that called it carried on from its old decision: F read,
F2 read in by its modify event, F put back by a tool, and the write passed
the compare-and-swap on F and went over the revert. readIn now says when it
was overtaken, and the write starts again.

Also: a read-in already waiting to retry is not pushed further off by each
save, and a reconcile copy that succeeds ends the failure streak.

Task: NEC-311
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
Found in review. A structured document torn down with copies still owed
dropped them, and with a view bound the file no longer held them: the view
had saved over it. They are now handed to a retry of their own, by path,
until each is made. Saves of another file's content owed a copy are kept as
a set, not one at a time, and the failure is said once per file until a copy
is made. The notices no longer say the file is left as it is, which with a
view bound it is not.

While an editor waits to retry its bind, it announces no presence for the
note. The memory-only case is named in sync-limitations.

Task: NEC-311
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
Task: NEC-311
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
The run excuses a backup kept before a raced save (SAFE-A39) by matching
the path its diagnostic log names. The log scrubber reads any run of 64 or
more path-like characters as key material, so the copy of a board three
folders deep was logged as `.[base64].md`, and the run failed on a
legitimate copy (seed 1478789247, round 114). A keep whose path is not
among the copies is now matched by note and time: that note's backup,
stamped at or up to five seconds before the log line, not another keep's.

Task: NEC-311
Also-fixes: NEC-332
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7va1SLdcLRzHU6zZRjdSq
A note deleted here while sync was stopped is placed again and deleted
once its document has heard from the server. Sync stopping in between
left the placeholder, which the next start kept as a note, so a note
renamed while stopped stayed under both names: the Markdown hardness
run's "renamed away, yet still there" on seeds 1995616556 and
1478789247, the first failing the same way on main. Such a delete is
now recorded until decided, and carried on while its file holds
nothing new.

Task: NEC-311
Also-fixes: NEC-333
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
A canvas or drawing deleted here while sync was stopped takes the same
path as a note, and its placeholder was kept the same way when sync
stopped before the delete. Each recorded delete now also carries the
key of what the file agreed on when the delete was found: a record
left by a failed write, for a file agreed on anew since, is no longer
that delete and is not carried on.

Task: NEC-311
Also-fixes: NEC-334
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
From review. A placeholder resumed when it held any text its document
was known to have had, and typing made into the note placed again,
in the document before the stop and saved after it, would have been
deleted with it: now only empty, or exactly the agreed text. A
structured file the server never confirmed was settled as changed,
not carried on. A reconcile tried again on the same connection
resumed the delete its first attempt was still deciding, and placed
the note again after it was gone. A stopped session's queued save no
longer writes a store a later start owns.

Task: NEC-311
Also-fixes: NEC-333
Also-fixes: NEC-334
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
Two probes, for the Markdown hardness run's round-319 loss. With this
plugin off, two panes of a note changed within some 30 ms both end up
holding whichever changed first, the other change gone from both: one
pane's text is copied over the other, not merged. With it on, a
collaborator's change arriving in the bound pane as the other pane is
typed into is deleted from the document. setViewData on a pane does
not spread to the other; setValue does.

Task: NEC-311
Also-fixes: NEC-336
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
Obsidian keeps two panes of a note in step by copying the one that
changed over the other. Copied over the bound editor, a pane typed
into as a collaborator's change arrived deleted that change from every
vault. Copied over a pane that had just let the binding go, it left
that pane without the change, and Obsidian, saving the pane as its tab
was left, merged that file into the newly bound editor three ways: the
Markdown hardness run's round-319 loss, on main too.

Such a copy, of an unbound pane holding typing, is now dropped in every
editor; over the bound one, that pane's typing is replayed instead. As
an editor binds, every other pane of the note is brought up to the
document with setViewData, which does not spread. Only a pane holding
typing is asked to save before a write. The log gives each pane's text
by key.

Task: NEC-311
Also-fixes: NEC-336
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
From review. A pane rewritten under its typing still counted as
holding typing, so a reload or a load landing after it in another pane
read as a copy of it and was dropped. Now the source must have been
typed to the copied text since its last rewrite, now or a keystroke
ago, and the target must show the note's document: copies into a pane
showing anything else, as between two panes typed while neither is
bound, are taken as Obsidian always had them. A drawing's are left
alone. A pane whose typing did not all replay is kept whole before it
is brought up; a repair asks only a pane holding an edit to save; and
each view is asked as its turn comes.

Task: NEC-311
Also-fixes: NEC-336
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
The final Markdown hour failed at round 68 once in three replays: the
start that found a note's delete made here was torn down before its
placeholder existed, and the pins it saved as it went, of the files
present, left the note out. The next start, which carried the delete
on from its record, no longer counted the note as deleted here, and it
stayed under its old name. An undecided delete now stays pinned while
listed. Every way such a delete ends without one is logged with why,
which is how this was found.

Task: NEC-311
Also-fixes: NEC-333
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
Record NEC-311's gate and hardness runs in its spec
Some checks failed
CI / promote (pull_request) Has been cancelled
CI / e2e (pull_request) Has been cancelled
CI / build (pull_request) Has been cancelled
Release note / release-note (pull_request) Successful in 17s
16de94d2c8
Task: NEC-311
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
Add NEC-311's release notes, one line per change
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 5m29s
CI / e2e (pull_request) Successful in 13m42s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 5m41s
CI / e2e (push) Successful in 13m36s
CI / promote (push) Successful in 31s
5265a70040
Task: NEC-311

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014dkeQqPWHgQVYKCaCgD2XQ
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!317
No description provided.