Skip to content

Make document migrations position the nodes they add beside the node they replace - #4959

Merged
Keavon merged 5 commits into
masterfrom
migration-attribute-writes
Nov 18, 2026
Merged

Keavon merged 5 commits into
masterfrom
migration-attribute-writes

Conversation

@Keavon

@Keavon Keavon commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Document migrations now position added nodes on the node graph grid using only the replaced node's stored position: nodes along its input chain form a row to its left or join its layer's chain, and other added nodes feeding that path sit below their first reader when the replaced node has coordinates. A new &mut Attributes view, named after the document format's per-node editor data (positions, display names, layer flags, and so on, separate from node graph data attributes), lets migrations override positions or change names on the replacement and added nodes, which the 'Copy to Points' migration uses to clear its old default name while preserving other custom names.

@cubic-dev-ai cubic-dev-ai 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.

3 issues found across 17 files

Confidence score: 4/5

  • In document/migrations/runner/src/testing.rs, attribute() can create a node state that the Position docs say is invalid when ui::is_layer is set. Choose a valid position for layers.
  • In website/content/volunteer/guide/graphene/document-migrations.md, added is undefined in the snippet, so readers can't tell where the new node ID comes from. Show the add_node call that returns it.
  • In document/migrations/compiled/src/vary_nodes_from_copy_to_points.rs, the comment describes random scales and rotations, but the test uses fixed values. Update the comment to match.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="document/migrations/compiled/src/vary_nodes_from_copy_to_points.rs">

<violation number="1" location="document/migrations/compiled/src/vary_nodes_from_copy_to_points.rs:306">
P3: The doc comment says the copy uses random scales and rotations, but `placed_copies` passes fixed values (scale `2.`, rotation `90.`). Describe the fixed values so the comment matches the test.</violation>
</file>

<file name="website/content/volunteer/guide/graphene/document-migrations.md">

<violation number="1" location="website/content/volunteer/guide/graphene/document-migrations.md:212">
P3: `added` is never defined in this snippet, so readers can't tell where the new node's id comes from. Show the `add_node` call that returns it, such as `let added = upstream.add_node(NewNode { ... });`, or mention that the id comes from `add_node`.</violation>
</file>

<file name="document/migrations/runner/src/testing.rs">

<violation number="1" location="document/migrations/runner/src/testing.rs:297">
P3: `attribute()` can write `Position::Chain` to a node that also has `ui::is_layer` set, which the `Position` docs say is invalid. Make the position draw depend on the layer flag, for example by choosing `Absolute` or `Stack` for layers and `Absolute` or `Chain` otherwise, so generated histories stay within what the editor produces.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread document/migrations/core/src/view.rs Resolved
@Keavon Keavon changed the title Let node migrations place the nodes they add and reset stale names Allow node migrations to place the nodes they add and clear stale display names Nov 15, 2026
@Keavon
Keavon force-pushed the migration-attribute-writes branch from be87462 to 50350a1 Compare November 15, 2026 09:54
@Keavon Keavon changed the title Allow node migrations to place the nodes they add and clear stale display names Allow migrations to place added nodes and clear stale display names Nov 15, 2026
@Keavon
Keavon force-pushed the migration-attribute-writes branch from 50350a1 to fa9c36a Compare November 15, 2026 09:57
@Keavon

Keavon commented Nov 15, 2026 •

Copy link
Copy Markdown
Member Author

!build desktop (Run ID 43701858050)

@github-actions

Copy link
Copy Markdown
📦 Mac Build Complete for fa9c36a
Download binary

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
📦 Linux Build Complete for fa9c36a
Download binary
Download Flatpak

@github-actions

Copy link
Copy Markdown
📦 Windows Build Complete for fa9c36a
Download binary

@Keavon
Keavon force-pushed the migration-attribute-writes branch from fa9c36a to 82feb81 Compare November 15, 2026 10:14
@Keavon Keavon changed the title Allow migrations to place added nodes and clear stale display names Make document migrations position the nodes they add beside the node they replace Nov 15, 2026
@github-actions

Copy link
Copy Markdown

This PR's title is accepted as an admin set it. The review would otherwise have noted:

  • Its opening verb should say what the change does to the software, rather than something the software itself does or becomes able to do (like "Render").
  • It describes how the change works, rather than what users get from it.

Suggested titles:

Let document migrations place and name the nodes they add, and position them beside the node they replace
Add attribute writes to document migrations so added nodes are placed beside the node they replace

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

Comment thread document/format/src/migrate.rs Resolved

@TrueDoctor TrueDoctor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The first part of the pr which adds the attribute migration machinery looks good and I only made some minor changes pushed to migration-attribute-view. These can merge as is. For positions I don't think this is the right way of going about this since this forces every migration which adds nodes to use the graph which forces us use the corse grained interaction collapse migration style, as well as introducing lot's of delta churn by rewriting positions of upstream nodes. Since this migration happened before the switch to the new format, I don't think changing this past behaviour is super time critical so I'd like to try for 1 or two days to come up with a better positioning scheme which is more future ready

@Keavon

Keavon commented Nov 18, 2026

Copy link
Copy Markdown
Member Author

@cubic-dev-ai review

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review

@Keavon I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai 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.

All reported issues were addressed across 19 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread document/migrations/runner/src/node.rs Resolved
@Keavon
Keavon merged commit 48cf345 into master Nov 18, 2026
16 checks passed
@Keavon
Keavon deleted the migration-attribute-writes branch November 18, 2026 04:05

This branch was successfully deployed

1 active deployment
graphite-dev (Preview) — ab9cf2e5 Deployed Nov 18, 2026 by github-actions[bot]
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.

2 participants