Repository navigation
Conversation
📄 Knowledge reviewDosu skipped reviewing this PR because your organization has used its |
🎨 Storybook: 🚧 Building...🎭 Playwright: ⏳ Running... |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughVue node rendering now computes collapsed-aware paint order, preserves expanded dimensions while tracking collapsed visual bounds, synchronizes slot geometry during movement, and manages pointer-owned drag lifecycles with expanded regression coverage. ChangesVue node interaction behavior
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Pointer
participant useNodeDrag
participant WindowEvents
participant layoutStore
Pointer->>useNodeDrag: startDrag(nodeId, pointerId)
WindowEvents->>useNodeDrag: pointermove for active pointer
useNodeDrag->>layoutStore: update node positions
WindowEvents->>useNodeDrag: pointerup or pointercancel
useNodeDrag->>layoutStore: clear dragging state
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts (1)
169-202: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winFast-path "skip unchanged" check bypassed for collapsed nodes.
Since canonical
sizeis now preserved as the expanded size for collapsed nodes, the early-exit at L192-202 comparesnodeLayout.size(expanded) against the freshly measured collapsed DOM dimensions — this will essentially always differ, so collapsed nodes never benefit from the skip-check and always fall through to the more expensive bounds computation (still correctly deduped later viaisBoundsEqual(nodeLayout.bounds, ...)at L240, so no correctness issue — just wasted work every RO tick).♻️ Suggested fix
const hasMatchingCachedNodeMeasurement = previousMeasurement != null && previousMeasurement.nodeId === nodeId && nodeLayout != null && isBoundsEqual(previousMeasurement.bounds, nodeLayout.bounds) // ResizeObserver emits entries where nothing changed (e.g. initial observe). // Skip expensive DOM reads when this exact element/node already measured at // the same normalized bounds and size. if ( nodeLayout && !hasFreshMeasurementPending && - isSizeEqual(nodeLayout.size, { - width, - height: normalizedHeight - }) && + (isCollapsedNode + ? isSizeEqual( + { width: nodeLayout.bounds.width, height: nodeLayout.bounds.height }, + { width, height: normalizedHeight } + ) + : isSizeEqual(nodeLayout.size, { width, height: normalizedHeight })) && hasMatchingCachedNodeMeasurement ) { continue }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts` around lines 169 - 202, Update the unchanged-measurement fast path in the resize tracking logic around isSizeEqual so collapsed nodes compare against dimensions normalized to their canonical expanded size, rather than their collapsed DOM height. Preserve the existing behavior for non-collapsed nodes and retain hasMatchingCachedNodeMeasurement as a required guard before skipping expensive bounds work.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@browser_tests/fixtures/VueNodeHelpers.ts`:
- Around line 69-80: Update getNodeCenter and getNodePaintOrder to select the
first match from getNodeByTitle(title) before calling boundingBox() or
evaluate(). Match the existing getNodeIdByTitle pattern so duplicate titles do
not trigger strict-mode violations.
In `@browser_tests/tests/vueNodes/interactions/node/collapsedStacking.spec.ts`:
- Around line 23-35: Assert that the collapsed node extends beyond the computed
overlap click point before calling mouse.click, using collapsedBox.width and
overlap.x with at least a one-pixel margin. Add this precondition in the
collapsedStacking interaction flow after overlap is calculated, while preserving
the existing click and stacking assertions.
In `@browser_tests/tests/vueNodes/interactions/node/move.spec.ts`:
- Around line 209-221: Extract the duplicated empty-canvas scanning logic from
getEmptyCanvasPoint in
browser_tests/tests/vueNodes/interactions/node/move.spec.ts#L209-L221 into a
reusable helper under browser_tests/fixtures/, then import and use it in
move.spec.ts. Remove the inline emptyCanvasPoint evaluate block from
browser_tests/tests/vueNodes/interactions/node/collapsedStacking.spec.ts#L105-L115
and call the shared helper there, preserving the existing empty-point behavior.
In `@browser_tests/tests/vueNodes/interactions/node/resize.spec.ts`:
- Around line 164-171: Replace the synthetic
collapseButton.dispatchEvent('click') calls in the affected resize tests with
VueNodeFixture.toggleCollapse() (or the exposed collapseButton.click() action).
Apply this to all four occurrences while preserving the existing assertions and
test flow.
In `@src/lib/litegraph/src/LGraphNode.ts`:
- Around line 2158-2163: Update the collapsed Vue-mode branch in measure() so
out[3] uses at least LiteGraph.NODE_TITLE_HEIGHT when titleHeight is zero or
smaller, while preserving the existing titleHeight value for normal titled nodes
and leaving the collapsed width behavior unchanged.
In `@src/renderer/extensions/vueNodes/layout/useNodeDrag.ts`:
- Around line 241-256: Update capturePointer to use the element recorded by
startDrag as the drag-origin target instead of event.target, and only recapture
that stored element when pointer capture is lost. Preserve the existing
pointerId checks, releasePointerCapture call, delayed setPointerCapture
behavior, and capturedPointerTarget assignment while avoiding capture on
unrelated elements under the pointer.
---
Outside diff comments:
In `@src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts`:
- Around line 169-202: Update the unchanged-measurement fast path in the resize
tracking logic around isSizeEqual so collapsed nodes compare against dimensions
normalized to their canonical expanded size, rather than their collapsed DOM
height. Preserve the existing behavior for non-collapsed nodes and retain
hasMatchingCachedNodeMeasurement as a required guard before skipping expensive
bounds work.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f540bfd4-dd01-45bc-b5f9-458d173bbc66
📒 Files selected for processing (24)
browser_tests/assets/vueNodes/collapsed-stacking.jsonbrowser_tests/fixtures/VueNodeHelpers.tsbrowser_tests/tests/vueNodes/interactions/node/bringToFront.spec.tsbrowser_tests/tests/vueNodes/interactions/node/collapsedStacking.spec.tsbrowser_tests/tests/vueNodes/interactions/node/move.spec.tsbrowser_tests/tests/vueNodes/interactions/node/resize.spec.tssrc/components/graph/GraphCanvas.vuesrc/lib/litegraph/src/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/renderer/core/layout/store/layoutStore.test.tssrc/renderer/core/layout/store/layoutStore.tssrc/renderer/core/layout/types.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vuesrc/renderer/extensions/vueNodes/components/NodeHeader.vuesrc/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.tssrc/renderer/extensions/vueNodes/composables/useSlotElementTracking.tssrc/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.tssrc/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.tssrc/renderer/extensions/vueNodes/interactions/resize/resizeHandleConfig.tssrc/renderer/extensions/vueNodes/layout/useNodeDrag.test.tssrc/renderer/extensions/vueNodes/layout/useNodeDrag.tssrc/renderer/extensions/vueNodes/utils/nodePaintOrder.test.tssrc/renderer/extensions/vueNodes/utils/nodePaintOrder.ts
|
@coderabbitai review |
✅ Action performedReview finished.
|
e629dae to
aac8ee0
Compare
aac8ee0 to
e629dae
Compare
Collapses the twelve reviewed slices of the ECS migration into one commit so the series can be replayed onto main as a unit. Each slice kept its own review on GitHub: - ECS: Moving widgets out of the Node data (#13322) - ECS: Link topology store (single source of truth for link data) (#13436) - ECS: Reroute chain store with derived link membership (#13449) - ECS: derive slot floating links; reroute cleanup follow-ups (#13451) - refactor: read widgeted-input connectivity from linkStore (#13455) - feat: nodeBadgeStore + badge system (slice A) (#13458) - refactor: derive badge rows on read, delete the badge store (#13686) - refactor: host-scoped promoted widget rows (no source traversal) (#13434) - refactor!: delete the output.links runtime mirror (#13479) - refactor!: delete the input.link runtime mirror (#13498) - fix: ECS stack audit fixes (#13528) - refactor!: make nodeDataStore the source of truth for node shell state (#13963) Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> Amp-Thread-ID: https://ampcode.com/threads/T-019ff78d-80f9-73e1-986a-5e4abc9f9d6a
Split 2/6 of #14480. Stacked on #15001. Fixes cross-subgraph-definition topology contamination: `linkStore`/`rerouteStore` buckets were keyed only by root graph id, but every subgraph definition numbers links from 1 and shares the IO pseudo-node ids (−10/−20). Two definitions under one root therefore shared an origin index and reroute membership — one definition's links joined another definition's reroute chains, driving wrong reroute pruning on configure. Repro: `browser_tests/tests/subgraph/subgraphLinkIdentity.spec.ts` + fixture. Changes: - Adds `GraphScope` (`rootGraphId`, `owningGraphId`) and scopes topology queries, owner-local iteration, and teardown to the graph that directly owns each entity. Root-wide identity lookup remains keyed by `rootGraphId`. - Makes `linkStore`, `rerouteStore`, and `nodeDataStore` the authoritative collision boundaries. Registrations are first-wins; rejected entities remain detached and are not assigned to the requesting owner. - Shares link and reroute ID allocation across a root and its subgraphs. Serialized subgraphs are deduplicated before registration so link, reroute, node, widget, and promoted-widget references are remapped together. - Keeps endpoint swaps, rotations, and removals atomic within `linkStore`: an entire batch is validated before indexes or topology fields change. `LLink` retains the store-held reactive topology object across ID and endpoint updates. - Treats configure payloads as authoritative for their owner by clearing owner-local registrations before rebuilding them, with empty root-bucket pruning. - Derives topology scope from the directly owning graph at callers such as `NodeSlots.vue` and `useProcessedWidgets.ts`. - Positions promoted DOM widgets immediately on mount instead of waiting for a watched value to change. - Removes redundant graph-local collision checks, floating-link ID bookkeeping, unreachable tuple deduplication, obsolete compatibility types, and mock-only tests. - Documents root-vs-owner query guidance, topology transaction boundaries, and the deferred measurement of root-wide group scans before introducing another persistent index. Behavior notes: - Constructing or configuring an `LGraph` from serialized data requires an active Pinia because entities register with topology stores during deserialization. - Runtime duplicate IDs are rejected by the root-scoped store; persisted collisions are remapped before object registration. - Registration failures remain explicit return values and do not throw errors. --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: github-actions <github-actions@github.com>
Centralizes entity layout ownership and command submission on top of #15009's graph identity, collision, and teardown boundaries. Nodes, groups, and reroutes now hold instance-bound `{ graphId, id }` attachments. Only the attached instance can mutate canonical geometry; stale instances become inert without delete/recreate compensation. Changes: - Replaces ID-derived registration with `graphLayoutAttachment.ts`, covering attach, adopt, detach, geometry writes, and batched teardown. - Acquires reroute topology/map ownership before layout ownership, so collision losers cannot adopt incumbent geometry. - Centralizes group ID allocation at creation through the graph-state high-water mark. - Uses deep Yjs observation and emits geometry invalidation once per transaction, including group- and reroute-only changes. - Queues listener delivery after committed store writes, allowing nested observer mutations as ordinary follow-up transactions. - Requires mutation producers to supply `LayoutSource`; the store stamps its session actor at submission. DOM measurement conventions are explicit rather than ambient process state. - Narrows `useLayoutMutations` to its four production behaviors and removes redundant command `entity`, operation ID, and apply-result fields. - Makes node layout refs read-only and updates migration documentation to match the command/attachment boundary. Review focus: - Attachment lifetime and stale-instance isolation in `graphLayoutAttachment.ts`. - Root versus partial-subgraph teardown through #15009's centralized lifecycle. - Topology-before-layout ordering in `_addReroute`. - Explicit source/measurement semantics at mutation call sites. - Transaction and notification timing in `layoutStore.ts`. Validation: - Full GitHub CI passed, including unit tests, all Playwright shards, type/lint/format checks, Storybook, and performance tests. - The branch is net −170 lines against `feature/ecs-migration`. --------- Co-authored-by: Amp <amp@ampcode.com>
Retargeted squash: resize gestures write intent to the store, node size binds from the store instead of imperative CSS var writes, DOM measurement stays out of the replicated document, and the collapse-save width-loss repro lands as e2e coverage. Amends ADR 0003 accordingly.
07147ba to
e79eaa7
Compare
There was a problem hiding this comment.
Pull request overview
Ports collapsed-node paint ordering and stable drag ownership into the Vue-nodes ECS layout architecture, ensuring stacking/hit-testing changes don’t require DOM remounts while keeping drag pointer ownership deterministic under selection promotion and capture loss.
Changes:
- Introduces a computed paint-order pipeline (tiering by collapsed/selected + z-index ordering) and applies it via per-node
z-indexwithout reordering the DOM. - Refactors Vue node dragging to maintain a single drag owner and pointer ID across window-level pointer events (move/up/cancel), including lost capture recovery and cleanup.
- Separates requested (replicated) node size from measured (view-scoped) content size, with updated resize + geometry plumbing and regression coverage (Vitest + Playwright).
Reviewed changes
Copilot reviewed 33 out of 33 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/renderer/extensions/vueNodes/utils/nodePaintOrder.ts | New utility to compute stable paint order across tiers and z-index. |
| src/renderer/extensions/vueNodes/utils/nodePaintOrder.test.ts | Unit tests for paint-order tiering, z-index stability, and missing layouts. |
| src/renderer/extensions/vueNodes/layout/useNodeDrag.ts | Drag ownership + pointer capture refactor with window-level event handling. |
| src/renderer/extensions/vueNodes/layout/useNodeDrag.test.ts | Expanded unit coverage for drag ownership, capture loss, cancel, and cleanup. |
| src/renderer/extensions/vueNodes/interactions/resize/useNodeResize.ts | Adds resize lifecycle callbacks and pointercancel handling path. |
| src/renderer/extensions/vueNodes/interactions/resize/useNodeResize.test.ts | Tests lifecycle callbacks and pointercancel end behavior. |
| src/renderer/extensions/vueNodes/interactions/resize/resizeHandleConfig.ts | Adjusts resize-handle positioning classes for hit-testing/overlap behavior. |
| src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.ts | Switches from writing replicated bounds to reporting view-scoped content size. |
| src/renderer/extensions/vueNodes/composables/useVueNodeResizeTracking.test.ts | Updates expectations to validate reportContentSize calls. |
| src/renderer/extensions/vueNodes/composables/useSlotElementTracking.ts | Improves slot geometry translation via cached offsets; drops stale layouts when needed. |
| src/renderer/extensions/vueNodes/composables/useSlotElementTracking.test.ts | Adds coverage for translating slot geometry during node/group moves and collapsed behavior. |
| src/renderer/extensions/vueNodes/composables/useNodePointerInteractions.ts | Updates drag/end-drag calls to new drag API (nodeId now owned by drag state). |
| src/renderer/extensions/vueNodes/components/LGraphNode.vue | Applies computed paint order, modernizes size styling, and routes resize through ECS mutations with lifecycle hooks. |
| src/renderer/extensions/vueNodes/components/LGraphNode.test.ts | Updates collapsed/expanded size-var expectations and collapsed render assertions. |
| src/renderer/core/layout/store/layoutStore.ts | Adds view-scoped contentSizes storage and lifecycle clearing hooks. |
| src/renderer/core/layout/store/layoutStore.test.ts | Verifies graph scoping clears content size for the removed graph only. |
| src/renderer/core/layout/store/mocks/layoutStore.ts | Extends mock with contentSizeOf for LiteGraph geometry reads. |
| src/renderer/core/layout/operations/layoutMutations.ts | Adds resizeNode mutation helper. |
| src/renderer/core/layout/operations/layoutMutations.test.ts | Tests resizeNode updates layout store size. |
| src/lib/litegraph/src/LGraphNode.widgetOrder.test.ts | Adds coverage for ignoring inherited named widget values during restore. |
| src/lib/litegraph/src/LGraphNode.ts | Splits requested vs rendered size, consumes view-scoped content size, tightens widget restore + serialization behavior. |
| src/lib/litegraph/src/LGraphNode.test.ts | Expands tests for dense widget serialization, content-size geometry, and Vue-mode collapsed measurement behavior. |
| src/components/graph/GraphCanvas.vue | Computes per-node paint order and passes it down to Vue nodes. |
| docs/adr/0003-crdt-based-layout-system.md | Documents the “intent vs measurement” amendment and the view-scoped measurement decision. |
| browser_tests/tests/vueNodes/nodeStates/collapse.spec.ts | E2E regression: resized width survives collapse + save + reload. |
| browser_tests/tests/vueNodes/interactions/node/resize.spec.ts | E2E regression: resized width survives save + reload; validates resize-handle hit bounds; strengthens min-width assertion source. |
| browser_tests/tests/vueNodes/interactions/node/move.spec.ts | E2E coverage for lost pointer capture drag ownership + link geometry stability on collapsed/group moves. |
| browser_tests/tests/vueNodes/interactions/node/collapsedStacking.spec.ts | New E2E coverage for collapsed stacking hit order + drag ownership after selection promotion. |
| browser_tests/tests/vueNodes/interactions/node/bringToFront.spec.ts | Uses shared helper assertions for paint ordering instead of parsing inline styles. |
| browser_tests/fixtures/VueNodeHelpers.ts | Adds helpers to measure paint order and assert relative stacking. |
| browser_tests/fixtures/utils/vueNodeFixtures.ts | Adjusts resize start points (esp. NW) to match updated handle geometry. |
| browser_tests/fixtures/utils/findEmptyCanvasPoint.ts | New helper to locate empty canvas coordinates for reliable drag-release points. |
| browser_tests/assets/vueNodes/collapsed-stacking.json | New workflow fixture for stacking/overlap test coverage. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| /** Size the DOM made of this node, if it has been measured. */ | ||
| contentSizeOf(rootGraphId: UUID, nodeId: NodeId): Size | undefined { | ||
| return this.contentSizes.get(makeScopedLayoutKey(rootGraphId, nodeId)) | ||
| } | ||
|
|
||
| /** | ||
| * Records what the DOM made of a node. Local and view-scoped: a measurement | ||
| * is not replayable on a peer whose fonts, locale or custom nodes differ, so | ||
| * it never enters the replicated document (ADR 0003, 2026-08-04). | ||
| */ | ||
| reportContentSize(rootGraphId: UUID, nodeId: NodeId, size: Size): void { | ||
| this.contentSizes.set(makeScopedLayoutKey(rootGraphId, nodeId), size) | ||
| } |
ef435ab to
20cd48c
Compare
Depends on: #14258.
Summary
Port collapsed-node paint ordering and stable drag ownership onto the ECS graph and layout stores.
Changes
Review Focus
Testing
e79eaa7ff017a29e114a750b8f9f154822540986.pnpm typecheck,pnpm typecheck:browser,pnpm lint,pnpm knip,pnpm format:check, andpnpm buildpassed.5359edb45d4c69e53599a276c9490db1c7ddf4d0.git diff --checkpassed.