fix(autolayout): rescue new notes from blocks they were created on top of - #6680
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview
The copilot edit-workflow tool and the client diff engine pass the pre-edit state they already use for diffs ( Reviewed by Cursor Bugbot for commit 474fa94. Bugbot is set up for automated code reviews on this repo. Configure here. |
Greptile SummaryThe PR corrects targeted autolayout’s note-overlap baseline so newly created notes can be moved away from underlying blocks while intentional existing arrangements remain intact.
Confidence Score: 5/5The PR appears safe to merge, with no actionable correctness or security defects identified. The supplied snapshots remain distinct from the cloned edited state, and both changed integration paths provide complete baselines that support the intended new-note and pre-existing-note behavior.
|
| Filename | Overview |
|---|---|
| apps/sim/lib/workflows/autolayout/targeted.ts | Introduces the optional pre-edit snapshot and forwards it to note-overlap resolution without changing legacy caller behavior. |
| apps/sim/lib/copilot/tools/server/workflow/edit-workflow/index.ts | Passes the unmodified workflow input as the baseline when laying out Copilot-generated edits. |
| apps/sim/lib/workflows/diff/diff-engine.ts | Uses the diff engine’s comparison baseline for overlap classification so preview and accepted positions remain consistent. |
| apps/sim/lib/workflows/autolayout/targeted.test.ts | Covers relocation of a newly created note and preservation of an existing intentional arrangement. |
Sequence Diagram
sequenceDiagram
participant Edit as Workflow edit
participant Before as Pre-edit blocks
participant Layout as Targeted layout
participant Rescue as Note-overlap rescue
Edit->>Before: Capture existing workflow state
Edit->>Layout: Submit edited blocks and previousBlocks
Layout->>Rescue: Compare resulting overlaps with previousBlocks
alt Note absent or overlap newly introduced
Rescue-->>Layout: Relocate note below flow
else Overlap existed before edit
Rescue-->>Layout: Preserve note position
end
Reviews (1): Last reviewed commit: "fix(autolayout): rescue new notes from b..." | Re-trigger Greptile
Summary
(0,0)placeholder. A copilot-added note on a fresh workflow therefore "pre-existed" its overlap with the start block (also at(0,0)) and was preserved as intentional, shipping on top of the start node.applyTargetedLayoutnow takes an optionalpreviousBlocks(pre-edit snapshot) and uses it as the rescue baseline; a note absent from that snapshot is always eligible for relocation. Defaults to the old behavior when not passed.Type of Change
Testing
Checklist
🤖 Generated with Claude Code