fix: remove test settings from production schema

Remove 5 test setting IDs that were incorrectly added to the production
apiSchema.ts. Test settings now use `as TestSettingId` casts in test
files instead of polluting the production Settings type.

Changes:
- Remove TestSetting, TestHiddenSetting, TestDeprecatedSetting,
  TestVisibleSetting, Comfy.TestSetting from apiSchema.ts
- Add TestSettingId type helper to extensionAPI.spec.ts and
  useSettingSearch.spec.ts
- Use specific `as TestSettingId` casts with explanatory comments

This keeps production types clean while allowing tests to register
arbitrary setting IDs (which is valid extension behavior).

Amp-Thread-ID: https://ampcode.com/threads/T-019c1833-2352-728b-a523-a8f440fd3ba1
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-02-01 00:30:27 -08:00
parent c411bfca75
commit 4b95f22737
3 changed files with 29 additions and 11 deletions

View File

@@ -1,8 +1,17 @@
import { expect } from '@playwright/test'
import type { Settings } from '../../src/schemas/apiSchema'
import type { SettingParams } from '../../src/platform/settings/types'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
/**
* Type helper for test settings with arbitrary IDs.
* Extensions can register settings with any ID, but SettingParams.id
* is typed as keyof Settings for autocomplete. This helper allows
* arbitrary IDs in tests while keeping type safety for other fields.
*/
type TestSettingId = keyof Settings
test.describe('Topbar commands', () => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Top')
@@ -87,7 +96,8 @@ test.describe('Topbar commands', () => {
name: 'TestExtension1',
settings: [
{
id: 'TestSetting',
// Extensions can register arbitrary setting IDs
id: 'TestSetting' as TestSettingId,
name: 'Test Setting',
type: 'text',
defaultValue: 'Hello, world!',
@@ -117,7 +127,8 @@ test.describe('Topbar commands', () => {
name: 'TestExtension1',
settings: [
{
id: 'Comfy.TestSetting',
// Extensions can register arbitrary setting IDs
id: 'Comfy.TestSetting' as TestSettingId,
name: 'Test Setting',
type: 'boolean',
defaultValue: false,
@@ -202,7 +213,8 @@ test.describe('Topbar commands', () => {
name: 'TestExtension1',
settings: [
{
id: 'Comfy.TestSetting',
// Extensions can register arbitrary setting IDs
id: 'Comfy.TestSetting' as TestSettingId,
name: 'Test',
attrs: { disabled: true },
...config