Repository navigation
Conversation
|
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:
📝 WalkthroughWalkthroughBridges LiteGraph subgraph IO drags into the Vue slot-drag UI via a new composable, adds Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant LinkConnector
participant Bridge as useSubgraphDragBridge
participant Adapter
participant PointerTracker
participant CandidateResolver
participant SubgraphIO
User->>LinkConnector: dragNewFromSubgraphInput()
LinkConnector->>LinkConnector: _setLegacyLinks(...)
LinkConnector->>Bridge: emit "connecting" {connectingTo}
Bridge->>Adapter: build adapter from renderLinks
Bridge->>Bridge: beginDrag() (Vue state)
Bridge->>PointerTracker: start pointer tracking (RAF)
User->>PointerTracker: pointermove
PointerTracker->>CandidateResolver: resolve hovered slot/node
CandidateResolver->>Bridge: update candidate & compatibility
Bridge->>Adapter: set snapLinksPos & highlight
User->>LinkConnector: release on canvas
LinkConnector->>Bridge: emit "before-drop-on-canvas"(CanvasPointerEvent)
alt Bridge connects to candidate
Bridge->>Adapter: connectToCandidate()
Adapter->>SubgraphIO: connect render links -> target IO
SubgraphIO->>SubgraphIO: trigger "node:slot-links:changed" (widget only)
Bridge->>LinkConnector: event.preventDefault()
else
LinkConnector->>LinkConnector: emit "dropped-on-canvas" & disconnectLinks()
end
LinkConnector->>Bridge: emit "reset"
Bridge->>PointerTracker: stop tracking
Bridge->>Bridge: endDrag() (clear Vue state)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
🎭 Playwright: ⏳ Running... |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts (1)
391-415: Consider creating a minimal event object rather than casting.The partial event object
{ canvasX, canvasY } as CanvasPointerEventrelies ononPointerMoveonly using those two properties. IfonPointerMoveis later extended to use otherCanvasPointerEventproperties, this cast will silently provideundefinedvalues.♻️ Optional: Create a more explicit minimal event
If the
onPointerMovemethod signature can be narrowed to only require coordinates, consider defining a separate type:interface PointerMoveCoords { canvasX: number canvasY: number }Otherwise, this cast is acceptable for the current use case where only canvas coordinates are needed.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts` around lines 391 - 415, The current code in useSlotLinkInteraction.ts creates a partial event via "{ canvasX, canvasY } as CanvasPointerEvent" and casts it which can mask missing properties; replace this cast with a minimal explicit type or small interface used by node.onPointerMove: either define a new interface (e.g. PointerMoveCoords { canvasX: number; canvasY: number }) and pass that object, or adjust the onPointerMove overload to accept that minimal type, then create pointerEvent: PointerMoveCoords = { canvasX, canvasY } and pass it to node.onPointerMove instead of casting to CanvasPointerEvent to avoid silent undefineds if the full event gains more fields later.src/renderer/core/canvas/links/useSubgraphDragBridge.ts (1)
273-293: Verify DOM structure assumption for snap highlight.The code assumes that
entry?.el?.parentElementis the element with thegroup/slotclass. Per context snippet 2, the dot element is wrapped in a parent div with classgroup/slot. If the DOM structure ever changes, the highlight class would be applied to the wrong element.Consider adding a defensive check or using a more explicit selector:
💡 Defensive approach (optional)
- const groupEl = entry?.el?.parentElement + const groupEl = entry?.el?.closest('.group\\/slot') ?? entry?.el?.parentElement if (groupEl) {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/core/canvas/links/useSubgraphDragBridge.ts` around lines 273 - 293, The updateSnapTargetHighlight function currently assumes entry?.el?.parentElement is the correct group/slot element and may apply SNAP_CLASS to the wrong element if DOM changes; update it to verify and find the correct slot container (e.g., check parentElement.classList.contains('lg-slot' or the expected class) or use entry.el.closest('.lg-slot')/a specific selector) before adding SNAP_CLASS, fall back safely if not found, and ensure highlightedSlotEl is only set to an element that passes this check; reference updateSnapTargetHighlight, highlightedSlotEl, slotRegistry, entry.el, SNAP_CLASS and getSlotKey when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/renderer/core/canvas/links/useSubgraphDragBridge.ts`:
- Around line 273-293: The updateSnapTargetHighlight function currently assumes
entry?.el?.parentElement is the correct group/slot element and may apply
SNAP_CLASS to the wrong element if DOM changes; update it to verify and find the
correct slot container (e.g., check parentElement.classList.contains('lg-slot'
or the expected class) or use entry.el.closest('.lg-slot')/a specific selector)
before adding SNAP_CLASS, fall back safely if not found, and ensure
highlightedSlotEl is only set to an element that passes this check; reference
updateSnapTargetHighlight, highlightedSlotEl, slotRegistry, entry.el, SNAP_CLASS
and getSlotKey when making the change.
In `@src/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts`:
- Around line 391-415: The current code in useSlotLinkInteraction.ts creates a
partial event via "{ canvasX, canvasY } as CanvasPointerEvent" and casts it
which can mask missing properties; replace this cast with a minimal explicit
type or small interface used by node.onPointerMove: either define a new
interface (e.g. PointerMoveCoords { canvasX: number; canvasY: number }) and pass
that object, or adjust the onPointerMove overload to accept that minimal type,
then create pointerEvent: PointerMoveCoords = { canvasX, canvasY } and pass it
to node.onPointerMove instead of casting to CanvasPointerEvent to avoid silent
undefineds if the full event gains more fields later.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4308ad5d-0067-450d-b1f3-41081cf6b6ad
📒 Files selected for processing (11)
src/components/graph/GraphCanvas.vuesrc/lib/litegraph/src/canvas/LinkConnector.tssrc/lib/litegraph/src/canvas/LinkConnectorDropEvents.test.tssrc/lib/litegraph/src/infrastructure/LinkConnectorEventMap.tssrc/lib/litegraph/src/subgraph/SubgraphIOSlotLinks.test.tssrc/lib/litegraph/src/subgraph/SubgraphInput.tssrc/lib/litegraph/src/subgraph/SubgraphInputNode.tssrc/renderer/core/canvas/links/linkConnectorAdapter.tssrc/renderer/core/canvas/links/useSubgraphDragBridge.tssrc/renderer/extensions/vueNodes/components/SlotConnectionDot.vuesrc/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts
💤 Files with no reviewable changes (1)
- src/renderer/core/canvas/links/linkConnectorAdapter.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
browser_tests/tests/subgraphIODragFeedback.spec.ts (1)
17-46: Prefer a premade workflow fixture instead of inline subgraph JSON.The large inline graph payload increases maintenance cost and brittleness in E2E tests; using a shared workflow asset would keep this test focused on behavior.
As per coding guidelines: "Use premade JSON workflows in the
assets/directory to load desired graph state in E2E tests."🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@browser_tests/tests/subgraphIODragFeedback.spec.ts` around lines 17 - 46, Replace the inline subgraph JSON assigned to subgraphData with loading a premade workflow fixture from the shared assets directory (e.g., use the existing JSON under assets/ that represents the same "Drag Test Subgraph"); ensure the test now imports/reads that fixture and uses its object in place of the current subgraphData (keeping required properties like id, name, inputNode/outputNode, nodes, links, etc.), and remove the inline literal to keep the spec focused on behavior and aligned with the E2E fixture convention.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Around line 88-113: The test currently fakes the behavior by calling
canvas.linkConnector.events.dispatch('connecting', ...) — replace that with an
actual drag simulation so the LinkConnector's emission is exercised: add a
listener to canvas.linkConnector.events as shown, then programmatically simulate
a real drag from a source subgraph IO DOM element to a target IO (e.g., find the
source element via canvas.getIOElement or canvas.querySelector on the canvas
nodes), dispatch a pointerdown/mousedown on the source, pointermove to the
target, and pointerup to finish the drag (or call the connector's public
start/handle-drag API if there is one such as
canvas.linkConnector.startDrag/startLinkDrag), and assert connectingFired and
connectingTo come from that actual interaction rather than from directly calling
events.dispatch.
---
Nitpick comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Around line 17-46: Replace the inline subgraph JSON assigned to subgraphData
with loading a premade workflow fixture from the shared assets directory (e.g.,
use the existing JSON under assets/ that represents the same "Drag Test
Subgraph"); ensure the test now imports/reads that fixture and uses its object
in place of the current subgraphData (keeping required properties like id, name,
inputNode/outputNode, nodes, links, etc.), and remove the inline literal to keep
the spec focused on behavior and aligned with the E2E fixture convention.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c7a817ea-18d2-4284-9717-a1c98d838f37
📒 Files selected for processing (3)
browser_tests/tests/subgraphIODragFeedback.spec.tssrc/lib/litegraph/src/infrastructure/LinkConnectorEventMap.tssrc/renderer/core/canvas/links/useSubgraphDragBridge.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Around line 115-134: The test adds a persistent event listener via
canvas.linkConnector.events.addEventListener('connecting', ...) but never
removes it, causing cross-test leakage; capture the listener callback in a const
(the function currently passed inline) and call
canvas.linkConnector.events.removeEventListener('connecting', thatCallback)
after the drag/cleanup (e.g., after canvas.linkConnector.reset()) or unregister
it in a finally block so the handler is always removed; key symbols:
canvas.linkConnector.events.addEventListener, 'connecting', the inline callback
that sets connectingFired/connectingTo, canvas.linkConnector.reset(), and
canvas.linkConnector.events.removeEventListener.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: cac80bfa-e483-4dbd-ac78-29bef18e08de
📒 Files selected for processing (1)
browser_tests/tests/subgraphIODragFeedback.spec.ts
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
browser_tests/tests/subgraphIODragFeedback.spec.ts (1)
120-125:⚠️ Potential issue | 🟡 MinorRegister the
connectinglistener after the slot guard.Line 120 attaches the listener before the null check at Line 124.
IfinputSlotis missing, the early return skips cleanup and leaves the
handler attached for the rest of the page lifecycle.🔧 Suggested change
- canvas.linkConnector.events.addEventListener('connecting', onConnecting) - - // Trigger an actual drag from the subgraph input node const inputSlot = subgraph.inputNode.slots[0] if (!inputSlot) return { error: 'No input slot' } + canvas.linkConnector.events.addEventListener('connecting', onConnecting) + + // Trigger an actual drag from the subgraph input node🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@browser_tests/tests/subgraphIODragFeedback.spec.ts` around lines 120 - 125, Move the connecting event registration so it only runs when an input slot exists: perform the inputSlot guard first (check subgraph.inputNode.slots[0]) and then call canvas.linkConnector.events.addEventListener('connecting', onConnecting); this prevents attaching the handler when you early-return, and ensure any existing cleanup/unsubscribe logic still runs (keep the onConnecting reference and existing removal code unchanged).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Line 104: Replace the non-idiomatic `as never` casts by declaring a small
test-local interface (e.g., TestBrowserRuntime or TestCanvasRuntime) that
matches the minimal shape needed by the browser runtime calls, then cast the
runtime objects once using `as unknown as TestBrowserRuntime` when passed into
canvas.openSubgraph; update the other occurrences referencing sgNode.subgraph
and sgNode (the calls around lines 127–131) to use the same test-local interface
cast instead of `as never` so all runtime arguments are cast consistently and
clearly.
---
Duplicate comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Around line 120-125: Move the connecting event registration so it only runs
when an input slot exists: perform the inputSlot guard first (check
subgraph.inputNode.slots[0]) and then call
canvas.linkConnector.events.addEventListener('connecting', onConnecting); this
prevents attaching the handler when you early-return, and ensure any existing
cleanup/unsubscribe logic still runs (keep the onConnecting reference and
existing removal code unchanged).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: dc465455-aeb3-4171-964b-74365a60c353
📒 Files selected for processing (1)
browser_tests/tests/subgraphIODragFeedback.spec.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Around line 53-60: The test monkeypatches subgraph.trigger (origTrigger =
subgraph.trigger) but never restores it; wrap the override and assertion
sequence in a try/finally so the original function is always restored in the
finally block (restore subgraph.trigger = origTrigger), ensuring
eventFired/eventConnected logic runs inside the try and the finally resets
subgraph.trigger even on assertion failures; apply the same pattern to the other
override occurrences around lines referencing subgraph.trigger, origTrigger,
eventFired, and eventConnected.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 775b1297-15a2-42a8-b6a4-d014fa673cc8
📒 Files selected for processing (1)
browser_tests/tests/subgraphIODragFeedback.spec.ts
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Around line 131-149: The event listener is registered before the inputSlot
early-return guard, so if inputSlot is missing the removeEventListener and
canvas.linkConnector.reset() in the finally block are skipped; fix by validating
the slot before calling canvas.linkConnector.events.addEventListener (i.e., move
the inputSlot check above the addEventListener call) or by wrapping the
registration and the inputSlot check inside the try block so that the finally
always runs; reference canvas.linkConnector.events.addEventListener,
canvas.linkConnector.dragNewFromSubgraphInput,
canvas.linkConnector.events.removeEventListener, canvas.linkConnector.reset, and
the inputSlot guard when making the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c53050e6-f8c2-42d6-a75f-9ce556a54d26
📒 Files selected for processing (1)
browser_tests/tests/subgraphIODragFeedback.spec.ts
|
@christian-byrne I took this PR back over since I think you and @DrJKL are busy getting E2E regression testing re-enabled. Updated it with your cherry-picked commits and modernized with the latest main. I just tested locally and it still looks good |
997508d to
314f5dd
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/litegraph/src/canvas/LinkConnector.ts (1)
448-470:⚠️ Potential issue | 🟠 MajorEmit
connectingfor subgraph IO reconnects too.These dispatches only cover fresh drags.
useSubgraphDragBridge()enters bridge mode exclusively fromconnecting, but the existing-link subgraph IO paths inmoveInputLink()/moveOutputLink()createToInputFromIoNodeLink/ToOutputFromIoNodeLinkwithout ever emitting it. Re-dragging an already-connected subgraph IO will still skip the dimming, snap, and drop-to-connect feedback.Possible follow-up
@@ state.connectingTo = 'input' state.draggingExistingLinks = true this._setLegacyLinks(false) + if (renderLinks.some((link) => link instanceof ToInputFromIoNodeLink)) { + this.events.dispatch('connecting', { connectingTo: 'input' }) + } @@ state.draggingExistingLinks = true state.multi = true state.connectingTo = 'output' this._setLegacyLinks(true) + if (renderLinks.some((link) => link instanceof ToOutputFromIoNodeLink)) { + this.events.dispatch('connecting', { connectingTo: 'output' }) + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/lib/litegraph/src/canvas/LinkConnector.ts` around lines 448 - 470, The reconnect paths that create ToInputFromIoNodeLink and ToOutputFromIoNodeLink inside moveInputLink() and moveOutputLink() never emit the 'connecting' event, so useSubgraphDragBridge() isn't entered for re-drags; update those code paths to set this.state.connectingTo to 'input' or 'output' as appropriate and call this._setLegacyLinks(true) followed by this.events.dispatch('connecting', { connectingTo: 'input' }) or { connectingTo: 'output' } (mirror what dragNewFromSubgraphOutput does) when creating the ToInputFromIoNodeLink / ToOutputFromIoNodeLink so the UI dimming/snap/drop-to-connect feedback is triggered.
♻️ Duplicate comments (1)
browser_tests/tests/subgraphIODragFeedback.spec.ts (1)
88-156:⚠️ Potential issue | 🟡 MinorDrive a real drag here instead of calling
dragNewFromSubgraphInput()directly.This still bypasses the user path. The test will pass even if pointer hit-testing or the canvas↔Vue bridge wiring regresses again, because it invokes the same method that now dispatches the event.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@browser_tests/tests/subgraphIODragFeedback.spec.ts` around lines 88 - 156, The test is calling canvas.linkConnector.dragNewFromSubgraphInput directly which bypasses the real user path; replace that call with a simulated pointer drag on the slot's DOM element so hit-testing and canvas↔Vue wiring are exercised. In the test body (inside the page.evaluate or by using comfyPage.page), locate the input slot's DOM node (e.g., via a property like inputSlot.domElement or querying the canvas for a selector/data attribute on the slot), dispatch a pointerdown on that node, dispatch one or more pointermove events to a different canvas location, then dispatch pointerup to finish the drag; keep the existing connecting event listener on canvas.linkConnector.events and remove the direct call to dragNewFromSubgraphInput to assert connectingFired and connectingTo as before. Ensure events are fired on the real DOM element (use page.mouse or element.dispatchEvent inside evaluate) and clean up by removing the listener and resetting linkConnector.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/renderer/core/canvas/links/useSubgraphDragBridge.ts`:
- Around line 111-126: Flush the RAF-batched hover update before reading
dragState.candidate in onBeforeDropOnCanvas: add a synchronous flush call
(exposed from startPointerTracking that runs processFrame() immediately) at the
start of onBeforeDropOnCanvas so dragState.candidate is up-to-date before the
compatibility check; similarly add the same flush call in the other drop/finish
handlers that read dragState.candidate (the region referenced by lines 176-303)
to eliminate the frame-timing race. Ensure you reference and call the flush API
you expose from startPointerTracking() and keep existing early-return checks
(isBridgeDrag, candidate?.compatible) intact.
---
Outside diff comments:
In `@src/lib/litegraph/src/canvas/LinkConnector.ts`:
- Around line 448-470: The reconnect paths that create ToInputFromIoNodeLink and
ToOutputFromIoNodeLink inside moveInputLink() and moveOutputLink() never emit
the 'connecting' event, so useSubgraphDragBridge() isn't entered for re-drags;
update those code paths to set this.state.connectingTo to 'input' or 'output' as
appropriate and call this._setLegacyLinks(true) followed by
this.events.dispatch('connecting', { connectingTo: 'input' }) or { connectingTo:
'output' } (mirror what dragNewFromSubgraphOutput does) when creating the
ToInputFromIoNodeLink / ToOutputFromIoNodeLink so the UI
dimming/snap/drop-to-connect feedback is triggered.
---
Duplicate comments:
In `@browser_tests/tests/subgraphIODragFeedback.spec.ts`:
- Around line 88-156: The test is calling
canvas.linkConnector.dragNewFromSubgraphInput directly which bypasses the real
user path; replace that call with a simulated pointer drag on the slot's DOM
element so hit-testing and canvas↔Vue wiring are exercised. In the test body
(inside the page.evaluate or by using comfyPage.page), locate the input slot's
DOM node (e.g., via a property like inputSlot.domElement or querying the canvas
for a selector/data attribute on the slot), dispatch a pointerdown on that node,
dispatch one or more pointermove events to a different canvas location, then
dispatch pointerup to finish the drag; keep the existing connecting event
listener on canvas.linkConnector.events and remove the direct call to
dragNewFromSubgraphInput to assert connectingFired and connectingTo as before.
Ensure events are fired on the real DOM element (use page.mouse or
element.dispatchEvent inside evaluate) and clean up by removing the listener and
resetting linkConnector.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 613058ea-dea1-4196-85d1-0a2cd8a644ed
📒 Files selected for processing (13)
browser_tests/tests/subgraphIODragFeedback.spec.tsknip.config.tssrc/components/graph/GraphCanvas.vuesrc/lib/litegraph/src/canvas/LinkConnector.tssrc/lib/litegraph/src/canvas/LinkConnectorDropEvents.test.tssrc/lib/litegraph/src/infrastructure/LinkConnectorEventMap.tssrc/lib/litegraph/src/subgraph/SubgraphIOSlotLinks.test.tssrc/lib/litegraph/src/subgraph/SubgraphInput.tssrc/lib/litegraph/src/subgraph/SubgraphInputNode.tssrc/renderer/core/canvas/links/linkConnectorAdapter.tssrc/renderer/core/canvas/links/useSubgraphDragBridge.tssrc/renderer/extensions/vueNodes/components/SlotConnectionDot.vuesrc/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts
💤 Files with no reviewable changes (1)
- src/renderer/core/canvas/links/linkConnectorAdapter.ts
✅ Files skipped from review due to trivial changes (2)
- src/renderer/extensions/vueNodes/components/SlotConnectionDot.vue
- src/lib/litegraph/src/subgraph/SubgraphIOSlotLinks.test.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- src/components/graph/GraphCanvas.vue
- src/lib/litegraph/src/canvas/LinkConnectorDropEvents.test.ts
- src/lib/litegraph/src/subgraph/SubgraphInputNode.ts
- src/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts
- src/lib/litegraph/src/subgraph/SubgraphInput.ts
314f5dd to
cae32b1
Compare
|
@coderabbitai resume |
✅ Actions performedReviews resumed. |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
src/renderer/core/canvas/links/useSubgraphDragBridge.ts (2)
300-303: Prefer function declaration foronPointerMove.Same guideline applies here.
Suggested change
- const onPointerMove = (e: PointerEvent) => { + function onPointerMove(e: PointerEvent) { pendingMove = { clientX: e.clientX, clientY: e.clientY } raf.schedule() }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/core/canvas/links/useSubgraphDragBridge.ts` around lines 300 - 303, The onPointerMove handler is currently defined as a const arrow function; change it to a named function declaration to follow the project's guideline (replace "const onPointerMove = (e: PointerEvent) => { ... }" with "function onPointerMove(e: PointerEvent) { ... }"), keeping the same body that sets pendingMove = { clientX: e.clientX, clientY: e.clientY } and calls raf.schedule(); update any addEventListener/removeEventListener usage to reference the new function name if necessary so listeners attach/detach correctly.
176-176: Prefer function declaration forprocessFrame.Per coding guidelines, function declarations are preferred over function expressions where possible.
Suggested change
- const processFrame = () => { + function processFrame() {🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/renderer/core/canvas/links/useSubgraphDragBridge.ts` at line 176, The function is currently defined as an arrow function assigned to a const (processFrame); change it to a standard function declaration (function processFrame(...) { ... }) to follow the coding guideline preferring declarations, preserving the same parameters and body from the existing processFrame arrow, and ensure any references that rely on hoisting still work (adjust call order if necessary); update any TypeScript type annotations attached to the const to the function declaration form if present.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/renderer/core/canvas/links/useSubgraphDragBridge.ts`:
- Around line 300-303: The onPointerMove handler is currently defined as a const
arrow function; change it to a named function declaration to follow the
project's guideline (replace "const onPointerMove = (e: PointerEvent) => { ...
}" with "function onPointerMove(e: PointerEvent) { ... }"), keeping the same
body that sets pendingMove = { clientX: e.clientX, clientY: e.clientY } and
calls raf.schedule(); update any addEventListener/removeEventListener usage to
reference the new function name if necessary so listeners attach/detach
correctly.
- Line 176: The function is currently defined as an arrow function assigned to a
const (processFrame); change it to a standard function declaration (function
processFrame(...) { ... }) to follow the coding guideline preferring
declarations, preserving the same parameters and body from the existing
processFrame arrow, and ensure any references that rely on hoisting still work
(adjust call order if necessary); update any TypeScript type annotations
attached to the const to the function declaration form if present.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 338677c9-4d5c-4e7a-b552-2fde64df652e
📒 Files selected for processing (2)
knip.config.tssrc/renderer/core/canvas/links/useSubgraphDragBridge.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- knip.config.ts
f5ece42 to
869b42d
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/litegraph/src/subgraph/SubgraphInputNode.ts`:
- Around line 183-193: The "node:slot-links:changed" event is being emitted
before the disconnect bookkeeping completes (you clear input.link at the top of
the block), causing listeners to observe a half-updated graph; in the
SubgraphInputNode code paths that clear input.link (the block beginning with
"const linkId = input.link" and the similar block at lines ~198-216), move the
subgraph.trigger('node:slot-links:changed', {...}) call to after you call
link.disconnect(...) and after you prune subgraphInput.linkIds so the event
fires only once the source slot and subgraph state are fully updated; update
both occurrences accordingly so listeners see a consistent graph state.
In `@src/renderer/core/canvas/links/useSubgraphDragBridge.ts`:
- Around line 169-185: processFrame uses ownerDoc but still calls
resolvePointerTarget which currently hits the global document; update the
hit-testing to use the canvas window's document by changing resolvePointerTarget
to accept an owner document (or adding a new helper that uses
ownerDoc.elementFromPoint) and then call it from processFrame with ownerDoc
(i.e., modify resolvePointerTarget signature/usage and replace the call in
processFrame to resolvePointerTarget(data.clientX, data.clientY, ownerDoc) or
equivalent so elementFromPoint runs against lgCanvas.getCanvasWindow().document
rather than the global document).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 14a8f684-6e31-456a-ac42-a6b7eb9ca43f
📒 Files selected for processing (13)
browser_tests/tests/subgraphIODragFeedback.spec.tsknip.config.tssrc/components/graph/GraphCanvas.vuesrc/lib/litegraph/src/canvas/LinkConnector.tssrc/lib/litegraph/src/canvas/LinkConnectorDropEvents.test.tssrc/lib/litegraph/src/infrastructure/LinkConnectorEventMap.tssrc/lib/litegraph/src/subgraph/SubgraphIOSlotLinks.test.tssrc/lib/litegraph/src/subgraph/SubgraphInput.tssrc/lib/litegraph/src/subgraph/SubgraphInputNode.tssrc/renderer/core/canvas/links/linkConnectorAdapter.tssrc/renderer/core/canvas/links/useSubgraphDragBridge.tssrc/renderer/extensions/vueNodes/components/SlotConnectionDot.vuesrc/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts
💤 Files with no reviewable changes (1)
- src/renderer/core/canvas/links/linkConnectorAdapter.ts
✅ Files skipped from review due to trivial changes (1)
- src/renderer/extensions/vueNodes/components/SlotConnectionDot.vue
🚧 Files skipped from review as they are similar to previous changes (4)
- src/components/graph/GraphCanvas.vue
- knip.config.ts
- src/lib/litegraph/src/infrastructure/LinkConnectorEventMap.ts
- src/lib/litegraph/src/canvas/LinkConnectorDropEvents.test.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/lib/litegraph/src/subgraph/SubgraphInputNode.ts`:
- Around line 183-195: The code captures const linkId = input.link which can be
null and then emits a 'node:slot-links:changed' event with linkId possibly null;
update the two subgraph.trigger payloads (the branches that emit
'node:slot-links:changed' around the const linkId assignment) so they only
include the linkId property when linkId !== null (i.e., conditionally add linkId
to the event payload) or otherwise supply a numeric sentinel, ensuring the
payload conforms to the NodeSlotLinksChangedEvent (use the existing input.link
variable and the subgraph.trigger call sites to locate both occurrences to
change).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c64f31fd-ebec-4448-a096-b8441d85f1e8
📒 Files selected for processing (3)
src/lib/litegraph/src/subgraph/SubgraphInputNode.tssrc/renderer/core/canvas/links/useSubgraphDragBridge.tssrc/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts
Bridge canvas-initiated subgraph IO drags to Vue slot drag state and vice versa, restoring slot dimming, proximity snap, dot highlights, and drop-to-connect across the canvas/Vue rendering boundary. Fixes Comfy-Org#9010
- SubgraphInput.connect() fires node:slot-links:changed for widget inputs - SubgraphInputNode._disconnectNodeInput() fires on disconnect - LinkConnector.dropOnNothing() dispatches before-drop-on-canvas before dropped-on-canvas, and skips downstream when intercepted - Remove duplicate raf.flush() in finishInteraction
Replace weak negative assertions with explicit call-name filtering to catch false passes. Add docstrings to inner bridge functions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove unconditional canvas dirty during stable hover (perf) The `|| node.isPointerOver` condition caused setDirty on every pointer-move frame while hovering, even when state hadn't changed.
Flush the RAF-batched processFrame() synchronously in onBeforeDropOnCanvas before reading dragState.candidate. This prevents a stale candidate when the pointer enters a compatible slot and the mouse is released in the same animation frame.
Verifies Vue slot behavior during canvas-initiated SubgraphInput drags: 1. Incompatible output slots get dimmed (opacity-40) during drag 2. Snap-target class is not applied spuriously without pointer hover 3. Drag state fully resets when LinkConnector resets (no stale dimming)
- Guard linkId null before emitting node:slot-links:changed in the no-link early-return branch of _disconnectNodeInput - Recompute node-surface snap candidates while the pointer moves inside the same node (hoveredSlotKey is null but hoveredNodeId is set)
- Add ownerDoc param to resolvePointerTarget for pop-out canvas windows - Use ownerDoc realm consistently in bridge processFrame - Only snap to subgraph IO slots when candidate is compatible - Clear synthetic hover state on subgraph IO nodes during cleanup - Rename snap-target test to clarify it tests the negative case
- Fix before-drop-on-canvas docstring to reference preventDefault() - Use lgCanvas.setDirty instead of app.canvas for pop-out correctness
moveInputLink and moveOutputLink now dispatch the 'connecting' event so the drag bridge activates for existing subgraph IO link rewires, not just brand-new drags.
Verifies moveInputLink and moveOutputLink dispatch the 'connecting' event so the drag bridge activates for existing link rewires.
- Consolidate cleanup into resetBridgeDrag() that clears pointer tracking, ends drag, and clears compatibility map in one call - Fix dimmeBefore → dimmedBefore typo in Playwright test
248d5e3 to
bae3ce3
Compare
The comment said the snap-target class should appear after a drag starts, but the test asserts 0 snap targets — correctly verifying the class is not applied without real pointer hover movement. Also fixes the import to use the @e2e/ path alias. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Pushed a fix for the Commit: |
There was a problem hiding this comment.
Verdict: request changes. Valid IO snaps and SVG dot targeting still fail, and the new tests do not exercise a successful pointer-to-drop interaction.
I would fix the IO target validation and SVG element boundary, then protect both drag directions with the focused integration cases described inline. Cancellation also leaves the empty IO dot hovered. The bridge currently duplicates the Vue drag-session controller and starts alongside it during Vue rewires; I would give that session one owner before adding more synchronization.
The inline comments include the type-contract repairs, redundant tests to remove, and repository-guidance edits. P3 items marked Nit: are non-blocking preferences. The reproduced snap/target failures are P2; I found no P0/P1 defect.
Related work and policy conflicts
I checked overlapping changes, including #9838, #12017, #12019 and #12767. This PR explicitly continues #9838. #12019 carries the RAF-flush and disconnect-notification work already present here; I did not report that as missing again. #12017 retains IO snapping without the Vue-candidate condition, which differs from this head's broken compatibility correction. Resolve that as one direction/type-aware IO policy. #12767 changes the other controller's connection fan-out policy, another reason to avoid copying its connection loop into a second owner. I found no separate concrete combined failure in the other inspected overlap patches.
The REST overlap scan covered changed files and the initial consumer/dependency list. The correctness trace identified additional dependency paths outside that list. I attempted the supplemental scan, but GitHub returned HTTP 403 with its core API quota exhausted, so that scan remains incomplete. This review does not claim a clean combined-merge verdict or complete coverage of those additional dependencies.
Existing feedback: confirmed or contested
- E03 P2, Replace as never with local interfaces and double assertions. contested. Replacing as never with hand-declared shapes and double assertions still erases the real contract. M3 uses authoritative narrowing instead.
- E07 P3, Changed event precedes completed link bookkeeping. confirmed. I confirm the incomplete source-side snapshot, but not a current UI regression. See C4 for the passing input-side consumer and the experiment needed to establish impact.
- E12 P2, Negative test does not prove positive snap behavior. confirmed. The test never moves or drops a pointer. T2 replaces it with a positive scenario rather than adding a duplicate.
- E13 P2, Only snap compatible IO targets. confirmed. The compatibility concern is valid, but the current correction checks a null Vue candidate and disables valid IO snap. C1 reproduces the offset failure. I rate this P2, not the provisional P1, because dragging still operates.
- E14 P3, Clear synthetic IO hover on teardown. confirmed. The two onPointerLeave calls now exist, but their dependency excludes emptySlot. C3 reproduces cancellation leaving the empty slot hovered; adding calls alone does not complete cleanup.
- E19 P3, Partial CanvasPointerEvent assertion. confirmed. M5 confirms the two-coordinate object is asserted as a full pointer event. Both hover methods can use their actual coordinate contract.
- E23 P2, Drive real pointer drag rather than internal method. confirmed. T2 confirms no positive pointer/drop integration exists. The minimum useful replacement is below the browser; the missing pointer journey is not solved by another event-only test.
- E24 P3, processFrame should use function declaration. confirmed. I1 supplies the local declaration edit required by the head AGENTS rule.
- E25 P3, onPointerMove should use function declaration. confirmed. I2 supplies the local declaration edit required by the head AGENTS rule.
- E27 P2, Hook fires after irreversible disconnection. contested. The removal precedes the new hook, but the intended IO-origin rewire uses ToInputFromIoNodeLink, not the filtered MovingInputLink. Both canvas-drop hooks operate on surviving render links. I found no IO-bridge loss from this ordering; widening cancellation to all prior disconnect operations would be a separate contract change.
- E28 P2, Use owner DOM realm consistently. confirmed. The bridge ownerDoc fix is present, but shared resolvers still use global HTMLElement. C2 requires the DOM-boundary fix across both layers; cross-window browser behavior remains unexecuted.
- E29 P2, Check compatible target stays undimmed. confirmed. T1 confirms that dim-all passes because this case only inspects wrong-direction outputs.
- E36 P1, lg-slot--output and opacity-40 selectors do not exist. contested. The exact lg-slot--output and opacity-40 classes exist in the current slot components. I agree with the author correction; replacing them with the suggested noutput/nsnap-target forms would be wrong.
Unverified candidates
- E26 P3, Catch individual connection attempts. unverified-posted. I have no concrete extension callback that throws during this new connection path. Existing Vue connection code also calls the same link operations without per-link catches. A throwing extension plus a real IO drop would establish whether the boundary needs recovery; I am not asking for speculative catch-and-continue code.
- C4 P3, Disconnect notification exposes incomplete source bookkeeping. unverified-posted. I confirmed the event snapshot contains inputLink=null while graph.links still contains ID 0 and source linkIds is [0]. After return those source records are gone. This confirms the ordering concern in E07, but the built-in useGraphNodeManager consumer only reads the already-cleared input side, and ordinary node disconnection uses similar ordering. I have not established an application regression. An extension that reads source links synchronously in this event would settle the impact; do not treat this as a reproduced UI blocker.
Checked and cleared
- E01 P2, Test manually dispatches connecting. rejected:repro-contradicts. Current test calls dragNewFromSubgraphInput; author reply 2972595188 is consistent with code.
- E02 P3, connecting listener has no cleanup. rejected:repro-contradicts. Current lines 141-147 remove named listener in finally.
- E04 P3, Restore overridden trigger. rejected:repro-contradicts. Current lines 78-80 restore trigger in finally.
- E05 P3, No-slot early return leaks listener. rejected:repro-contradicts. Slot check at 123-124 precedes listener registration at 134.
- E06 P1, Flush candidate before drop. rejected:repro-contradicts. Current pointerTracking.flush precedes candidate read at 136-137.
- E08 P2, Hit testing uses global document. rejected:repro-contradicts. Bridge now explicitly supplies ownerDoc to resolvePointerTarget at 189-194. Other realm checks remain separate candidate.
- E09 P2, Null link id emitted. rejected:repro-contradicts. linkId != null guard at 185 excludes null but preserves numeric zero.
- E11 P2, Recompute node-surface candidate on same node. rejected:intentional-confirmed. shouldResolveCandidate now includes node background movement; resolver intentionally chooses first matching slot and caches by node.
- E15 P3, Cancellation doc should say preventDefault. rejected:repro-contradicts. Current doc explicitly says preventDefault and dispatch returns false.
- E16 P2, Existing callers omit ownerDoc. rejected:not-introduced. Base resolvePointerTarget also uses global document; unchanged callers already had this behavior. Bridge supplies ownerDoc.
- E17 P3, dimmeBefore typo. rejected:repro-contradicts. Current declaration and assertion both use dimmedBefore.
- E18 P3, Comment contradicts negative test. rejected:repro-contradicts. Current comment accurately describes a stationary pointer without a snap target.
- E20 P3, Verify group/slot ancestor assumption. rejected:consumer-exists. InputSlot.vue and OutputSlot.vue use group/slot root; registry slot is a descendant.
- E21 P3, Use premade workflow not inline JSON. rejected:repro-contradicts. Both specs now load named workflow assets.
- E22 P2, Missing connecting in IO rewire paths. rejected:repro-contradicts. moveInputLink and moveOutputLink now dispatch connecting at 270 and 382.
- E30 P3, Use scoped lgCanvas not app.canvas. rejected:repro-contradicts. Bridge redraw uses lgCanvas.setDirty at 284.
- E31 P3, Rename intercepted to mayContinue. rejected:intentional-confirmed. False-only check directly mirrors cancellation semantics; no behavioral or documented-name mismatch.
- E32 P3, Guard registry entry before reading. rejected:repro-contradicts. entry?.el?.closest and entry?.el?.parentElement already optional-chain missing entry.
- E33 P3, Use setCompatibleMap for initial pass. rejected:intentional-confirmed. setCompatibleForKey is existing public owner API and stores same entries; synchronous pass has no intermediate render.
- E34 P2, Fully reset before restart. rejected:repro-contradicts. onConnecting begins resetBridgeDrag, which cleans pointer tracking, ends drag and clears compatibility.
- E35 P3, Replace stable fixture id 19 with dynamic lookup. rejected:intentional-confirmed. Test owns named serialized workflow asset and id 19; dynamic lookup provides no additional behavioral contract.
- N25 P2, Retain the exported cancellation contract. rejected:intentional-confirmed. This curt exported API comment specifies the platform preventDefault mechanism, which the event property type and name cannot express. The dispatch return value and legacy consumer confirm the contract.
- F01 P2, overWidgetType. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F02 P2, overReroute. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F03 P2, draggingExistingLinks. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F04 P2, dragFromRerouteToOutput. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F05 P2, dragFromLinkSegment. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F06 P2, isNodeValidDrop. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F07 P2, arrange. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F08 P2, onPointerDown. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F09 P2, canConnectTo. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F10 P2, connectSlots. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F11 P2, connectByType. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F12 P2, findOutputByType. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F13 P2, isNodeValidDrop. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F14 P2, disconnectMovingLinks. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F16 P2, dup:55f4321e. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F17 P2, dup:3ee7c2b1. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F18 P2, dup:7abb574d. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F19 P2, dup:54741b31. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F20 P2, dup:215d93c0. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F22 P2, dup:a25c75dd. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F23 P2, onPointerDown. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F25 P2, . rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F27 P2, moveOutputLink. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F28 P2, dropOnIoNode. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F29 P2, tryConnectViaRerouteAtPointer. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F30 P2, moveInputLink. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F31 P2, connect. rejected:intentional-confirmed. The existing event consumer justifies the widget notification branch.
- F32 P2, isRerouteValidDrop. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F34 P2, tryConnectToCandidate. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F35 P2, . rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F36 P2, _disconnectNodeInput. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F37 P2, resolveExistingInputLinkAnchor. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F38 P2, _connectOutputToReroute. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F39 P2, canConnectInputLinkToReroute. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F41 P2, . rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F42 P2, . rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- F43 P2, onBeforeDropOnCanvas. rejected:intentional-confirmed. RAF flush and early interception of legacy empty-release notification are required ingress work, not independent complexity defects.
- F45 P2, rounded-[1px]. rejected:not-introduced. Fallow base-snapshot attribution marks this inherited; it is not a new PR defect.
- E10 P2, Guard null link id. merged:E09. Same null-id guard already present.
- T9 P2, Remove local graph shapes and as never. merged:M3. Same authoritative-type root as M3, including the corresponding double assertions in the other browser spec.
- F15 P2, dup:7e0987f9. merged:M1. The full function/consumer trace confirms duplicate presentation policy; the metric alone is not the finding. See M1.
- F21 P2, dup:27290dea. merged:M1. The full function/consumer trace confirms duplicate presentation policy; the metric alone is not the finding. See M1.
- F24 P2, processPointerMoveFrame. merged:M1. The full function/consumer trace confirms duplicate presentation policy; the metric alone is not the finding. See M1.
- F26 P2, processFrame. merged:M1. The full function/consumer trace confirms duplicate presentation policy; the metric alone is not the finding. See M1.
- F33 P2, connectToCandidate. merged:M1. The full function/consumer trace confirms duplicate presentation policy; the metric alone is not the finding. See M1.
- F40 P2, onConnecting. merged:M1. The full function/consumer trace confirms duplicate presentation policy; the metric alone is not the finding. See M1.
- F44 P2, updateSnapTargetHighlight. merged:M2. The full function/consumer trace confirms duplicate presentation policy; the metric alone is not the finding. See M2.
pnpm exec vitest run src/lib/litegraph/src/canvas/LinkConnectorDropEvents.test.ts src/lib/litegraph/src/subgraph/SubgraphIOSlotLinks.test.ts: 2 files, 9 tests passed.pnpm exec playwright test --list browser_tests/tests/subgraphIODragBridge.spec.ts browser_tests/tests/subgraphIODragFeedback.spec.ts: all 5 cases discovered. This is discovery only, not an E2E pass. I did not start a backend or claim a visual run.- Focused composable probes at this head reproduced the offset IO snap failure, SVG candidate rejection and stale empty-slot hover after pointer cancellation. The HTML target control resolved the second input and connected it successfully. These ran the real composables/connector with a minimal canvas shell, identity coordinate conversion and no-op AutoPan; they are not browser results.
- ESLint over every changed TypeScript/Vue file failed on the relative fixture import in
subgraphIODragFeedback.spec.ts. Oxlint reported zero warnings and zero errors; oxfmt accepted every changed file. - Diff-scoped Fallow analyzed all changed files. Its raw complexity and clone candidates are reconciled in the ledger entries rather than treated as proof of defects. Existing dead-member warnings are inherited, not new findings against this PR.
- The head has Socket Security and CLA checks, but no application lint, typecheck, or test results. I did not infer application health from those checks.
- Standard-depth correctness, maintainability, and tests lanes covered all changed files. The tests lane also reviewed the Playwright conventions. No lane was skipped; documentation claims were covered by correctness and visual coverage by tests.
- I used REST for the review history and the overlap scan, including the initial dependency contracts as well as changed files, with the additional-dependency limitation noted above. The bundled context collector uses GraphQL, so I replaced it with a REST scan. REST does not expose review-thread resolution flags; I assessed every fetched root comment and its replies instead of dropping old locations.
- No owner comment introduced a lane-brief gap in this round. This is the first review by either of my posting identities, so there is no prior local round to retread.
Merged ledger entries
Verification and coverage
I reviewed the full diff at a1d7ed023 against its actual base, with the head's frozen-lockfile dependencies installed in a dedicated worktree.
| /** | ||
| * Tests for the subgraph IO drag bridge — verifying that canvas-drawn | ||
| * SubgraphInput drags produce correct visual feedback on Vue-rendered | ||
| * slots (dimming incompatible, highlighting compatible). | ||
| * | ||
| * See: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10224 | ||
| */ |
There was a problem hiding this comment.
[P2] N01: Remove the redundant comment
I would delete this under the repository's no-comments rule. The suite overview and PR URL repeat the suite/test names and belong in the PR description. The useful explanation belongs in the test/operation name or PR description.
| /** | |
| * Tests for the subgraph IO drag bridge — verifying that canvas-drawn | |
| * SubgraphInput drags produce correct visual feedback on Vue-rendered | |
| * slots (dimming incompatible, highlighting compatible). | |
| * | |
| * See: https://github.com/Comfy-Org/ComfyUI_frontend/pull/10224 | |
| */ |
| await comfyPage.vueNodes.enterSubgraph('19') | ||
| await comfyPage.vueNodes.waitForNodes() | ||
|
|
||
| // Before drag: no slots should be dimmed |
There was a problem hiding this comment.
[P2] N02: Remove the redundant comment
I would delete this under the repository's no-comments rule. "Before drag" narrates the dimmedBefore assertion immediately below. The useful explanation belongs in the test/operation name or PR description.
| // Before drag: no slots should be dimmed |
| ) | ||
| expect(dimmedBefore).toBe(false) | ||
|
|
||
| // Start a drag from the seed SubgraphInput (INT type) |
There was a problem hiding this comment.
[P2] N03: Remove the redundant comment
I would delete this under the repository's no-comments rule. The next block already finds seed and calls dragNewFromSubgraphInput. The useful explanation belongs in the test/operation name or PR description.
| // Start a drag from the seed SubgraphInput (INT type) |
| const graph = canvas!.graph as { | ||
| inputNode: { slots: Array<{ name: string }> } | ||
| } | ||
| const seedSlot = graph.inputNode.slots.find((s) => s.name === 'seed') | ||
|
|
||
| canvas!.linkConnector['dragNewFromSubgraphInput']( | ||
| canvas!.graph!, | ||
| graph.inputNode as never, | ||
| seedSlot as never |
There was a problem hiding this comment.
[P2] M3: Use the real subgraph types instead of forced argument casts
The local graph shape plus as never bypasses the connector contract instead of checking it. The other browser spec repeats this with TestSubgraph interfaces and as unknown as Parameters<...>. Please narrow the actual graph/subgraph node, guard the named slot, and pass those typed values directly. isSubgraphNode() already narrows a real node. The surviving browser setup and the signal test moved to unit level need a coordinated typed-fixture rewrite across files; widening globals or adding another local shape would keep the same problem.
| // During drag: incompatible output slots should be dimmed | ||
| // (seed is INT, so CLIP/LATENT/CONDITIONING outputs won't match) |
There was a problem hiding this comment.
[P2] N04: Remove the redundant comment
I would delete this under the repository's no-comments rule. The comment restates dimmedDuring and adds an unasserted fixture-type inventory. The useful explanation belongs in the test/operation name or PR description.
| // During drag: incompatible output slots should be dimmed | |
| // (seed is INT, so CLIP/LATENT/CONDITIONING outputs won't match) |
| let highlightedSlotEl: HTMLElement | null = null | ||
|
|
||
| /** Resolves the Vue slot under the pointer and updates snap/highlight state. */ | ||
| const processFrame = () => { |
There was a problem hiding this comment.
[P3] I1: Nit: Use a function declaration for this named handler
The head's AGENTS.md asks for function declarations when possible. This named handler does not need expression semantics.
| const processFrame = () => { | |
| function processFrame() { |
| const raf = createRafBatch(processFrame) | ||
|
|
||
| /** Buffers the latest pointer position and schedules a RAF frame. */ | ||
| const onPointerMove = (e: PointerEvent) => { |
There was a problem hiding this comment.
[P3] I2: Nit: Use a function declaration for this named handler
The head's AGENTS.md asks for function declarations when possible. This named handler does not need expression semantics.
| const onPointerMove = (e: PointerEvent) => { | |
| function onPointerMove(e: PointerEvent) { |
| props.multi | ||
| ? 'h-6 w-3' | ||
| : 'size-3 cursor-crosshair group-hover/slot:scale-125 group-hover/slot:[--node-component-slot-dot-outline-opacity-mult:5]' | ||
| : 'size-3 cursor-crosshair group-hover/slot:scale-125 group-hover/slot:[--node-component-slot-dot-outline-opacity-mult:5] group-[.lg-slot--snap-target]/slot:scale-125 group-[.lg-slot--snap-target]/slot:[--node-component-slot-dot-outline-opacity-mult:5]' |
There was a problem hiding this comment.
[P3] T8: Capture the rendered snap-target dot in the positive hover case
A class-presence assertion passes even if this Tailwind selector never renders the dot larger/brighter. I found no visual baseline exercising an IO-to-Vue hover. Please add one cropped slot/dot screenshot in the positive browser hover phase, without another page load. This needs the browser scenario and its baseline image, so it spans files.
| const graph = app.canvas?.graph | ||
| if (isSubgraph(graph)) { | ||
| graph.inputNode?.onPointerLeave() | ||
| graph.outputNode?.onPointerLeave() | ||
| } |
There was a problem hiding this comment.
[P3] C3: Clear synthetic hover on the empty IO slot too
I moved a real Vue drag over outputNode.emptySlot and cancelled it. The node hover cleared, but emptySlot.isPointerOver remained true. The new pointer-move path updates allSlots; SubgraphIONodeBase.onPointerLeave only clears slots. Please make that owner iterate allSlots so this cleanup clears every slot it updates. This is a dependency-file fix, so the suggestion cannot be applied at this caller.
|
|
||
| const graph = app.canvas?.graph | ||
| if (isSubgraph(graph)) { | ||
| const pointerEvent = { canvasX, canvasY } as CanvasPointerEvent |
There was a problem hiding this comment.
[P3] M5: Narrow the hover API to the coordinates it consumes
This object supplies only canvasX/canvasY but claims to be a full browser pointer event. Both IO hover methods only consume those coordinates. Please type their parameters as Pick<CanvasPointerEvent, 'canvasX' | 'canvasY'> and remove this assertion. This spans the existing IO node/slot method signatures; changing the caller alone cannot repair the contract.

Rebases and continues #9281 (by @artokun) and #9838 (by @christian-byrne) on latest main.
Summary
useSubgraphDragBridgecomposable bridging LiteGraph canvas pointer state to Vue slot interaction statenode:slot-links:changedevents from SubgraphInput/SubgraphInputNode for widget-backed inputsbefore-drop-on-canvasevent to LinkConnector for interceptionFixes #9010
Changes
node:slot-links:changedso Vue components reactively updateCredit
Demo
555773028-1bb4c941-bf27-4cac-8c2c-5a95cbd951af.mov
Test plan
┆Issue is synchronized with this Notion page by Unito