Skip to content

test: pin subgraph IO drag → Vue widget slot reveal - #12017

Draft
christian-byrne wants to merge 1 commit into
mainfrom
glary/subgraph-io-drag-feedback-tdd
Draft

christian-byrne wants to merge 1 commit into
mainfrom
glary/subgraph-io-drag-feedback-tdd

Conversation

@christian-byrne

@christian-byrne christian-byrne commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

PR Created by the Glary-Bot Agent


Adds a regression test that pins the exact Slack-reported scenario for #9010 / #9838: a canvas-initiated drag from a SubgraphInputNode slot should propagate through useSubgraphDragBridge to the Vue slotLinkDragUIState, so a Vue node's widget-backed input (e.g. multiline text widget) is marked compatible and resolved as the active drop candidate while hovering its widget surface.

What the test asserts

File: src/renderer/core/canvas/links/useSubgraphDragBridge.test.ts

Test: useSubgraphDragBridge › marks a multiline widget backing input as compatible during subgraph-input canvas drag

  1. Build a Subgraph with one STRING input slot and a Vue-tracked target LGraphNode whose input is widget-backed (inputs[0].widget = { name: 'multiline_prompt' }).
  2. Register the slot in layoutStore and mount a DOM element with .lg-node-widget + data-node-id + data-slot-key to mirror the multiline widget surface.
  3. Start useSubgraphDragBridge() inside an effectScope, set useCanvasStore().canvas to a stub canvas wired to a real LinkConnector, then dispatch linkConnector.dragNewFromSubgraphInput(...).
  4. Assert: slotLinkDragUIState.state.active === true AND state.compatible.get(slotKey) === true (bridge picked up the canvas-initiated drag from the SubgraphInput).
  5. Dispatch a pointermove over the widget container and advance the RAF batch. Assert the resolved candidate matches the widget-backed input slot with compatible: true.

TDD verification (failing → passing)

Strict TDD as required by the task brief:

Failing state — temporarily early-return from useSubgraphDragBridge() so the bridge is inert:

FAIL  src/renderer/core/canvas/links/useSubgraphDragBridge.test.ts > useSubgraphDragBridge >
      marks a multiline widget backing input as compatible during subgraph-input canvas drag
AssertionError: expected false to be true // Object.is equality
- Expected: true
+ Received: false
  src/renderer/core/canvas/links/useSubgraphDragBridge.test.ts:105:26
   103 |
   104 |     const state = useSlotLinkDragUIState().state
   105 |     expect(state.active).toBe(true)
                                  ^

Passing state — restore the bridge implementation:

✓ src/renderer/core/canvas/links/useSubgraphDragBridge.test.ts (1 test) 23ms
Test Files  1 passed (1)
     Tests  1 passed (1)

Both runs invoked exactly: pnpm vitest run src/renderer/core/canvas/links/useSubgraphDragBridge.test.ts.

Quality gates

  • pnpm typecheck: passes (full repo)
  • lint-staged hooks (oxfmt + oxlint + eslint + typecheck) ran on commit and passed
  • LSP diagnostics on the new test file: clean
  • Targeted Vitest run for the new file: passes

Notes for reviewers of #9838

A separate Oracle review of this branch surfaced two pre-existing concerns in the underlying fix (out of scope for this test-only PR):

  • useSubgraphDragBridge.ts reads dragState.candidate in onBeforeDropOnCanvas without flushing the RAF batch — a drop in the same frame as a pointer entering a compatible slot can still see a stale/null candidate and fall through to the canvas-drop path.
  • LGraphNode.disconnectInput() and SubgraphInputNode._disconnectNodeInput() both emit node:slot-links:changed for widget-backed subgraph inputs on disconnect; the second emission fires after input.link is cleared and can carry linkId: null.

This PR intentionally does not modify the fix; it only adds a regression test pinning the primary reported scenario.

┆Issue is synchronized with this Notion page by Unito

@coderabbitai

coderabbitai Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Team

Run ID: 152c1d2c-f02b-4370-aacf-914c3d7a02f1

📥 Commits

Reviewing files that changed from the base of the PR and between d849604 and b2d0e4c.

📒 Files selected for processing (12)
  • src/components/graph/GraphCanvas.vue
  • src/lib/litegraph/src/canvas/LinkConnector.ts
  • src/lib/litegraph/src/canvas/LinkConnectorDropEvents.test.ts
  • src/lib/litegraph/src/infrastructure/LinkConnectorEventMap.ts
  • src/lib/litegraph/src/subgraph/SubgraphIOSlotLinks.test.ts
  • src/lib/litegraph/src/subgraph/SubgraphInputNode.ts
  • src/renderer/core/canvas/links/linkConnectorAdapter.ts
  • src/renderer/core/canvas/links/useSubgraphDragBridge.test.ts
  • src/renderer/core/canvas/links/useSubgraphDragBridge.ts
  • src/renderer/extensions/vueNodes/components/SlotConnectionDot.vue
  • src/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.subgraphSnap.test.ts
  • src/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch glary/subgraph-io-drag-feedback-tdd

Comment @coderabbitai help to get the list of available commands.

@glary-bot

glary-bot Bot commented May 6, 2026

Copy link
Copy Markdown

Acknowledged — auto-review skip is expected here. This PR intentionally targets fix/subgraph-io-drag-feedback (the branch behind #9838) instead of main because it's a test-only contribution to that in-flight fix, not a standalone change. CodeRabbit will run normally once #9838 lands and the test reaches main as part of that merge.

No retry needed.

@github-actions

github-actions Bot commented May 6, 2026 •

Copy link
Copy Markdown
Contributor

📦 Bundle Size

⏳ Size data collection in progress…

⚡ Performance Report

No baseline found — showing absolute values.

Metric Value
canvas-idle: layout duration 0ms
canvas-idle: style recalc duration 10ms
canvas-idle: layout count 0
canvas-idle: style recalc count 11
canvas-idle: task duration 376ms
canvas-mouse-sweep: layout duration 4ms
canvas-mouse-sweep: style recalc duration 41ms
canvas-mouse-sweep: layout count 12
canvas-mouse-sweep: style recalc count 79
canvas-mouse-sweep: task duration 791ms
dom-widget-clipping: layout duration 0ms
dom-widget-clipping: style recalc duration 13ms
dom-widget-clipping: layout count 0
dom-widget-clipping: style recalc count 15
dom-widget-clipping: task duration 368ms
subgraph-dom-widget-clipping: layout duration 0ms
subgraph-dom-widget-clipping: style recalc duration 15ms
subgraph-dom-widget-clipping: layout count 0
subgraph-dom-widget-clipping: style recalc count 49
subgraph-dom-widget-clipping: task duration 428ms
subgraph-idle: layout duration 0ms
subgraph-idle: style recalc duration 14ms
subgraph-idle: layout count 1
subgraph-idle: style recalc count 14
subgraph-idle: task duration 361ms
subgraph-mouse-sweep: layout duration 5ms
subgraph-mouse-sweep: style recalc duration 41ms
subgraph-mouse-sweep: layout count 16
subgraph-mouse-sweep: style recalc count 77
subgraph-mouse-sweep: task duration 739ms
Raw data
{
  "timestamp": "2026-05-13T20:16:25.540Z",
  "gitSha": "80fcffe1929d6d396df8c2a8eb7bba758fd001fd",
  "branch": "glary/subgraph-io-drag-feedback-tdd",
  "measurements": [
    {
      "name": "canvas-idle",
      "durationMs": 2101.324000000005,
      "styleRecalcs": 10,
      "styleRecalcDurationMs": 17.472,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 488.17900000000003,
      "heapDeltaBytes": -858396
    },
    {
      "name": "canvas-idle",
      "durationMs": 2010.167000000024,
      "styleRecalcs": 12,
      "styleRecalcDurationMs": 10.058000000000002,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 360.61699999999996,
      "heapDeltaBytes": -704772
    },
    {
      "name": "canvas-idle",
      "durationMs": 2042.3999999999864,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 9.889999999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 375.655,
      "heapDeltaBytes": -298796
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1894.7860000000105,
      "styleRecalcs": 80,
      "styleRecalcDurationMs": 41.443999999999996,
      "layouts": 12,
      "layoutDurationMs": 3.675,
      "taskDurationMs": 878.82,
      "heapDeltaBytes": 1210744
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1848.622999999975,
      "styleRecalcs": 76,
      "styleRecalcDurationMs": 37.684000000000005,
      "layouts": 12,
      "layoutDurationMs": 3.338,
      "taskDurationMs": 758.462,
      "heapDeltaBytes": 1163392
    },
    {
      "name": "canvas-mouse-sweep",
      "durationMs": 1878.645000000006,
      "styleRecalcs": 79,
      "styleRecalcDurationMs": 45.873,
      "layouts": 13,
      "layoutDurationMs": 3.9189999999999996,
      "taskDurationMs": 790.589,
      "heapDeltaBytes": 1802568
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 550.8329999999546,
      "styleRecalcs": 15,
      "styleRecalcDurationMs": 12.7,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 330.794,
      "heapDeltaBytes": 6461400
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 632.6829999999859,
      "styleRecalcs": 16,
      "styleRecalcDurationMs": 13.177000000000001,
      "layouts": 1,
      "layoutDurationMs": 0.2829999999999999,
      "taskDurationMs": 406.90999999999997,
      "heapDeltaBytes": 18075604
    },
    {
      "name": "dom-widget-clipping",
      "durationMs": 610.1699999999823,
      "styleRecalcs": 14,
      "styleRecalcDurationMs": 14.642,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 368.24,
      "heapDeltaBytes": 12646848
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 624.0399999999795,
      "styleRecalcs": 52,
      "styleRecalcDurationMs": 16.464,
      "layouts": 1,
      "layoutDurationMs": 0.23300000000000012,
      "taskDurationMs": 427.52000000000004,
      "heapDeltaBytes": -3182888
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 608.8270000000193,
      "styleRecalcs": 49,
      "styleRecalcDurationMs": 13.411999999999999,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 413.24299999999994,
      "heapDeltaBytes": -3800136
    },
    {
      "name": "subgraph-dom-widget-clipping",
      "durationMs": 619.891999999993,
      "styleRecalcs": 49,
      "styleRecalcDurationMs": 14.592,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 434.36199999999997,
      "heapDeltaBytes": -3519832
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2024.5990000000234,
      "styleRecalcs": 14,
      "styleRecalcDurationMs": 15.247999999999998,
      "layouts": 1,
      "layoutDurationMs": 0.27700000000000014,
      "taskDurationMs": 410.75700000000006,
      "heapDeltaBytes": 884452
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2013.228999999967,
      "styleRecalcs": 14,
      "styleRecalcDurationMs": 14.084,
      "layouts": 1,
      "layoutDurationMs": 0.24799999999999994,
      "taskDurationMs": 361.317,
      "heapDeltaBytes": 1243788
    },
    {
      "name": "subgraph-idle",
      "durationMs": 2024.7770000000287,
      "styleRecalcs": 11,
      "styleRecalcDurationMs": 10.086999999999998,
      "layouts": 0,
      "layoutDurationMs": 0,
      "taskDurationMs": 358.709,
      "heapDeltaBytes": 516992
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1769.1499999999678,
      "styleRecalcs": 77,
      "styleRecalcDurationMs": 38.928000000000004,
      "layouts": 16,
      "layoutDurationMs": 4.475,
      "taskDurationMs": 688.443,
      "heapDeltaBytes": -1038496
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1754.3690000000538,
      "styleRecalcs": 81,
      "styleRecalcDurationMs": 46.895999999999994,
      "layouts": 17,
      "layoutDurationMs": 5.053999999999999,
      "taskDurationMs": 739.291,
      "heapDeltaBytes": -373408
    },
    {
      "name": "subgraph-mouse-sweep",
      "durationMs": 1739.9829999999952,
      "styleRecalcs": 77,
      "styleRecalcDurationMs": 41.367999999999995,
      "layouts": 16,
      "layoutDurationMs": 5.053,
      "taskDurationMs": 755.1170000000001,
      "heapDeltaBytes": -990036
    }
  ]
}

🎭 Playwright: 🕵🏻 0 passed, 0 failed

📊 Browser Reports
  • chromium: ❌ Deployment failed
  • chromium-2x: ❌ Deployment failed
  • chromium-0.5x: ❌ Deployment failed
  • mobile-chrome: ❌ Deployment failed

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 09/01/2026, 08:41:24 AM UTC

Links

🔗 Website Preview

Website Preview: https://comfy-website-preview-pr-12017.vercel.app

This commit: https://website-frontend-baio5imgm-comfyui.vercel.app

Last updated: 2026-09-01T08:34:27Z for 6333cfe

📦 Bundle Size

⚠️ Size data collection failed. Check the CI workflow logs.

⚡ Performance

⚠️ Performance tests failed. Check the CI workflow logs.

🔬 E2E Coverage

⚠️ Coverage collection failed. Check the CI workflow logs.

@christian-byrne christian-byrne left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The test is supposed to fail and then be fixed by commits in #12019, correct? However, it's passing currently... (indicating a mistaken assumption somewhere).

@christian-byrne christian-byrne left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review Summary (6 agents, 13 findings)

General Issues

issue: The implementation handles both SubgraphInput and SubgraphOutput drags (checks SubgraphIONodeBase), but this test only covers dragNewFromSubgraphInput. A regression in output drag handling would go undetected. Consider adding a second test case for dragNewFromSubgraphOutput.

suggestion: (non-blocking) Test asserts drag state and candidate resolution but never exercises the before-drop-on-canvas event handler that actually connects links. A bug in connectToCandidate() could allow the test to pass while actual drop fails.

suggestion: (non-blocking) Test only verifies compatible STRING->STRING match. Consider adding a case with mismatched types to verify incompatible slots are correctly marked compatible: false.

nitpick: (non-blocking) Test calls scope.stop() but doesn't verify state.active returns to false afterward.

@christian-byrne christian-byrne self-assigned this May 11, 2026
christian-byrne pushed a commit that referenced this pull request May 13, 2026
Addresses review feedback:
#12017 (comment)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
christian-byrne pushed a commit that referenced this pull request May 13, 2026
- Add expect assertion before inputs[0].widget access for clarity
- Add test for hover changed branch (pointer moves away from widget)

Addresses review feedback:
#12017 (comment)
#12017 (comment)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
christian-byrne pushed a commit that referenced this pull request Jun 30, 2026
Addresses review feedback:
#12017 (comment)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@christian-byrne
christian-byrne force-pushed the glary/subgraph-io-drag-feedback-tdd branch from ad5d3d5 to 3083c58 Compare June 30, 2026 03:24
christian-byrne pushed a commit that referenced this pull request Jun 30, 2026
- Add expect assertion before inputs[0].widget access for clarity
- Add test for hover changed branch (pointer moves away from widget)

Addresses review feedback:
#12017 (comment)
#12017 (comment)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

✅ All contributors have signed the CLA. Thank you! This PR is ready to be merged.
Posted by the CLA Assistant Lite bot.

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Rebased onto main and reconciled. Addressing the open review points:

"Test passes but should fail (fixed by #12019)?" — The premise was off: the #9010 fix lives in this branch's earlier commits (the useSubgraphDragBridge + LinkConnector event work), not in #12019. So the test passing here is correct. Verified it's a real pin, not a false positive: temporarily early-returning from useSubgraphDragBridge() fails all four bridge tests (state.active false !== true, candidate null); restoring the bridge makes them pass.

Supersession found during rebase — main has since added node:slot-links:changed emission unconditionally on subgraph input connect/disconnect. That made this branch's widget-gated emits redundant, and the disconnect one a duplicate (the exact "Warning 2" #12019 targeted). Reconciled by aligning SubgraphInputNode with main and removing the now-obsolete SubgraphIOSlotLinks.test.ts. Net effect: #12019's duplicate-emit warning is moot; its RAF-flush race warning should be re-checked independently.

6-agent summary suggestions — already covered by the current four cases: dragNewFromSubgraphOutput, mismatched-type incompatibility, and pointer-moves-away (hover changed). The before-drop connect path is still only asserted indirectly.

Local gates green: test:unit 12191 pass, typecheck/lint/knip/format clean. (CI's cla-assistant failure is a pre-existing multi-author signature issue; unit/typecheck workflows are draft-gated.)

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Conflict resolved by merging base fix/subgraph-io-drag-feedback (886f2e39bf) into head glary/subgraph-io-drag-feedback-tdd and force-pushing the merge commit 6333cfedf0.

Three content conflicts, all resolved in favour of the TDD head (this PR's intended state):

  • src/lib/litegraph/src/subgraph/SubgraphInput.ts — kept head's unconditional node:slot-links:changed emit (base gated behind if (slot.widget))
  • src/renderer/core/canvas/links/useSubgraphDragBridge.ts — kept head's String(candidate.layout.nodeId) coercion (3083c58a39)
  • src/renderer/core/canvas/links/useSubgraphDragBridge.test.ts — kept head's integration-style test suite

Result: base is now an ancestor of head; PR is MERGEABLE (was CONFLICTING/DIRTY). No conflict markers remain. Intended test diff preserved.

@christian-byrne
christian-byrne changed the base branch from fix/subgraph-io-drag-feedback to main September 1, 2026 08:33
@socket-security

socket-security Bot commented Sep 1, 2026 •

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

Rebase PR #12017 onto current main (d849604), retargeting from
stacked base fix/subgraph-io-drag-feedback (#9838) to main directly.

Preserves the full 12-file intended diff:
- Subgraph drag bridge (useSubgraphDragBridge) + tests
- LinkConnector connecting/before-drop events
- LinkConnectorEventMap additions
- SubgraphInputNode slot-links-changed emission
- SlotConnectionDot snap-target styling
- useSlotLinkInteraction subgraph snap logic + tests
- GraphCanvas wiring

Conflicts resolved:
- SubgraphInputNode.ts: kept PR's slot-links-changed event emission
- SlotConnectionDot.vue: kept PR's larger dots + snap-target hover
@christian-byrne
christian-byrne force-pushed the glary/subgraph-io-drag-feedback-tdd branch from 6333cfe to b2d0e4c Compare September 1, 2026 08:39
@christian-byrne

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (d849604b4), retargeting from stacked base fix/subgraph-io-drag-feedback (#9838) to main directly.

Result: PR is now MERGEABLE (was CONFLICTING). Full 12-file diff preserved.

Conflicts resolved:

  • SubgraphInputNode.ts — kept PR's node:slot-links:changed event emission on widget disconnect
  • SlotConnectionDot.vue — kept PR's larger slot dots + snap-target hover styling

Evidence:

  • New head SHA: b2d0e4c475f032c031f4830c2e2fef5ca965a623
  • Base retargeted to main (already live)
  • 12 files in diff confirmed: GraphCanvas.vue, LinkConnector.ts, LinkConnectorDropEvents.test.ts, LinkConnectorEventMap.ts, SubgraphIOSlotLinks.test.ts, SubgraphInputNode.ts, linkConnectorAdapter.ts, useSubgraphDragBridge.test.ts, useSubgraphDragBridge.ts, SlotConnectionDot.vue, useSlotLinkInteraction.subgraphSnap.test.ts, useSlotLinkInteraction.ts
  • mergeStateStatus: BLOCKED = pending CI/reviews, not conflicts

@christian-byrne

Copy link
Copy Markdown
Contributor Author

Rebase/retarget verification — act-fe-12017-rebase

Verified PR state at 2026-09-01T08:41:19Z:

  • Base: main (was fix/subgraph-io-drag-feedback per todo row)
  • Head: b2d0e4c475f0 (was 3083c58a39 per todo row — superseded by force-push)
  • Commits: 1 (b2d0e4c475f0 — "test: pin subgraph IO drag → Vue widget slot reveal")
  • Mergeable: MERGEABLE (mergeStateStatus: BLOCKED — CI checks IN_PROGRESS)
  • Diff: 12 files, +1279/-11 — subgraph IO drag/link-connector test + implementation files
  • Branch: glary/subgraph-io-drag-feedback-tdd — NOT frozen, NOT in human-claims

The PR has already been retargeted from fix/subgraph-io-drag-feedback to main with a single clean commit preserving the intended test-pinning diff. No further rebase action needed.

@github-actions github-actions Bot added the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 1, 2026
@christian-byrne

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@huang47 huang47 added the risk:xhigh PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026 — with ChatGPT Codex Connector
@huang47 huang47 removed the risk:R3 PR risk grade (advisory shadow check; grader-owned) label Sep 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:xhigh PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Subgraph socket connection missing visual feedback

4 participants