Frontmatter as a Y.Map #49

Closed
opened 2026-09-21 18:03:45 +01:00 by cruelacid · 1 comment
Owner

Part of #37.

What Relay does

Frontmatter synced as a Yjs Map with visual-property-editor support since 0.7.0.
Worth knowing they hit real trouble here: their issues #116 (a frontmatter append
loop, a Y.Text↔Y.Map deadlock) and open PR #127 (gating frontmatter Map
writes on provider sync) are both in this exact area.

What we do today

Frontmatter is part of the markdown Y.Text, so concurrent property edits merge
character-wise. Usually fine; occasionally produces YAML that is syntactically
wrong in the way blob-policy.ts already warns about for JSON.

What changes

A second root on the file's document holding frontmatter as a Y.Map, with
the body staying in Y.Text. This is where Relay's deadlock came from, so the
ordering between the two roots needs to be designed rather than discovered —
CLAUDE.md names async ordering as a recurring hazard here, with at least four
bugs already attributed to it.

Risk

risk:additive. A new root on an existing document; older clients replicate it
without acting on it, exactly as with Y.Map('blobs') from Phase 8. Gate with
MIN_PLUGIN_VERSION if the transition proves awkward.

Verification

Concurrent property edits from two vaults; the file always parses. Invert the
ordering rule and confirm the test fails.

Part of #37. ## What Relay does Frontmatter synced as a Yjs Map with visual-property-editor support since 0.7.0. Worth knowing they hit real trouble here: their issues #116 (a frontmatter append loop, a `Y.Text`↔`Y.Map` deadlock) and open PR #127 (gating frontmatter Map writes on provider sync) are both in this exact area. ## What we do today Frontmatter is part of the markdown `Y.Text`, so concurrent property edits merge character-wise. Usually fine; occasionally produces YAML that is syntactically wrong in the way `blob-policy.ts` already warns about for JSON. ## What changes A second root on the **file's** document holding frontmatter as a `Y.Map`, with the body staying in `Y.Text`. This is where Relay's deadlock came from, so the ordering between the two roots needs to be designed rather than discovered — `CLAUDE.md` names async ordering as a recurring hazard here, with at least four bugs already attributed to it. ## Risk `risk:additive`. A new root on an existing document; older clients replicate it without acting on it, exactly as with `Y.Map('blobs')` from Phase 8. Gate with `MIN_PLUGIN_VERSION` if the transition proves awkward. ## Verification Concurrent property edits from two vaults; the file always parses. Invert the ordering rule and confirm the test fails.
Author
Owner

Moved to the Vikunja board as NEC-26: https://projectron.nerchure.com/tasks/26

Moved to the Vikunja board as **NEC-26**: https://projectron.nerchure.com/tasks/26
Sign in to join this conversation.
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#49
No description provided.