Skip to content

ENG-1870 Copy Roam-origin assets into Supabase on publish - #1394

Open
maparent wants to merge 5 commits into
eng-1864-define-cross-app-asset-reference-contractfrom
eng-1870-copy-roam-origin-assets-into-supabase-on-publish
Open

ENG-1870 Copy Roam-origin assets into Supabase on publish#1394
maparent wants to merge 5 commits into
eng-1864-define-cross-app-asset-reference-contractfrom
eng-1870-copy-roam-origin-assets-into-supabase-on-publish

Conversation

@maparent

@maparent maparent commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Reviewer brief

This is a large PR, there are a lot of moving pieces.

There are actually five subtasks, in distinct commits, which may be easier to understand:
https://roamresearch.com/#/app/discourse-graphs/page/4o_mub_mn

Verification

There are unit tests.

Loom video

Code walkthrough (long): https://www.loom.com/share/91078efd00b14f959ebf0ba07950a4fe

Note: I mention something missing during the code walkthrough, but upon verification it's fine.

Demo: https://www.loom.com/share/ecdd8cdfaca141cfb26216ecda5cdc08

Scope check

  • [ x] Ran $scope-check against the ENG ticket and final diff.
  • Scope beyond Done When: None.
    Actually it called me on the change to return parameters of addFile, but I told it that CopiedAsset is the stage's record of what it stored, a stored asset's identity in shared storage is its hash, and the summary was previously conflating references with blobs. addFile's return is what makes that available without re-hashing. It accepted that justification as valid.

It's also pending the issue of whether the size limit should have been split between tickets, but right now it's within 1876.

Local delegated full review

  • [ X] Ran a comprehensive review of the entire final diff in a subagent with a fresh context. Use $dg-delegated-full-review when no other full-review workflow is available.

https://linear.app/discourse-graphs/issue/ENG-1870/copy-roam-origin-assets-into-supabase-on-publish

@linear-code

linear-code Bot commented Sep 4, 2026

Copy link
Copy Markdown

ENG-1870

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
discourse-graph Ready Ready Preview Sep 6, 2026 10:35pm UTC

Request Review

@supabase

supabase Bot commented Sep 4, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project zytfjzqyijgagqxrzbmz because there are no changes detected in packages/database/supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@maparent
maparent force-pushed the eng-1870-copy-roam-origin-assets-into-supabase-on-publish branch from d058750 to 14f6b43 Compare September 4, 2026 15:18
@maparent
maparent force-pushed the eng-1870-copy-roam-origin-assets-into-supabase-on-publish branch from 14f6b43 to 6f408af Compare September 4, 2026 18:22
@maparent
maparent force-pushed the eng-1870-copy-roam-origin-assets-into-supabase-on-publish branch from 6f408af to d891c94 Compare September 4, 2026 18:50
@maparent
maparent force-pushed the eng-1870-copy-roam-origin-assets-into-supabase-on-publish branch from d891c94 to 3010d2d Compare September 4, 2026 18:55
@maparent
maparent requested a review from mdroidian September 4, 2026 19:11
@maparent
maparent force-pushed the eng-1870-copy-roam-origin-assets-into-supabase-on-publish branch from 3010d2d to 7839b4c Compare September 6, 2026 14:36
@maparent
maparent marked this pull request as ready for review September 6, 2026 15:25
@graphite-app

graphite-app Bot commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

PR size/scope check

This PR is over our review-size guideline.

  • Recommended: ~200 lines changed
  • Acceptable limit: up to 400 lines when well-scoped/self-contained
  • Preferred file count: fewer than 5 files

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:

  • What single problem this PR solves
  • Why the files/changes are coupled

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devin Review found 1 potential issue.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +87 to +88
fname: assetUrl,
sourcePath: descriptor.filename,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Imported copies remain disconnected

Published Roam assets put their filename in source_path, but the importer ignores that field. It names files from the Firebase URL and leaves HTTP links unchanged, so imported notes never use the copied asset.

Prompt for agents
Complete the source_path contract across Roam publication and Obsidian import. Roam correctly stores the markdown token as FileReference.filepath and the original filename as source_path in apps/roam/src/utils/copyAssetToSharedStorage.ts. However, apps/obsidian/src/utils/importNodes.ts fetchFileReferences does not select source_path, importAssetsForNode derives its target path from filepath, and updateMarkdownAssetLinks skips HTTP URLs. For Roam-origin references this creates a local file from the Firebase URL but leaves the imported note linked to Firebase. Update the importer to use source_path for local naming and placement while retaining filepath as the lookup token, and rewrite matching HTTP asset tokens when a copied FileReference exists. Preserve existing Obsidian path behavior and add an integration-style test for a Roam Firebase image URL with source_path.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@maparent
maparent force-pushed the eng-1870-copy-roam-origin-assets-into-supabase-on-publish branch from 7839b4c to 264ccb5 Compare September 6, 2026 22:32
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