mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-03 22:59:14 +00:00
feat: enable linear mode toggle for nightly builds (#8569)
Enables the linear mode toggle for all nightly build users by short-circuiting the `linearToggleEnabled` feature flag. ## Changes - Adds `isNightly` check in `linearToggleEnabled` getter - Returns `true` for nightly builds, bypassing remote config/server feature checks - Adds unit tests for the new behavior ## Reviewers - @AustinMroz (linear mode maintainer) - @christian-byrne (isNightly author) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-8569-feat-enable-linear-mode-toggle-for-nightly-builds-2fc6d73d3650819681f8dcdc23b6eefe) by [Unito](https://www.unito.io) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Enabled linear toggle feature for nightly distribution builds. * Feature flag system now respects nightly vs. standard build configurations. * **Tests** * Added test coverage for nightly build feature flag behavior and remote configuration handling. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
ServerFeatureFlag,
|
||||
useFeatureFlags
|
||||
} from '@/composables/useFeatureFlags'
|
||||
import * as distributionTypes from '@/platform/distribution/types'
|
||||
import { api } from '@/scripts/api'
|
||||
|
||||
// Mock the API module
|
||||
@@ -14,6 +15,12 @@ vi.mock('@/scripts/api', () => ({
|
||||
}
|
||||
}))
|
||||
|
||||
// Mock the distribution types module
|
||||
vi.mock('@/platform/distribution/types', () => ({
|
||||
isCloud: false,
|
||||
isNightly: false
|
||||
}))
|
||||
|
||||
describe('useFeatureFlags', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
@@ -131,4 +138,41 @@ describe('useFeatureFlags', () => {
|
||||
expect(maxUploadSize.value).toBe(104857600)
|
||||
})
|
||||
})
|
||||
|
||||
describe('linearToggleEnabled', () => {
|
||||
it('should return true when isNightly is true', () => {
|
||||
vi.mocked(distributionTypes).isNightly = true
|
||||
|
||||
const { flags } = useFeatureFlags()
|
||||
expect(flags.linearToggleEnabled).toBe(true)
|
||||
expect(api.getServerFeature).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('should check remote config and server feature when isNightly is false', () => {
|
||||
vi.mocked(distributionTypes).isNightly = false
|
||||
vi.mocked(api.getServerFeature).mockImplementation(
|
||||
(path, defaultValue) => {
|
||||
if (path === ServerFeatureFlag.LINEAR_TOGGLE_ENABLED) return true
|
||||
return defaultValue
|
||||
}
|
||||
)
|
||||
|
||||
const { flags } = useFeatureFlags()
|
||||
expect(flags.linearToggleEnabled).toBe(true)
|
||||
expect(api.getServerFeature).toHaveBeenCalledWith(
|
||||
ServerFeatureFlag.LINEAR_TOGGLE_ENABLED,
|
||||
false
|
||||
)
|
||||
})
|
||||
|
||||
it('should return false when isNightly is false and flag is disabled', () => {
|
||||
vi.mocked(distributionTypes).isNightly = false
|
||||
vi.mocked(api.getServerFeature).mockImplementation(
|
||||
(_path, defaultValue) => defaultValue
|
||||
)
|
||||
|
||||
const { flags } = useFeatureFlags()
|
||||
expect(flags.linearToggleEnabled).toBe(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { computed, reactive, readonly } from 'vue'
|
||||
|
||||
import { isCloud } from '@/platform/distribution/types'
|
||||
import { isCloud, isNightly } from '@/platform/distribution/types'
|
||||
import {
|
||||
isAuthenticatedConfigLoaded,
|
||||
remoteConfig
|
||||
@@ -65,6 +65,8 @@ export function useFeatureFlags() {
|
||||
)
|
||||
},
|
||||
get linearToggleEnabled() {
|
||||
if (isNightly) return true
|
||||
|
||||
return (
|
||||
remoteConfig.value.linear_toggle_enabled ??
|
||||
api.getServerFeature(ServerFeatureFlag.LINEAR_TOGGLE_ENABLED, false)
|
||||
|
||||
Reference in New Issue
Block a user