NEC-372: A peer's edit outside a section card being typed in went missing on CI (SAFE-A32, possible silent loss) #336

Merged
nectenda-agent merged 9 commits from worktree-nec-372-a-peers-edit-outside-a-section-card-bein into main 2026-11-01 01:07:39 +00:00
Collaborator

Task: NEC-372 — https://projectron.nerchure.com/tasks/394

A note shown in a canvas card lost a peer's line, and later a typed word, when the card saved from surroundings behind the document: three gates in the view guard's base cascade each dropped the record of what the card built its save on, and the save was diffed against the document, deleting what it lacked, in both vaults with no copy. Found on CI once in 54 runs, reproduced by an opt-in seeded repro (nec-372-repro.test.ts) and traced with new diagnostic logging (every load into a card, every card save, the base chosen; hashes, never text). The model replaces the cascade: a card's save is read in against what it built it on, followed back through its own saves never read in, for 30 s after the card closed too; a save with no vouched base is never read in over the document, where that would remove a line, without the note kept first in .nectenda-backups with a notice; and a card is not reloaded with its own superseded save. SAFE-A32 amended; docs/sync-limitations.md records what remains. Evidence: 11 mutation checks, gate green, repro 400/400 on the failing seed with no copy kept, canvas hardness hour clean, three fresh-context reviews.

Spec: docs/changes/NEC-372-section-card-peer-edit/spec.md

Changelog

A note shown in a canvas card no longer loses another person's line, or a word you typed, when the card saves while it is behind the shared note; a save Nectenda cannot place safely keeps a copy of the note first.

Task: NEC-372 — https://projectron.nerchure.com/tasks/394 A note shown in a canvas card lost a peer's line, and later a typed word, when the card saved from surroundings behind the document: three gates in the view guard's base cascade each dropped the record of what the card built its save on, and the save was diffed against the document, deleting what it lacked, in both vaults with no copy. Found on CI once in 54 runs, reproduced by an opt-in seeded repro (nec-372-repro.test.ts) and traced with new diagnostic logging (every load into a card, every card save, the base chosen; hashes, never text). The model replaces the cascade: a card's save is read in against what it built it on, followed back through its own saves never read in, for 30 s after the card closed too; a save with no vouched base is never read in over the document, where that would remove a line, without the note kept first in .nectenda-backups with a notice; and a card is not reloaded with its own superseded save. SAFE-A32 amended; docs/sync-limitations.md records what remains. Evidence: 11 mutation checks, gate green, repro 400/400 on the failing seed with no copy kept, canvas hardness hour clean, three fresh-context reviews. Spec: `docs/changes/NEC-372-section-card-peer-edit/spec.md` ## Changelog A note shown in a canvas card no longer loses another person's line, or a word you typed, when the card saves while it is behind the shared note; a save Nectenda cannot place safely keeps a copy of the note first.
A section card on CI lost a word it typed and took back a copy of the note
from before a peer's change, and the peer's line went missing; nothing in the
diagnostic log could say what loaded the card or which base its next save was
read in against. Every load into a tracked card is now logged, the plugin's
own said first, and so is each card save and the base chosen for it, by
short tag and byte count, never by text.

The two canvas-attachments cases that can lose that line now wait on both
vaults and fail with both notes, the files beside them, their backups and
their log lines. nec-372-repro.test.ts runs the scenario in seeded rounds,
opt-in, so it can be soaked where the 14-minute suite cannot.

Task: NEC-372

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
A section card being typed in misses a write that the whole-note card beside
it loads. The guard gave a card's save its own base only while no view at
all held the write, so the section card's next save, built on its own last
save, was read in against the document as deleting the peer's change the
write brought: gone from both vaults, with no copy (NEC-372 repro, seed
259921864, round 15; once in 54 CI runs). While a write is pending, a card's
save not built on it is now read in against what that card built it on.

Task: NEC-372

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
Review of NEC-372: the test fake never moved a section card's surroundings
when it loaded a file, so no unit test defended the premise the fix rests on,
that a card's save is built on what it last loaded. The fake now cuts its
section from what it loads, as Obsidian's loadContents does, and the
regression test checks that a save after a load carries the peer's line;
with the old fake it fails. The plugin's own load into a card now logs what
the card last loaded or saved before replacing it. The spec names the right
test and says loads before a note's first write are not logged.

Task: NEC-372

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
The repro, after the first fix, lost a typed word from both vaults (seed
264602235, round 247): a section card saved twice in quick succession, and
Obsidian's re-index of the older save reloaded it after the newer one, the
word leaving its editor. Its next save came with no write pending, got no
base, and was read in against the document as deleting the word. A card's
save is now read in against what it built it on whenever that is known and
read in; where card and document changed one line differently, the merge
keeps both versions, so the word survives as a duplicated line instead of
being lost.

Task: NEC-372

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
A card saving twice in quick succession can be told of the first save's
re-index after the second, and Obsidian reloaded it with the older text: a
word typed between them left its editor (NEC-372 repro, seed 264602235,
round 247). Read against its own base the word was kept, but the section's
line came out twice. The guard now remembers the texts each card has held and
refuses a reload with one it has moved past, at loadFileInternal, which the
reload calls through the card; onFileChanged is registered with the metadata
cache when the card is made, so a wrapper there would never run. The e2e
checks the card still has loadFileInternal. Asked, the user chose to stop
the reload in this card rather than ship the duplicate.

Task: NEC-372

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
Second review of NEC-372: the reload refusal covered any text a card had held,
loaded or saved, broader than the user chose (a card's own superseded saves).
A whole-note card could then refuse a legitimate reload of a text it had only
loaded. It now refuses only its own saves; a test of the file going back to a
loaded text fails on the broad version. The docs said a refused card is
repaired if the file truly went back; that holds only through our write, and
the limitation now says so, with the whole-note card's quick-preview base the
review traced.

Task: NEC-372

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
400 repro rounds on the final NEC-372 code lost the peer's line at round 393
(seed 264602235): a section card that missed the write saved twice before the
first save was read in, and the guard kept one save record per card, so the
second replaced the first and the first was read in with no base, as
deleting the peer's line. Records are now kept per save until read in.

Task: NEC-372

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
Three fixes at one layer were three gates in one cascade (viewBase) between
a correct record of what a card built its save on and its use, and every
null fell through to a diff against the document, deleting what the card's
stale surroundings lacked. Two things replace the cascade. The record is
followed back through the card's own earlier saves that were never read in
(a save superseded on disk before its modify event ran is never seen), so
NEC-326's gate keeps its protection without a null. And a card's save the
guard still cannot vouch for is read in only after the document is kept in
.nectenda-backups with a notice, where that would remove a line: a fourth
way of losing the base now costs a copy, not a line. The repro fails a round
that kept a copy. A unit test fails without each half, and the kept copy is
not taken for a vouched save, nor for one that removes nothing.

Task: NEC-372

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
Read a card's save by its record for 30 s after its canvas closed
All checks were successful
Release note / release-note (pull_request) Successful in 18s
CI / build (pull_request) Successful in 5m59s
CI / e2e (pull_request) Successful in 15m4s
CI / promote (pull_request) Has been skipped
eb69da45d2
Review of the A + B commit: Obsidian saves a card holding typing as its
canvas closes, and the save's modify event runs with the card gone. With no
open view, the record of what the card built its save on went unconsulted,
and neither the chain nor the kept-first rule saw a card: the save was read
against the document, deleting the peer's line in both vaults with no copy.
A card is now read by for 30 s after it was last seen open. Also from that
review: as many own saves kept as records, so a save whose record is gone is
still known as a card's; a test for a tracked card whose chain ends on a
text never read in; and the repro's copy baseline carried across rounds.

Task: NEC-372

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EV8ztYjeDx4VYxFVTqxnAW
cruelacid force-pushed worktree-nec-372-a-peers-edit-outside-a-section-card-bein from eb69da45d2
All checks were successful
Release note / release-note (pull_request) Successful in 18s
CI / build (pull_request) Successful in 5m59s
CI / e2e (pull_request) Successful in 15m4s
CI / promote (pull_request) Has been skipped
to 95ca57bb1d
All checks were successful
Release note / release-note (pull_request) Successful in 17s
CI / build (pull_request) Successful in 5m56s
CI / e2e (pull_request) Successful in 15m2s
CI / promote (pull_request) Has been skipped
CI / build (push) Successful in 6m9s
CI / e2e (push) Successful in 15m0s
CI / promote (push) Successful in 33s
2026-11-01 00:50:36 +00:00
Compare
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!336
No description provided.