-
Notifications
You must be signed in to change notification settings - Fork 449
fix: feature flags and manager state handling #5317
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
🎭 Playwright Test Results✅ All tests passed across all browsers! ⏰ Completed at: 09/06/2025, 12:19:06 PM UTC 📊 Test Reports by Browser🎉 Your tests are passing across all browsers! |
a44c523 to
88c4169
Compare
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.
Nice, thank you.
Some added clarification:
During Beta (previous)
- There was a single manager python server
- We needed to support using the old manager and new manager in a single frontend client session
- To do this, we created a new manager server API version
After Release (now)
- There are two manager python server packages. If the user is using
legacy, the legacy server is initialized. If not, the new manager server is initialized. - On the frontend
- If legacy -> the legacy manager JS code is initialized. ComfyUI_frontend can simply disable all manager features
- if disabled -> no manager JS code is initialized, no manager python server is initialized, ComfyUI_frontend can simply disable all of its manager features
- else -> the legacy manager JS code is not initialized, ComfyUI_frontend only needs to support the new manager API version, doesn't need to worry about using interceptor or dynamically setting Axios client base URL
88c4169 to
80d8652
Compare
1) Centralized “Open Manager” logic
2) New openManager() options3) Bug fixes
🔍 Files changed
✅ Verification
|
|
I think if we're going to have non-reactive utilities like this, they should probably be separated from the stores. Maybe something in |
209decc to
bfcc77b
Compare
Refactoring: managerStateStore → useManagerState composableThank you for the feedback! @DrJKL is absolutely right about this. Issue
SolutionConverted the Store to a Composable: Changes:
Benefits:
Since Manager UI state doesn't change during runtime and is just a utility checking feature flags and command line args, a composable is the more appropriate pattern. |
786d713 to
0805125
Compare
e29d538 to
5073ba8
Compare
5073ba8 to
a757b43
Compare
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 PR is really clean thanks for organizing this.
b5a6adb to
f6852b0
Compare
- Convert all getter methods to readonly computed properties - Follows Vue conventions for better performance through caching - Change access pattern from function calls to .value properties - Update all usages across 6 files - Thanks to @DrJKL for the suggestion This improves performance by caching computed values and aligns with Vue's reactive system patterns.
…e-effects of calling useConflictDetection which include calling useComfyManagerStore
… tests - Add mockManagerDisabled parameter to ComfyPage.setup() (defaults to true) - Override api.getServerFeature() to return false for manager feature flag - Prevents manager initialization from interfering with subgraph tests - Individual tests can still enable manager when needed by passing mockManagerDisabled: false
## Problem GraphCanvas.vue was initializing conflict detection during component setup, causing side effects in test environment where manager is disabled. This led to 4 Playwright test failures in PR #5317. ## Root Cause - GraphCanvas.vue called useConflictDetection() in setup phase - This triggered store side effects even when manager was disabled - systemStats wasn't ready when checking manager state ## Solution 1. Removed conflict detection initialization from GraphCanvas.vue entirely 2. Refactored systemStatsStore to use VueUse's useAsyncState pattern 3. Added isInitialized check in useManagerState to wait for systemStats 4. Updated useConflictDetection to check manager state internally ## Changes - **GraphCanvas.vue**: Removed all conflict detection code - **systemStatsStore**: Implemented useAsyncState for proper async handling - **useManagerState**: Added isInitialized check before checking manager state - **useConflictDetection**: Added internal manager state validation - **App.vue**: Removed unnecessary fetchSystemStats calls - **Tests**: Updated unit tests for new async behavior ## Test Results All 4 previously failing Playwright tests now pass: - featureFlags.spec.ts (feature flag handling) - subgraph.spec.ts (breadcrumb updates, DOM cleanup) - widget.spec.ts (image changes) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
…new ui & call legacy ui, open new manger dialog by default
The test was failing because it was mocking systemStats and isInitialized as plain values instead of reactive refs. The actual composable uses storeToRefs which returns refs with .value properties. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
56a2539 to
1974b1f
Compare
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.
LGTM!
|
@viva-jinyi Backport to Please manually cherry-pick commit Conflicting files
|
* fix: Replace reactive feature flags with non-reactive approach - Changed managerUIState from computed to getManagerUIState() function - Ensures fresh computation on each call to avoid timing issues - Updates all consumers to use the new function-based approach - Fixes manager UI state determination issues This change addresses the reactivity issues where feature flags were not updating properly due to Vue's reactive system limitations with external API values. * fix: Add HelpCenter manager state handling and API version switching - Fixed HelpCenter manager extension to check manager state - Fixed 'Manager' command to respect manager state - Added dynamic API prefix switching based on manager state - Added debug logging for manager state determination This ensures legacy manager uses /api/ prefix and new manager uses /api/v2/ prefix * fix: Simplify manager state determination and fix API timing issues - Remove unnecessary extension check from manager state store - Use only feature flags (client and server) for state determination - Default to NEW_UI when server flags not loaded (safer default) - Fix ImportFailInfoBulk to not send empty requests - Resolves initial 404 errors on installed API calls * fix: Correct manager state determination for non-v4 servers - Fix serverSupportsV4=false returning DISABLED instead of LEGACY_UI - Server without v4 support should use legacy manager, not disable it - Clarify condition for server v4 + client non-v4 case * chore: Remove debug console.log statements - Remove all debug logging from manager state store - Remove logging from comfy manager service - Clean up code for production * test: Update manager state store tests to match new logic - Update test expectations for server feature flags undefined case (returns NEW_UI) - Update test expectations for server not supporting v4 case (returns LEGACY_UI) - Tests now correctly reflect the actual behavior of the manager state logic * fix: Remove dynamic API version handling in manager service - Remove getApiBaseURL() function and axios interceptor - Always use /api/v2/ for New Manager (hardcoded) - Add isManagerServiceAvailable() to block service calls when not in NEW_UI state - Simplify API handling as manager packages are now completely separated * refactor: Add helper functions to managerStateStore for better code reuse - Add isManagerEnabled(), isNewManagerUI(), isLegacyManagerUI() helpers - Add shouldShowInstallButton(), shouldShowManagerButtons() for UI logic - Update components to use helper functions where applicable - Add comprehensive tests for new helper functions - Centralize state checking logic to reduce duplication * fix: Ensure SystemStats is loaded before conflict detection - Move conflict detection from App.vue to GraphCanvas.vue - Check manager state before running conflict detection - Ensures SystemStats and feature flags are loaded first - Prevents unnecessary API calls when manager is disabled * docs: Clarify feature flag default behavior in manager state - Add detailed comments explaining why NEW_UI is the default - Clarify that undefined state is temporary during WebSocket connection - Document graceful error handling when server doesn't support v2 API * fix: Ensure consistent manager state handling for legacy commands - Legacy commands now show error toast in NEW_UI mode - Settings fallback for DISABLED mode - Consistent error handling across all manager entry points - Legacy commands only work in LEGACY_UI mode as expected * refactor: centralize manager opening logic into managerStateStore - Create openManager() function in managerStateStore to eliminate duplicate code - Replace 8+ repeated switch statements across different files with single function - Fix inconsistency where legacy command failure in LEGACY_UI mode incorrectly opened new manager - Add support for legacy-only commands that should show error in NEW_UI mode - Ensure all manager entry points behave consistently according to feature flags - Clean up unused imports and fix ESLint errors This addresses Christian's code review feedback about duplicate switch statements and improves maintainability by providing a single source of truth for manager opening logic. * fix: use correct i18n import in managerStateStore - Replace useI18n with direct t import from @/i18n - Fixes issue where error messages showed as numbers (e.g. '26') instead of text - Ensures toast messages display correctly in NEW_UI mode when legacy commands are invoked * feature: initial tab fix * test: Fix managerStateStore test failures by adding missing mocks The test was failing because managerStateStore imports dialogService, which imports ErrorDialogContent.vue that instantiates the app object. This caused api.addEventListener errors in tests. Added proper mocks for: - dialogService - commandStore - toastStore This prevents the problematic import chain and fixes the test failures. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * refactor: convert managerStateStore to composable - Move managerStateStore from store to composable pattern - All functions are non-reactive utilities that don't need state management - Follows Pinia guideline: "If it's not reactive, it shouldn't be in a store" - Update all import paths across 8 files - Move and update test file accordingly This change improves architecture consistency as other utility functions in the codebase also use composables rather than stores when reactivity is not required. * refactor: use readonly computed properties instead of getter methods - Convert all getter methods to readonly computed properties - Follows Vue conventions for better performance through caching - Change access pattern from function calls to .value properties - Update all usages across 6 files - Thanks to @DrJKL for the suggestion This improves performance by caching computed values and aligns with Vue's reactive system patterns. * fix: check isManagerEnabled check to GraphCanvas.vue to avoid the side-effects of calling useConflictDetection which include calling useComfyManagerStore * chore: console.log to console.debug * chore: useConflictDetection().initializeConflictDetection() * test: add mockManagerDisabled option to disable manager in Playwright tests - Add mockManagerDisabled parameter to ComfyPage.setup() (defaults to true) - Override api.getServerFeature() to return false for manager feature flag - Prevents manager initialization from interfering with subgraph tests - Individual tests can still enable manager when needed by passing mockManagerDisabled: false * chore: text modified * fix: resolve CI/CD failures by fixing manager initialization timing ## Problem GraphCanvas.vue was initializing conflict detection during component setup, causing side effects in test environment where manager is disabled. This led to 4 Playwright test failures in PR #5317. ## Root Cause - GraphCanvas.vue called useConflictDetection() in setup phase - This triggered store side effects even when manager was disabled - systemStats wasn't ready when checking manager state ## Solution 1. Removed conflict detection initialization from GraphCanvas.vue entirely 2. Refactored systemStatsStore to use VueUse's useAsyncState pattern 3. Added isInitialized check in useManagerState to wait for systemStats 4. Updated useConflictDetection to check manager state internally ## Changes - **GraphCanvas.vue**: Removed all conflict detection code - **systemStatsStore**: Implemented useAsyncState for proper async handling - **useManagerState**: Added isInitialized check before checking manager state - **useConflictDetection**: Added internal manager state validation - **App.vue**: Removed unnecessary fetchSystemStats calls - **Tests**: Updated unit tests for new async behavior ## Test Results All 4 previously failing Playwright tests now pass: - featureFlags.spec.ts (feature flag handling) - subgraph.spec.ts (breadcrumb updates, DOM cleanup) - widget.spec.ts (image changes) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * chore: modified the note * fix: test code modified * fix: when manager is new manager ui, conflict detectetion should work * fix: ensure fetch system stats before determine manager stats & when new ui & call legacy ui, open new manger dialog by default * chore: unnecessary .value deleted & fetch name modified to refetch * fix: ref type .value needed * chore: vue use until pattern for waiting initializing * fix: .value added * fix: useManagerState test to properly mock reactive refs The test was failing because it was mocking systemStats and isInitialized as plain values instead of reactive refs. The actual composable uses storeToRefs which returns refs with .value properties. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: when system stats initialized, use until(systemStatsStore.isInitialized) * fix: test --------- Co-authored-by: Claude <[email protected]>
Summary
Fix ComfyUI Manager feature flag reactivity issues and improve manager state determination logic.
Changes
1. Replace reactive feature flags with non-reactive approach (72cb4d2)
managerUIStatefrom computed property togetManagerUIState()function2. Add HelpCenter manager state handling and API version switching (0cc07bd)
/api/for legacy,/api/v2/for new)3. Simplify manager state determination and fix API timing issues (45de89e)
4. Correct manager state for non-v4 servers (f00eff2)
Testing
Type of Change
Fixes #5316