Repository navigation
mdbase-next: route vault writes through the mdbase runtime when installed (seam, off by default) - #2385
Closed
callumalpass wants to merge 1 commit into
Closed
mdbase-next: route vault writes through the mdbase runtime when installed (seam, off by default)#2385callumalpass wants to merge 1 commit into
callumalpass wants to merge 1 commit into
Conversation
… installed VaultMutationService is TaskNotes' single write funnel. When an MdbaseMutationBackend is installed and claims a file (it is in the mdbase collection and is a known record), writes become replica intents: frontmatter callbacks -> field-level updates (set/unset keys with the read values as merge base), content callbacks and modify -> document replace with the read document as base, create -> record create. Each call resolves once the write is published into the vault, so callers see the same behaviour as with Obsidian's APIs. Without a backend, or for files outside the collection, nothing changes. Not installed by default yet: the shared runtime wiring lands once runtime.wasm hosts the file store.
Owner
Author
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.
This is the first step of the TaskNotes port to mdbase-next. The obsidian workstream owns it. Please don't merge or release it yet; the coordinator handles that.
What it does.
VaultMutationServiceis already TaskNotes' single write funnel (processFrontMatter,process,create,modify). This PR adds an installableMdbaseMutationBackend. When it's installed and claims a file (the file is in the mdbase collection and is a known record), writes become replica intents:update: the keys the callback set or removed, with the values it read as the merge base. Two devices editing different fields of one task both keep their change, instead of the last whole-file write winning.modifybecome a document replace, with the read document as the base. The replica merges, or holds on a real conflict.createbecomes a record create at the requested path.settle), so callers that re-read the file afterwards behave as before. It doesn't wait for sync confirmation, so TaskNotes behaves the same offline.vault.rename. The replica observes them as moves.Not installed by default. Nothing calls
setMdbaseMutationBackendyet, so there's no behaviour change and no release-notes entry. Wiring it up follows in a later PR: attach to the shared runtime (@mdbase-dev/obsidian-runtime), and adapt@mdbase-dev/sdk'sMdbaseClienttoMdbaseWriteClient. That waits untilruntime.wasmhosts the file store (mdbase-next #58, #103 and #134).Checks run:
npm run lint(including architecture conformance);jest tests/unit/core: 17 tests, 6 of them new. They cover field-level diffs, no-op suppression, document replace with base, modify/create routing, the fallback outside the collection, and behaviour without a backend.No changes to
.ops/.