[ENG-1856] Store source identity metadata for Roam imported nodes#1161
Open
sid597 wants to merge 1 commit into
Open
[ENG-1856] Store source identity metadata for Roam imported nodes#1161sid597 wants to merge 1 commit into
sid597 wants to merge 1 commit into
Conversation
Persist an imported cross-app node's stable source identity in the Roam page's block-props under `discourse-graph.importedFrom`, with helpers to derive it from a CrossAppNode, read/write it, and find an imported page by sourceNodeRid for duplicate prevention. Stored in block-props so it survives content overwrite and is datalog-queryable; mirrors the reified-block props pattern and reuses the shared rid.ts helpers. Includes a typed example fixture and unit tests for the pure functions.
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
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.
What
Adds the Roam-side storage layer for imported cross-app node identity (ENG-1856, M2 "Bidirectional node import"). When Roam imports an Obsidian-origin shared node, it must remember the node's stable source identity so it can (a) prevent duplicate imports and (b) refresh it later.
apps/roam/src/utils/importedSourceIdentity.ts:ImportedSourceIdentity— 6 app-neutral fields mirroring theCrossAppNodecontract:sourceApp,sourceSpaceId,sourceNodeId,sourceNodeRid,sourceTitle,sourceModifiedAt.toImportedSourceIdentity(node)— derive the stored identity from aCrossAppNode(title from thedirectcontent variant).writeImportedSourceIdentity(uid, identity)/readImportedSourceIdentity(uid)— persist/read under the page's:block/props→discourse-graph→importedFrom, merging alongside any sibling discourse-graph props (mirrorsmigrateRelations/createReifiedBlock).findImportedNodeUidByRid(rid)— datalog lookup returning an already-imported page's uid (duplicate prevention), keyed on the canonicalsourceNodeRid.Storage is block-props (not page content), so identity survives content overwrite on import/refresh and is datalog-queryable.
Scope / boundaries (pre-flight approved)
This is a foundational helper PR — the exported helpers are the deliverable; their consumers are downstream M2 issues, so there is no in-PR caller by design:
findImportedNodeUidByRidwriteImportedSourceIdentity(uid, toImportedSourceIdentity(node))sourceModifiedAtDeliberately out of scope (named owners): node-type mapping → ENG-1858; author/provenance → ENG-1875; discovery UI → ENG-1855.
Notes for review
IMPORTED_FROM_PROP_KEYis exported following the existingDISCOURSE_GRAPH_PROP_NAMEprecedent (wire-key constants exported from their owning module); ENG-1861 (refresh-all) / ENG-1875 (provenance) will enumerate imported pages by it.as [string][]on the datalog result matchesstrictQueryForReifiedBlocks's handling of untyped query output.CrossAppNode+rid.ts); branched offmain@36e3348.Tests
toImportedSourceIdentityandparseImportedSourceIdentity(round-trip + rejection of missing / wrong-typed fields and unknownsourceApp, and coexistence with sibling discourse-graph props): 8/8 pass.tscerrors indiscourseNodeSearchProviders.tsare unrelated to this PR.)Runtime proof (Loom — owed)
write/read/find call
window.roamAlphaAPI; with no UI consumer yet, proof is a console round-trip on a test pagePUID: