Skip to content

Conversation

@jtydhr88
Copy link
Collaborator

@jtydhr88 jtydhr88 commented Aug 18, 2025

Summary

GraphMutationService is the centralized service layer for all graph modification operations in ComfyUI Frontend. It provides a unified and validated API for graph mutations, serving as the single entry point for all graph modification operations.

Changes

  • What:
    add IGraphMutationService.ts and implement graphMutationService.ts

in order to test it, I use changeNodeTitile as example

#4691

┆Issue is synchronized with this Notion page by Unito

@jtydhr88 jtydhr88 requested review from a team as code owners August 18, 2025 03:57
@github-actions
Copy link

github-actions bot commented Aug 18, 2025

⚠️ Warnings

⚠️ Warning: E2E Test Coverage Missing

If this PR modifies behavior that can be covered by browser-based E2E tests, those tests are required. PRs lacking applicable test coverage may not be reviewed until added. Please add or update browser tests to ensure code quality and prevent regressions.

⚠️ Warning: Visual Documentation Missing

If this PR changes user-facing behavior, visual proof (screen recording or screenshot) is required. PRs without applicable visual documentation may not be reviewed until provided.
You can add it by:

  • GitHub: Drag & drop media directly into the PR description

  • YouTube: Include a link to a short demo

@snomiao
Copy link
Member

snomiao commented Aug 18, 2025

test broken...

  1. [chromium] › browser_tests/tests/widget.spec.ts:245:3 › Animated image widget › Can drag-and-drop animated webp image
Error: expect(received).toContain(expected) // indexOf

Expected substring: "animated_webp.webp"
Received string:    "animated_web.webp"

  261 |     const fileComboWidget = await loadAnimatedWebpNode.getWidget(0)
  262 |     const filename = await fileComboWidget.getValue()
> 263 |     expect(filename).toContain('animated_webp.webp')
      |                      ^
  264 |   })
  265 |
  266 |   test('Can preview saved animated webp image', async ({ comfyPage }) => {
    at 

@jtydhr88
Copy link
Collaborator Author

@snomiao it doesn’t likely caused by my changes, for the frontend, I only modified change node title

@snomiao
Copy link
Member

snomiao commented Aug 18, 2025

let me click update branch to see if it's flaky test

@Myestery
Copy link
Collaborator

test broken...

  1. [chromium] › browser_tests/tests/widget.spec.ts:245:3 › Animated image widget › Can drag-and-drop animated webp image
Error: expect(received).toContain(expected) // indexOf

Expected substring: "animated_webp.webp"
Received string:    "animated_web.webp"

  261 |     const fileComboWidget = await loadAnimatedWebpNode.getWidget(0)
  262 |     const filename = await fileComboWidget.getValue()
> 263 |     expect(filename).toContain('animated_webp.webp')
      |                      ^
  264 |   })
  265 |
  266 |   test('Can preview saved animated webp image', async ({ comfyPage }) => {
    at 

For headless tests, this widget.spec.ts has been flaky on my end but works on ui mode
I was able to fix it by adding a little timeout to line 259 of browser_tests/tests/widget.spec.ts

 await comfyPage.page.waitForTimeout(200)

@snomiao
Copy link
Member

snomiao commented Aug 18, 2025

I think we have to add auto retry for flaky tests.

Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

This looks great! The centralized graph mutation service is exactly what we need.

To align with our new domain-driven refactoring (see #5071), could we move these files to:

src/core/graph/operations/
├── graphMutationService.ts
└── IGraphMutationService.ts

This places graph operations in the core/ domain where they belong (pure business logic), rather than in the services/ technical layer we're moving away from.

The implementation itself looks perfect - just needs the folder adjustment to match our new architecture!

@jtydhr88 jtydhr88 force-pushed the graphMutationService branch from 6fc8ea6 to fcd7207 Compare August 18, 2025 23:54
@jtydhr88
Copy link
Collaborator Author

This looks great! The centralized graph mutation service is exactly what we need.

To align with our new domain-driven refactoring (see #5071), could we move these files to:

src/core/graph/operations/
├── graphMutationService.ts
└── IGraphMutationService.ts

This places graph operations in the core/ domain where they belong (pure business logic), rather than in the services/ technical layer we're moving away from.

The implementation itself looks perfect - just needs the folder adjustment to match our new architecture!

Done

@github-actions
Copy link

github-actions bot commented Aug 21, 2025

🎭 Playwright Test Results

All tests passed!

⏰ Completed at: 09/19/2025, 07:41:23 PM UTC

📈 Summary

  • Total Tests: 450
  • Passed: 421 ✅
  • Failed: 0
  • Flaky: 0
  • Skipped: 29 ⏭️

📊 Test Reports by Browser

  • chromium: View Report • ✅ 414 / ❌ 0 / ⚠️ 0 / ⏭️ 29
  • chromium-2x: View Report • ✅ 2 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • chromium-0.5x: View Report • ✅ 1 / ❌ 0 / ⚠️ 0 / ⏭️ 0
  • mobile-chrome: View Report • ✅ 4 / ❌ 0 / ⚠️ 0 / ⏭️ 0

🎉 Click on the links above to view detailed test results for each browser configuration.

@github-actions
Copy link

github-actions bot commented Aug 21, 2025

🎨 Storybook Build Status

Build completed successfully!

⏰ Completed at: 08/21/2025, 03:24:29 AM UTC

📊 Build Summary

  • Components: 13
  • Stories: 52
  • Visual changes: 0
  • Errors: 0

🔗 Links


🎉 Your Storybook is ready for review!

Copy link
Contributor

@christian-byrne christian-byrne left a comment

Choose a reason for hiding this comment

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

This looks great. I left some possible suggestions. Also, as discussed offline, we will be integrating the command pattern to make it compatible with CRDT system like below pseudo code

interface GraphMutationCommand {
  type: string
  params: sometype
  timestamp: number
  origin: string
}

private createCommand(operation: string, params: sometype): GraphMutationCommand {
  return {
    type: operation,
    params,
    timestamp: Date.now(),
    origin: 'local'  // Will become peer ID in collaborative mode
  }
}

I also realized we might want to track direct access to nodes that circumvent the mutation service and add deprecation warnings.

class GraphMutationService {
  private warnDirectAccess(context: string) {
    console.warn(
      `Direct LiteGraph access detected in ${context}. ` +
      `Consider using GraphMutationService for better compatibility. ` +
      `Direct access will be deprecated in a future version`
    )
  }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

Some other edge cases we could cover:

  it('should handle canvas null scenarios gracefully', () => {
    // Test service behavior when canvas is not initialized
  })

  it('should handle subgraph context switching', () => {
    // Test mutations during subgraph navigation
    // Based on widget configuration patterns documented
  })

  it('should preserve link IDs across subgraph operations', () => {
    // Based on "Link ID Changes in Subgraphs" pattern
  })

@jtydhr88 jtydhr88 force-pushed the graphMutationService branch from 8c99304 to b58fe11 Compare September 18, 2025 01:38
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Sep 18, 2025
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to keep this markdown doc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we can remove it from source, and move it to notion, but it is easy to update here, lets keep it in source for now, I will remove it until we merge

Comment on lines 159 to 161
if (id !== undefined) {
node.id = id
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@DrJKL DrJKL self-assigned this Sep 19, 2025
@DrJKL
Copy link
Contributor

DrJKL commented Oct 9, 2025

I think I'd like to put this on pause for now. I think there's a lot that will change in how we're managing the state of the underlying graph(s) and crystallizing the current patterns will become more of a maintenance burden. WDYT @jtydhr88 ?

@DrJKL DrJKL assigned jtydhr88 and unassigned DrJKL Oct 9, 2025
@snomiao
Copy link
Member

snomiao commented Oct 25, 2025

@jtydhr88 lmk if you want a claude-auto-rebase XD

@jtydhr88 jtydhr88 closed this Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:vue-migration size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants