Skip to content

ENG-1138 Migrate canvas shape node type to discourse-node#894

Open
mdroidian wants to merge 4 commits into
mainfrom
eng-1138-migrate-canvas-shape-node-type-to-discourse-node
Open

ENG-1138 Migrate canvas shape node type to discourse-node#894
mdroidian wants to merge 4 commits into
mainfrom
eng-1138-migrate-canvas-shape-node-type-to-discourse-node

Conversation

@mdroidian

@mdroidian mdroidian commented Mar 16, 2026

Copy link
Copy Markdown
Member
  • Open an existing Roam canvas created before this change that already contains discourse nodes.
  • Confirm the canvas loads without migration errors or unknown-shape errors.
  • Confirm old discourse nodes still render with the right title, color, and image behavior.
  • Edit an existing migrated discourse node and save it successfully.
  • Create a brand new discourse node from the canvas toolbar for at least two different node types.
  • Confirm both new nodes behave correctly even though they now share the same TL shape type.
  • Create a relation between valid node types and confirm the arrow renders and binds correctly.
  • Attempt an invalid relation connection and confirm the warning/validation still works.
  • Paste [[Page]] into the canvas and confirm it creates a discourse node correctly.
  • Paste ((block-uid)) into the canvas and confirm it creates a discourse node correctly.
  • Use the query builder canvas insertion flow and confirm inserted nodes appear correctly.
  • Drag a node from the Clipboard panel onto the canvas and confirm it creates correctly.
  • Use Convert To from a text shape and confirm the created discourse node works correctly.
  • Reload a canvas containing newly created discourse nodes and confirm they persist and reload correctly.
  • Load a canvas where a node title changed in Roam and confirm the canvas title sync still works.
  • Load a canvas where a referenced node was deleted and confirm the stale node and attached relations are cleaned up.
  • With auto canvas relations enabled, create or edit a node that should auto-create relations and confirm no duplicate-loop or update-cascade behavior appears.
  • If cloud sync is used, open a synced canvas with older discourse nodes and confirm the canvas still loads.
  • If cloud sync is used, create or edit a discourse node on one client and confirm another client/session sees the update.
  • Test a canvas from the beta version
  • Delete a node type and load a canvas with said node type

Open with Devin

Summary by CodeRabbit

  • Refactor
    • Standardized node shape management throughout the canvas system by introducing a unified shape type constant and explicit node type identifier storage in shape properties, improving consistency and maintainability of shape operations.

@linear

linear Bot commented Mar 16, 2026

Copy link
Copy Markdown

@supabase

This comment was marked as outdated.

@mdroidian

Copy link
Copy Markdown
Member Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Mar 16, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Full review triggered.

devin-ai-integration[bot]

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

@mdroidian mdroidian force-pushed the eng-1138-migrate-canvas-shape-node-type-to-discourse-node branch 2 times, most recently from 458bbb7 to a6091e9 Compare May 18, 2026 03:57
- Replaced the use of createNodeShapeUtils with DiscourseNodeUtil across components to streamline discourse node management.
- Introduced DISCOURSE_NODE_SHAPE_TYPE constant for consistent node type identification.
- Updated various components to utilize nodeTypeId for better clarity and functionality in shape creation and manipulation.
- Enhanced migration logic to accommodate new node type structure, ensuring backward compatibility and improved data integrity.

This refactor improves the maintainability and readability of the codebase while ensuring that new features can be integrated more seamlessly.
@mdroidian mdroidian force-pushed the eng-1138-migrate-canvas-shape-node-type-to-discourse-node branch from a6091e9 to 1397ce2 Compare June 18, 2026 09:53
@vercel

vercel Bot commented Jun 18, 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 18, 2026 9:53am

Request Review

@mdroidian

Copy link
Copy Markdown
Member Author

@codex review

@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: 1397ce23c3

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

return (
getRecordTypeName(r) === "shape" &&
!!recordType &&
allNodeTypes.includes(recordType)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid migrating relation arrows that share node ids

When a relation is also exposed as an anchor-backed node, getDiscourseNodes adds a node whose type is the relation id, so allNodeTypes can contain relation shape types too. This filter then matches existing relation arrow records as if they were legacy node records, and the up step changes those arrows to discourse-node, corrupting canvases for those configurations on migration; the filter should distinguish node records by their node props or exclude relation shape ids.

Useful? React with 👍 / 👎.

}: TLShapeUtilCanBindOpts<DiscourseRelationShape>): boolean {
// bindings can go from arrows to shapes, but not from shapes to arrows
return toShapeType !== "arrow";
return toShapeType === DISCOURSE_NODE_SHAPE_TYPE;

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 Keep legacy node types bindable

The Cloudflare adapter still registers legacy node-id shape utils for rooms that stream pre-migration records, but this predicate rejects any target whose shape type is still a node id such as page-node or a custom node UID. In those rooms, drawing a relation to a legacy node will not create the binding, and dragging an existing endpoint over the same legacy node can remove the binding because editor.canBindShapes returns false; allow legacy discourse node types here as well as discourse-node.

Useful? React with 👍 / 👎.

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