Skip to content

fix(html): the envelope states the version the library takes - #877

Merged
andiwand merged 1 commit into
mainfrom
fix/edit-envelope-version
Sep 10, 2026
Merged

fix(html): the envelope states the version the library takes#877
andiwand merged 1 commit into
mainfrom
fix/edit-envelope-version

Conversation

@andiwand

Copy link
Copy Markdown
Member

🤖 Generated with Claude Code

The browser-produced save has been broken since #872 merged.

odr.editing.getOperations() — and odr.generateDiff(), which every app and
the wasm package call — stated "version": 1. Document::edit has taken 2
since #872. So every save a reader triggered from a rendered page threw
std::invalid_argument("unsupported edit version") before a single operation
was read.

One line. The rest is the guard.

Why nothing caught it

  • The browser check pages parse getOperations() and assert the operations
    — which ops, in which order, naming which ids — and never the envelope around
    them.
  • wasm/tests/edit.test.mjs and document_edit_test.cpp both write their own
    envelope by hand, with version: 2 spelled out.

So both sides were tested and the seam between them was not. That is exactly
the JS/C++ drift decision 7 of editing.md names as architecture A's main
risk.

A check on each page that produces an envelope now asserts the version, which
is the one thing neither side would notice drifting.

`odr.editing.getOperations()` and `odr.generateDiff()` stated
`"version": 1` while `Document::edit` has taken 2 since #872, so every
save the browser produced was refused with "unsupported edit version".

Nothing caught it: the check pages read the operations and never the
version, and the wasm and gtest suites write their own envelope by hand.
So a check on each page that produces one now asserts it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KKFKbUVCYF2VhujdmjhhPW
@andiwand
andiwand merged commit e0742da into main Sep 10, 2026
23 checks passed
@andiwand
andiwand deleted the fix/edit-envelope-version branch September 10, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant