-
Notifications
You must be signed in to change notification settings - Fork 449
graph mutation service implementation #5074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
test broken...
|
|
@snomiao it doesn’t likely caused by my changes, for the frontend, I only modified change node title |
|
let me click update branch to see if it's flaky test |
For headless tests, this widget.spec.ts has been flaky on my end but works on ui mode
|
|
I think we have to add auto retry for flaky tests. |
christian-byrne
left a comment
There was a problem hiding this 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!
6fc8ea6 to
fcd7207
Compare
Done |
🎭 Playwright Test Results✅ All tests passed! ⏰ Completed at: 09/19/2025, 07:41:23 PM UTC 📈 Summary
📊 Test Reports by Browser
🎉 Click on the links above to view detailed test results for each browser configuration. |
🎨 Storybook Build Status✅ Build completed successfully! ⏰ Completed at: 08/21/2025, 03:24:29 AM UTC 📊 Build Summary
🔗 Links🎉 Your Storybook is ready for review! |
christian-byrne
left a comment
There was a problem hiding this 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`
)
}
}There was a problem hiding this comment.
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
})8c99304 to
b58fe11
Compare
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
| if (id !== undefined) { | ||
| node.id = id | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
|
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 ? |
|
@jtydhr88 lmk if you want a claude-auto-rebase XD |
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
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