ENG-1855 Add Roam shared-node import discovery#1214
Conversation
|
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
|
sid597
left a comment
There was a problem hiding this comment.
Four short guideposts through the ENG-1855 data flow.
| const resources: ResourceAccess[] = []; | ||
| for (let from = 0; ; from += PAGE_SIZE) { | ||
| const response = await client | ||
| .from("ResourceAccess") |
There was a problem hiding this comment.
Review starts here: candidate identities come only from ResourceAccess rows granted to the user's groups. The later my_* reads only resolve those keys.
| const variants = contentByResource.get(resourceKey); | ||
| const direct = variants?.direct; | ||
| const full = variants?.full; | ||
| if ( |
There was a problem hiding this comment.
This is the ENG-1847 contract gate: only typed instances with both direct and typed full content reach the dialog.
|
|
||
| return [ | ||
| { | ||
| alreadyImported: importedSourceRids.has(sourceNodeRid), |
There was a problem hiding this comment.
Imported status joins on the stable RID, not title or local ID, so identical local IDs in different source spaces remain distinct.
| <HTMLTable striped style={{ width: "100%" }}> | ||
| <thead> | ||
| <tr> | ||
| <th>Source app</th> |
There was a problem hiding this comment.
This stays intentionally read-only: these columns match ENG-1855's pre-import metadata, while materialization remains in ENG-1859.
Roam's command palette runs commands on Enter keyup, which landed as a click on the dialog's autofocused close button and dismissed it instantly. Disable autoFocus/enforceFocus like AdvancedSearchDialog and restore outside-click close. Also from review: use Tailwind classes instead of inline styles, drop the unused ValidSharedSpace.id field, and unexport the file-internal getImportedSourceRids.
|
|
||
| return ( | ||
| <Dialog | ||
| autoFocus={false} |
There was a problem hiding this comment.
Roam's command palette dispatches commands on Enter keyup. Without autoFocus={false} that keyup lands as a click on the freshly-focused close button and dismisses the dialog immediately. Same props as AdvancedSearchDialog.
PR size/scope checkThis PR is over our review-size guideline.
Please split this into smaller PRs unless there is a clear reason the changes need to land together. If keeping it as one PR, please add a brief justification covering:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d2b17acf7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Replaces the hand-rolled paging loop with the existing @repo/database/lib/pagination helper, matching how syncDgNodesToSupabase already reads ResourceAccess.
https://www.loom.com/share/7210cfc4b3984f2ab927e7092dfab9c1
Summary
Adds a read-only Roam discovery surface for group-visible shared nodes.
ResourceAccess, so discovery reflects shared persistence rather than direct source-app access or every resource the user can read.my_spaces,my_concepts, andmy_contents.directand typedfullcontent before a resource is shown.discourse-graph.importedFrom.sourceNodeRidpages as imported.DG: Discover shared nodeswith Blueprint loading, retry, empty, search, reload, and status states.autoFocus={false}/enforceFocus={false}(same asAdvancedSearchDialog): Roam's command palette runs commands on Enter keyup, and without this the keyup clicks the autofocused close button and instantly dismisses the dialog.Imported status
Nothing writes
importedFromyet, so every node shows Available for now. This PR defines the prop path it reads (discourse-graph.importedFrom.sourceNodeRid); the import action (ENG-1859) writes that metadata when it materializes nodes.How to read this diff
This is 766 added lines because Roam had no discovery surface yet; it is four bounded pieces, not a broad rewrite.
The command registry is the only existing production file changed. There are no changes to shared packages, persistence schemas, migrations, sync behavior, or existing import code.
Suggested review order: start at
getGroupSharedResources, follow the rows throughbuildDiscoveredSharedNodes, then scan the table and tests.Review guide
discoverSharedNodes.ts: group-backed candidate selection and contract filtering.DiscoverSharedNodesDialog.tsx: read-only presentation of the ticket's source metadata.discoverSharedNodes.test.ts: resource identity, contract completeness, imported RID matching, current-space exclusion, and sorting.registerCommandPaletteCommands.ts: sync-gated command entry only.Scope
This PR intentionally stops at discovery. It does not materialize or refresh Roam nodes, import relations or assets, change sync behavior, or modify the database schema.
Validation
pnpm --filter roam test- 10 files / 53 tests passedpnpm --filter roam check-typespnpm --filter roam build- built with 0 errorspnpm --filter roam lint- 0 errors; existing warnings unchangedgit diff --check