Skip to content

ENG-2247 Copy a node's assets and rewrite its markdown for Roam - #1429

Open
maparent wants to merge 2 commits into
eng-2217-rewrite-asset-links-in-obsidian-origin-markdown-for-roamfrom
eng-2247-copy-a-nodes-assets-and-rewrite-its-markdown-for-roam
Open

ENG-2247 Copy a node's assets and rewrite its markdown for Roam#1429
maparent wants to merge 2 commits into
eng-2217-rewrite-asset-links-in-obsidian-origin-markdown-for-roamfrom
eng-2247-copy-a-nodes-assets-and-rewrite-its-markdown-for-roam

Conversation

@maparent

@maparent maparent commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Reviewer brief

This creates a utility function, importAssetNodes, that ties together rewriteAssetLinks (ENG-2217) and mirrorAssetToRoamStorage (ENG-2218) to actually import the nodes detected in given markdown.
This also involves a refactoring of a repeated and defective utility function.
Finally, this includes some end-to-end tests (in a separate commit) that rely on importAssetNodes.

Verification

Includes unit tests.
Behaviour tests in #1401

Loom video

https://www.loom.com/share/f941f20853444597931d85d6b56ef68c

Scope check

  • Ran $scope-check against the ENG ticket and final diff.
  • Scope beyond Done When: None. ENG-2247's criteria were written after the split, so
    they describe this diff by construction. The list below measures against the original
    ENG-2219 Done When, which is what was agreed before the split.

Beyond the original ENG-2219 scope:

  1. The tokenizer API. rewriteAssetLinks exports lookupCandidates and gains
    collectAssetLocators, so the stage copies only references the rewriter can resolve.

    • Required now: without it the stage copies every recorded row, including ones whose
      locator no longer appears in the fetched markdown once frontmatter and the title
      heading are stripped. A Roam upload is a permanent charge on the user's storage, so
      this is reachable the moment the stage ships. Deriving the spellings forward instead
      does not work: a note writes fig#1.png as fig%231.png, and encodeURI leaves
      # alone.
    • parseMatch, which this depends on, went to ENG-2217 as a pure refactor.
  2. getErrorMessage consolidated into apps/roam/src/utils/getErrorMessage.ts,
    replacing the copies in materializeSharedNode and in mirrorAssetToRoamStorage (an
    ENG-2218 file), plus a branch for the { message } objects Supabase returns.

    • Required now: No. A module-local copy in importNodeAssets would have satisfied the
      ticket. This is cleanup, and it changes the error text of three existing callers. It
      consolidates the two copies that had to share it; other inline copies elsewhere in
      the codebase are untouched.
  3. assetDegradation.test.ts asserts the degradation path across the publish and
    import seam, calling ENG-1870's publishNodeAssets alongside importNodeAssets.

    • Required now: it satisfies task 6.1 of the cross-app-asset-references OpenSpec
      change. The contract between the two halves cannot be asserted from either side
      alone.
    • Decision: recorded on ENG-2219, comment of 2026-09-06.
  4. A doc comment in mirrorAssetToRoamStorage recording that nothing rolls an upload
    back. Comment only, no behaviour change.

    • Required now: importNodeAssets depends on that constraint and it was uncaptured.
  • Anyone affected or consulted: No, except item 3, agreed on ENG-2219 before the split.
  • Decision: item 3 as above; the rest are recorded in ENG-2247's description.

Local delegated full review

  • 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-2247/copy-a-nodes-assets-and-rewrite-its-markdown-for-roam

@linear-code

linear-code Bot commented Sep 10, 2026

Copy link
Copy Markdown

ENG-2247

@vercel

vercel Bot commented Sep 10, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated
discourse-graph Skipped Skipped Sep 10, 2026 10:07pm UTC

Request Review

@supabase

supabase Bot commented Sep 10, 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 added this pull request to stack #1430 September 10, 2026 14:43
@maparent
maparent force-pushed the eng-2247-copy-a-nodes-assets-and-rewrite-its-markdown-for-roam branch from 284bd2a to 8897117 Compare September 10, 2026 15:46
@maparent
maparent requested a review from mdroidian September 10, 2026 15:57
@maparent
maparent force-pushed the eng-2247-copy-a-nodes-assets-and-rewrite-its-markdown-for-roam branch from 8897117 to e278641 Compare September 10, 2026 20:45
@maparent
maparent force-pushed the eng-2247-copy-a-nodes-assets-and-rewrite-its-markdown-for-roam branch from e278641 to 6208fe4 Compare September 10, 2026 21:40
@maparent
maparent force-pushed the eng-2247-copy-a-nodes-assets-and-rewrite-its-markdown-for-roam branch from 6208fe4 to d650f4b Compare September 10, 2026 22:07
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