docs(exploration): Yjs document history and evidence-grade attribution (0376, 0377) - #597
Merged
Merged
Conversation
added 2 commits
July 19, 2026 16:49
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: xNet Test <test@xnet.dev>
…story Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: xNet Test <test@xnet.dev>
Contributor
|
Preview: https://xnet.fyi/pr/597/app/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two linked explorations on document history and attribution. Docs only — no code, no changeset needed.
0376 — Two Histories, One Timeline
The History tab (
time-machine, wildcard context tool) scrubs the node change log only. On a page it replays the title, tags and icon, and says nothing about the prose.The plumbing is ~80% built and 0% surfaced:
DocumentHistoryEnginecaptures Yjs snapshots on every debounced persist, persisted to a realyjs_snapshotstable.mergeTimelines()already computes the unified timeline — no caller outside its own test.useTimeMachinefetches the snapshots only to.lengththem;TimeMachinePanelprints that count as a caption.Findings:
restoreToFrontierdocuments that document content is not restored, andtm.restore()inherits it — the confirm dialog promises a full restore. The frontier already carriesyjsSnapshotRef, so the fix is small.gc: falseeverywhere,PruningEnginenever touches Yjs, no compaction exists. But CRDT items are keyed(client, clock)with no wall time, so a complete item log still can't answer "what did this say Tuesday at 3pm".Recommends one timeline, two lanes, coarse by default — and rejects a naive merge, because it would mix signed and unsigned entries.
0377 — Evidence-Grade Attribution
The follow-on: how to get detailed attribution in the CRDT using the existing data model.
Almost none of it needs building.
packages/sync/src/yjs-change.tsfully implements Yjs updates as entries in the same signed per-node hash chain —YJS_CHANGE_TYPE = 'yjs-update',createYjsChange, type guards, a ~350-line test suite, barrel exports. Zero production callers. Same forClientIdAttestation,validateClientIdOwnership,createPersistedDocState,YjsBatcher.Change<T>'s own header names Yjs as a first-class payload type.Meanwhile every Yjs update is already signed in transit with author + timestamp + clientID, and all of it is discarded at
setDocumentContent.Findings:
plan03_4_1YjsSecurity/README.mdhas five[x]boxes that track module existence, not wiring. Worth correcting regardless of whether this work proceeds.yjs_statemust stay authoritative. 0254 states the local log is a non-authoritative cache, and its compaction ships and runs every boot — inverting authority would let compaction delete document content. The correct shape is the parallel that already exists.YjsBatcher's 2 s default gives ~7-15:1 envelope amplification and ~1,800 rows per writing hour against a whole-user budget of 5,000 changes/day; ~10 s with paragraph flush lands ~2-3:1.BatchCommitis forbidden on the interactive lane (0357) — amortise by batching updates into fewer changes, not signatures.Notes
AttributionManageris blocked on a beta frozen at14.0.0-16since 2025-12-07, whilelatestis 13.6.31.🤖 Generated with Claude Code