ENG-2216 Add a graph-level asset registry accessor for Roam - #1402
Open
maparent wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
maparent
force-pushed
the
eng-2216-Add-a-graph-level-asset-registry-accessor-for-Roam
branch
from
September 6, 2026 16:00
401a8e6 to
2a3ca2f
Compare
maparent
marked this pull request as ready for review
September 6, 2026 16:07
maparent
force-pushed
the
eng-2216-Add-a-graph-level-asset-registry-accessor-for-Roam
branch
from
September 6, 2026 22:32
2a3ca2f to
bc186d0
Compare
maparent
force-pushed
the
eng-2216-Add-a-graph-level-asset-registry-accessor-for-Roam
branch
from
September 6, 2026 22:40
bc186d0 to
0331964
Compare
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.
Reviewer brief
These are prerequisites to eng-2219, and are not yet connected.
Verification
Has unit tests. Tested after integration in eng-2219.
Loom video
Forthcoming.
Scope check
$scope-checkagainst the ENG ticket and final diff.Done When: Originally none. After corrections from review:A shared
isJsonObjectguard moved fromimportedSourceIdentity.tsintogetBlockProps.ts(pure move, no behavior change), and aconsole.warnwhen the registry page exists without its block.Local delegated full review
$dg-delegated-full-reviewwhen no other full-review workflow is available.Three findings were left unfixed, all of them for the same underlying reason: the module currently has no callers, so each one is a guess about a call site that hasn't been written yet.
The existence check and the create are separated by an await, so N overlapping first-writes on a fresh graph each see no block and each create one. The suggested fix was a module-level in-flight promise memo.
Set aside because no in-process parallel caller exists, and a module memo would not help the case that actually occurs in the wild: two Roam tabs on the same graph are two module instances, so the memo cannot span them. Adding it would buy protection only against a caller nobody has written, while implying a safety guarantee it doesn't provide. The cross-client race is the one ENG-2216 already priced: last write wins, cost is one redundant upload, do not add locking.
Each call costs a page-uid pull, a shallow-tree read, and a props pull, then rebuilds a filtered copy of the entire map to answer about one hash. Checking N assets costs 3N graph reads.
Set aside because the fix belongs in the caller, not here. A caller looping over a node's assets should hoist one readAssetRegistry() and index it; caching inside the module would instead need an invalidation story (when does the memo go stale relative to another tab's write?) that nothing can specify until the call site exists. readMirroredAssetUrl stays a correct convenience for one-off lookups, and the per-import path can bypass it.
If a user deletes a mirrored file from Roam storage, the hash→URL entry survives and hands out a dead URL, which lands in imported blocks as a broken image. There is no removal export.
Set aside as YAGNI: nothing in the codebase can currently detect a dead URL, so there is no caller to hold the other end of a forgetMirroredAsset. Adding the export now would ship an untested, unreachable code path and lock in a signature before the detection mechanism — whatever eventually notices the 404 — exists to shape it. The registry is documented as a cache rebuildable from the imported- file names, so the failure is recoverable rather than data-losing.
The common thread worth recording on the ticket: 1 and 4 should be revisited when the first caller lands (whoever writes the per-node asset loop owns both the hoist and the question of whether parallel mirroring is worth it), and 5 when something can detect a dead URL.
https://linear.app/discourse-graphs/issue/ENG-2216/add-a-graph-level-asset-registry-accessor-for-roam