Skip to content

[DO NOT MERGE]: HSM Sync Engine#69

Closed
dtkav wants to merge 64 commits into
mainfrom
merge-hsm
Closed

[DO NOT MERGE]: HSM Sync Engine#69
dtkav wants to merge 64 commits into
mainfrom
merge-hsm

Conversation

@dtkav
Copy link
Copy Markdown
Member

@dtkav dtkav commented Feb 19, 2026

No description provided.

@dtkav dtkav force-pushed the merge-hsm branch 2 times, most recently from 27a8e65 to 4554f5d Compare April 2, 2026 04:10
@dtkav dtkav force-pushed the merge-hsm branch 3 times, most recently from 70ef805 to 69aa55e Compare April 11, 2026 09:27
@dtkav dtkav force-pushed the merge-hsm branch 4 times, most recently from c3e08d6 to 139bf8c Compare April 21, 2026 00:36
@dtkav dtkav force-pushed the merge-hsm branch 4 times, most recently from cdc91bd to 8e28c46 Compare April 28, 2026 23:03
@dtkav dtkav force-pushed the merge-hsm branch 3 times, most recently from 1607f3d to ac9a798 Compare May 16, 2026 00:51
@dtkav dtkav force-pushed the main branch 2 times, most recently from ba684d2 to c1362e9 Compare May 20, 2026 21:30
dtkav and others added 11 commits May 27, 2026 22:21
Track pending write operations and wait for them to complete in
destroy() before closing the database. This prevents data loss when
the persistence layer is torn down while writes are still in flight.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The hasUserData() check determines whether IndexedDB contains stored
Yjs updates (indicating the document has real content vs being empty).

The previous threshold of >3 was based on outdated assumptions. Analysis
of the current y-indexeddb implementation shows:

- _dbsize only counts entries in the 'updates' store (not 'custom' metadata)
- Empty docs don't write anything: pendingState.length must be >2 to write
- The _storeUpdate handler skips updates with empty state vectors
- Therefore: empty DB = 0 entries, any real content = 1+ entries

The correct threshold is >0 to detect presence of stored updates.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
dtkav added 22 commits May 27, 2026 22:31
Teach YSweetProvider the provider-level behavior HSM sync depends on: read-only token handling, buffered reconnect sends, event/subdoc protocol messages, and protocol metric hooks. This keeps the transport contract coherent before HasProvider starts relying on it.
Move HasProvider from eager Y.Doc/provider allocation to an explicit ensure/destroy lifecycle, with sync waiters and deferred disconnect support for buffered provider messages. Thread TimeProvider through folders, documents, and canvases at the same boundary so the new lifecycle is usable immediately.
Use now() for the TimeProvider clock API and route LoginManager polling through the injected provider. Advance the unit-test submodule with only the currently passing tests updated for the renamed clock method.
Add the error extraction helper separately from HSM engine code and pair it with a focused submodule test. This keeps the later engine drop from carrying unrelated UI error-formatting behavior.
Add the interpreter-backed document engine, sync bridge, conflict/state-vector helpers, invariant checks, recording/replay support, undo capture, and the focused test harness. The manager and production folder lifecycle are intentionally left for their own chapters.
Add the persistence-backed manager that owns per-document HSM instances, wake and hibernation queues, state metadata caches, and manager-level metrics hooks.

Advance the unit-test submodule to the matching passing MergeManager and hibernation coverage.
Add current-session log parsing and disk-backed HSM JSONL recording helpers, including boot IDs and recent-entry lookup for diagnostics.

Also harden log rotation so concurrent rotations do not fail the append path.
(cherry picked from commit c5aa4ea89f333c33a1e7240b4a439153c6b28421)
Add the plugin-level RelayDebugAPI surface for HSM conflict snapshots, recording state, document content inspection, and CDP diagnostics.

Wire the API into plugin load/unload and advance the unit-test submodule with the focused debug conflict snapshot coverage.
Raise selector specificity for Relay pills and folder guides so the styles no longer rely on !important, and use the text-decoration shorthand for Obsidian compatibility.
Add attribution filtering controls to user awareness UI and position the dropdown relative to the awareness container.
Teach the diff view to label and style resolved and unresolved HSM conflict hunks, surface missing-file warnings, and trim obsolete DiskBuffer persistence scaffolding.
Render folder sync-state indicators in the Obsidian file navigation from per-folder SyncStore and MergeManager status updates.
Rename the smoke job to the standard e2e workflow and expand the workflow definition around the VM-backed test run.
Allow test sources to import Node helpers and require fixtures without tripping product-source lint rules.
Ignore local build feedback and harness-only artifact directories while keeping runtime slots ignored.
@dtkav dtkav closed this May 28, 2026
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