improvise-vndi: an inline edit opened before a document swap is refused

EditTarget captures document_generation when the editor opens, and
BasisCache::claim_as_read claims it rather than the current one. The
layout tier stays current, as clients.md argues for 2wu3. A red test
through a real Host over MemoryFs: A opens North/Revenue, B loads a
same-shaped document holding 5555, A commits "42" -> DocumentReplaced,
5555 survives.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdfEGXA7aJ6ftMsCc9PJze
This commit is contained in:
Edward Langley
2026-09-23 07:48:15 -07:00
parent 12c81dd3d6
commit 5690903d60
5 changed files with 119 additions and 17 deletions
+20
View File
@@ -4749,3 +4749,23 @@ claims at commit. The commit was then *accepted*. With the refusal assertion
disabled, the host held `Some(Number(42.0))`, so A's commit had re-created the
cell B cleared. Under that rival, the 0j0f test above failed as well. Both
files were restored.
### an_edit_opened_before_a_document_swap_is_refused_in_the_new_document
improvise-vndi, through a real `Host` over `MemoryFs`. A opens an inline editor
on North/Revenue, which shows 1200. B sends `LoadModel` for a document that
differs only in that cell, which holds 5555. Every name, the view included, is
kept, per gotcha 39's fixture warning: a rename would relay a `SwitchView` and
hide the bug. A folds the rebase `Snapshot` with the editor still open, as
`web/app.js` does, and then commits "42". The `EditTarget` held `{cell,
version}` and `claim_as_read` paired that version with the *current*
generation. `RecordHash` is coordinate-derived, so the same record resolved
in the new document at a matching counter, and the host **accepted** the
commit. It failed at the `DocumentReplaced` assertion: the answer was
`Accepted`, and 5555 had become 42.
Rival injected: `claim_as_read` ignoring the captured generation and claiming
the current one. That is the pre-fix behaviour, restated after the fix. Only
this test failed in the whole workspace. The layout tier staying current is
still pinned by `an_edit_writes_the_cell_the_user_clicked_after_the_rows_renumber`.