Skip to content

[ENG-1848] Add Roam full markdown content variant for shared nodes#1134

Open
sid597 wants to merge 5 commits into
mainfrom
eng-1848-add-roam-full-markdown-content-variant-for-shared-nodes
Open

[ENG-1848] Add Roam full markdown content variant for shared nodes#1134
sid597 wants to merge 5 commits into
mainfrom
eng-1848-add-roam-full-markdown-content-variant-for-shared-nodes

Conversation

@sid597

@sid597 sid597 commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Rebases ENG-1848 on the final ENG-1847 baseline (5954c548) and keeps the ticket focused on Roam emitting the required markdown full content variant for shared nodes.

  • Adds convertRoamNodeToFullContent so the existing Roam sync loop uploads full content alongside the current direct content.
  • Keeps direct content and embedding behavior unchanged: direct rows are embedded, full rows are not embedded.
  • Shapes Roam full content as # {title} plus the node body via the existing toMarkdown serializer with refs/embeds inlined.
  • Updates the Roam reference fixture to the final CrossAppNode contract shape: CrossAppNode["content"]["full"] with inline format: "text/markdown".
  • Does not export or recreate the deleted draft persistence fixtures or package-level content constants.

Validation

  • pnpm exec prettier --check apps/roam/src/utils/convertRoamNodeToFullContent.fixture.ts apps/roam/src/utils/convertRoamNodeToFullContent.ts apps/roam/src/utils/syncDgNodesToSupabase.ts
  • pnpm --filter roam check-types
  • pnpm --filter roam lint (0 errors; existing repo warnings remain)

Manual follow-up

A real Roam graph with sync enabled still needs the Supabase smoke check: confirm a discourse node writes a variant: "full" markdown row alongside its direct content row.


Open in Devin Review

@linear-code

linear-code Bot commented Jun 19, 2026

Copy link
Copy Markdown

ENG-1848

@supabase

supabase Bot commented Jun 19, 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 ↗︎.

@vercel

vercel Bot commented Jun 19, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
discourse-graph Skipped Skipped Jun 22, 2026 4:03am

Request Review

@graphite-app

graphite-app Bot commented Jun 19, 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

@sid597 sid597 changed the base branch from main to eng-1847-define-shared-cross-app-node-content-contract June 19, 2026 08:44

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: add4831df7

ℹ️ 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".

Comment on lines +622 to +624
const fullContent = convertRoamNodeToFullContent({
nodes: roamNodes,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Backfill full content for already-synced nodes

The new full rows are only created for the roamNodes passed into this function. On the first sync after upgrading an existing graph, getAllMissingOrNewDiscourseNodes filters out nodes that already have any my_contents row plus a concept, without checking for variant = 'full', so nodes synced before this change are skipped and never get the required full variant until the Roam page is edited. Please include nodes missing the full content variant or run a one-time backfill before relying on this new contract.

Useful? React with 👍 / 👎.

nodes.flatMap((node) => {
try {
const title = node.node_title ?? node.text;
const blocks = getFullTreeByParentUid(node.source_local_id).children;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include the source block in block-backed full markdown

For node types backed by an Embedding Block Ref, getDiscourseNodeTypeWithSettingsBlockNodes sets source_local_id to the child block UID and stores that block's text in node.text; reading only .children here serializes descendants but drops the source block itself. A block-backed discourse node with no children now uploads # <page title> as its full content, and one with children still omits the actual claim/evidence text, so imported materializations are incomplete.

Useful? React with 👍 / 👎.

@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.

Open in Devin Review

Comment on lines +74 to +79
} catch (error) {
console.error(
`convertRoamNodeToFullContent: failed to build full markdown for ${node.source_local_id}:`,
error,
);
return [];

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.

🚩 Full content silently skipped on error doesn't propagate to caller

When getFullTreeByParentUid or toMarkdown throws for a specific node (line 74-79), the try/catch returns [], meaning that node silently won't have a full content variant uploaded. The contract (crossAppNodeContract.ts:28-31) declares both direct and full as required variants (SHARED_NODE_CONTENT_VARIANTS). If downstream importers strictly validate for the presence of both variants, nodes that failed full generation would appear incomplete. This graceful degradation is intentional per the error log, but worth noting for consumers.

Open in Devin Review

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

@sid597 sid597 force-pushed the eng-1848-add-roam-full-markdown-content-variant-for-shared-nodes branch from add4831 to 43646a5 Compare June 19, 2026 10:02
@sid597 sid597 changed the title Eng 1848 add roam full markdown content variant for shared nodes [ENG-1848] Add Roam full markdown content variant for shared nodes Jun 19, 2026
@sid597 sid597 force-pushed the eng-1848-add-roam-full-markdown-content-variant-for-shared-nodes branch from 43646a5 to b4f758c Compare June 19, 2026 16:37
@sid597 sid597 changed the base branch from eng-1847-define-shared-cross-app-node-content-contract to main June 19, 2026 16:39
Comment thread apps/roam/src/utils/syncDgNodesToSupabase.ts Outdated

sid597 commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator Author

Verification note for ENG-1848:

  • Built the Roam extension with local Supabase config: SUPABASE_USE_DB=local pnpm --filter roam build.
  • Copied the built bundle into /mnt/data/projects/dg-test-eng-1848/ and loaded that extension in Roam.
  • Smoke-tested against graph plugin-testing-akamatsulab2, page UID dnHNmYwe5 ([[CLM]] - Actin assembly peaks 8 seconds before endocytic scission).
  • The temporary guarded smoke hook wrote the full content row through the real Supabase upsert_content path, without embeddings, and read back:
[
  {
    "source_local_id": "dnHNmYwe5",
    "variant": "full",
    "text": "# [[CLM]] - Actin assembly peaks 8 seconds before endocytic scission\n\n- ## Source of Claim ..."
  }
]
  • The temporary smoke hook was committed for traceability in f29b4b9d and removed from the final tree in 430f0e2a; the copied final bundle was checked to ensure the debug globals/log strings are gone.
  • Final checks run: Prettier check, pnpm --filter roam check-types, and SUPABASE_USE_DB=local pnpm --filter roam build.

Open scope question from review: whether ENG-1848 should also backfill unchanged already-synced nodes that are missing variant = "full", or whether that belongs to ENG-1852/ENG-1854. I added that question to Linear ENG-1848 for product/implementation clarification.

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