Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions browser_tests/assets/inputs/boolean_input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"last_node_id": 1,
"last_link_id": 0,
"nodes": [
{
"id": 1,
"type": "PrimitiveBoolean",
"pos": [300, 200],
"size": [350, 240],
"flags": {},
"order": 0,
"mode": 0,
"inputs": [],
"outputs": [
{
"name": "BOOLEAN",
"type": "BOOLEAN",
"links": []
}
],
"properties": {
"Node name for S&R": "PrimitiveBoolean"
},
"widgets_values": [true],
"title": "Boolean"
}
],
"links": [],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.8,
"offset": [0, 0]
}
},
"version": 0.4
}
49 changes: 49 additions & 0 deletions browser_tests/assets/inputs/checkpoint_loader.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"last_node_id": 4,
"last_link_id": 0,
"nodes": [
{
"id": 4,
"type": "CheckpointLoaderSimple",
"pos": [400, 300],
"size": [350, 240],
"flags": {},
"order": 0,
"mode": 0,
"outputs": [
{
"name": "MODEL",
"type": "MODEL",
"links": [],
"slot_index": 0
},
{
"name": "CLIP",
"type": "CLIP",
"links": [],
"slot_index": 1
},
{
"name": "VAE",
"type": "VAE",
"links": [],
"slot_index": 2
}
],
"properties": {
"Node name for S&R": "CheckpointLoaderSimple"
},
"widgets_values": ["sd_xl_base_1.0.safetensors"]
}
],
"links": [],
"groups": [],
"config": {},
"extra": {
"ds": {
"scale": 0.8,
"offset": [0, 0]
}
},
"version": 0.4
}
64 changes: 64 additions & 0 deletions browser_tests/tests/sidebar/modelLibrary.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,67 @@ test.describe('Model library sidebar - empty state', () => {
})
})
})

test.describe('Model library drops on Vue nodes', { tag: '@vue-nodes' }, () => {
test.use({ initialSettings: { 'Comfy.ModelLibrary.UseAssetBrowser': false } })

test.beforeEach(async ({ comfyPage }) => {
await comfyPage.modelLibrary.mockFoldersWithFiles(MOCK_FOLDERS)
await comfyPage.workflow.loadWorkflow('inputs/checkpoint_loader')
const tab = comfyPage.menu.modelLibraryTab
await tab.open()
await tab.refreshButton.click()
await tab.getFolderByLabel('checkpoints').click()
await expect(tab.getLeafByLabel('dreamshaper_8')).toBeVisible()
await comfyPage.command.executeCommand('Comfy.Canvas.FitView')
await comfyPage.canvasOps.waitForViewToSettle()
})

test.afterEach(async ({ comfyPage }) => {
await comfyPage.modelLibrary.clearMocks()
await comfyPage.canvasOps.resetView()
})

test('updates an existing loader without creating another node', async ({
comfyPage
}) => {
const [loader] = await comfyPage.nodeOps.getNodeRefsByType(
'CheckpointLoaderSimple'
)
const filename = await loader.getWidgetByName('ckpt_name')
const node = comfyPage.vueNodes.getNodeByTitle('Load Checkpoint')
const nodeCount = await comfyPage.nodeOps.getGraphNodesCount()
await comfyPage.menu.modelLibraryTab
.getLeafByLabel('dreamshaper_8')
.dragTo(node)
await comfyPage.nextFrame()
await expect(node).toContainText('dreamshaper_8.safetensors')
await expect
.poll(() => filename.getValue())
.toBe('dreamshaper_8.safetensors')
await expect
.poll(() => comfyPage.nodeOps.getGraphNodesCount())
.toBe(nodeCount)
})

test('still creates a loader when dropped onto empty canvas', async ({
comfyPage
}) => {
await comfyPage.menu.topbar.newWorkflowButton.click()
await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(0)
const box = (await comfyPage.canvas.boundingBox())!
await comfyPage.menu.modelLibraryTab
.getLeafByLabel('dreamshaper_8')
.dragTo(comfyPage.canvas, {
targetPosition: { x: box.width / 2, y: box.height / 2 }
})
await comfyPage.nextFrame()
await expect.poll(() => comfyPage.nodeOps.getGraphNodesCount()).toBe(1)
const [loader] = await comfyPage.nodeOps.getNodeRefsByType(
'CheckpointLoaderSimple'
)
await expect
.poll(async () => (await loader.getWidgetByName('ckpt_name')).getValue())
.toBe('dreamshaper_8.safetensors')
})
})
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import type { Locator } from '@playwright/test'

import {
comfyExpect as expect,
comfyPageFixture as test
} from '@e2e/fixtures/ComfyPage'
import { WidgetSelectDropdownFixture } from '@e2e/fixtures/components/WidgetSelectDropdown'
import { createMockJob } from '@e2e/fixtures/helpers/AssetsHelper'
import { TestIds } from '@e2e/fixtures/selectors'
import type { DraftPayloadV2 } from '@/platform/workflow/persistence/base/draftTypes'
import type { ComfyWorkflowJSON } from '@/platform/workflow/validation/schemas/workflowSchema'
import { assetPath } from '@e2e/fixtures/utils/paths'
import { mockViewFiles } from '@e2e/fixtures/utils/viewFileMocks'

Expand All @@ -16,6 +20,54 @@ test.describe(
await comfyPage.workflow.setupWorkflowsDirectory({})
})

test.describe('Boolean drafts', () => {
test.use({ initialSettings: { 'Comfy.Workflow.Persist': true } })

for (const { action, toggleValue } of [
{ action: 'click', toggleValue: (toggle: Locator) => toggle.click() },
{
action: 'Enter',
toggleValue: (toggle: Locator) => toggle.press('Enter')
}
]) {
test(`keeps a toggle-only ${action} edit after reload`, async ({
comfyPage
}) => {
await comfyPage.workflow.loadWorkflow('inputs/boolean_input')
await comfyPage.workflow.waitForDraftPersisted()
await comfyPage.workflow.reloadAndWaitForApp()
const toggle = comfyPage.vueNodes
.getNodeByTitle('Boolean')
.getByRole('switch')
await expect(toggle).toBeChecked()

await toggleValue(toggle)
await expect(toggle).not.toBeChecked()

await expect
.poll(() =>
comfyPage.page.evaluate(() => {
return Object.keys(localStorage).some((key) => {
if (!key.startsWith('Comfy.Workflow.Draft.v2:')) return false
const payload: DraftPayloadV2 = JSON.parse(
localStorage.getItem(key)!
)
const workflow: ComfyWorkflowJSON = JSON.parse(payload.data)
return workflow.nodes.some(
(node) =>
node.type === 'PrimitiveBoolean' &&
Object.values(node.widgets_values ?? {})[0] === false
)
})
})
)
.toBe(true)
await comfyPage.workflow.reloadAndWaitForApp()
await expect(toggle).not.toBeChecked()
})
}
})

test('an emptied text widget remains empty after save and reopen', async ({
comfyPage
}) => {
Expand Down
1 change: 1 addition & 0 deletions docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ An Architecture Decision Record captures an important architectural decision mad
| [TESTING-E2E-0027](TESTING-E2E-0027-coverage-measurement-and-test-selection.md) | E2E Coverage Measurement and Test Selection | Proposed | 2026-09-01 |
| [WEBSITE-ACCEPTANCE-0036](WEBSITE-ACCEPTANCE-0036-separate-live-customer-tests-from-offline-ci.md) | Separate live customer acceptance from offline CI | Proposed | 2026-09-21 |
| [WEBSITE-REQUESTS-0030](WEBSITE-REQUESTS-0030-creator-widgets-and-router-request-composition.md) | Creator widgets and Router request composition | Deprecated | 2026-09-09 |
| [WIDGET-GROUP-0031](WIDGET-GROUP-0031-dynamic-group-widget-lifecycle.md) | DynamicGroup Widget Lifecycle | Proposed | 2026-09-11 |
| [WIDGET-SERIALIZATION-0006](WIDGET-SERIALIZATION-0006-preserve-primitive-widget-values-across-copy-and-paste.md) | PrimitiveNode Widget Restoration Lifecycle | Accepted | 2026-02-22 |
| [WORKSHOP-TELEMETRY-0034](WORKSHOP-TELEMETRY-0034-browser-delivery-health.md) | Browser delivery health for Models | Proposed | 2026-09-18 |
| [WORKSHOP-VALIDATION-0036](WORKSHOP-VALIDATION-0036-declarative-input-constraints.md) | Declarative input constraints | Proposed | 2026-09-22 |
Expand Down
62 changes: 62 additions & 0 deletions docs/adr/WIDGET-GROUP-0031-dynamic-group-widget-lifecycle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# ADR-WIDGET-GROUP-0031: DynamicGroup Widget Lifecycle

Date: 2026-09-11

## Status

Proposed

## Context

DynamicGroup repeats a backend widget template. Its row count is workflow state;
execution consumes individually named fields. A group can sit between ordinary
widgets or inside a DynamicCombo option, so restoration must create its fields
before the following saved values are applied.

## Decision

DynamicGroup editing is Node 2.0-only. Group fields and presentation controls
are excluded from the legacy canvas through widget surface visibility. Shared
restoration and serialization remain active so switching renderers does not
remove stored rows or values. Each group has one non-interactive canvas notice
identifying it as Node 2.0-only, regardless of its row count. The notice is excluded
from workflow values and prompts and hidden in Node 2.0 and the properties panel.

Use ordinary widgets and their existing store, renderer and prompt serializer
for each field. A hidden, workflow-serialized controller precedes the fields and
recreates rows when its saved count is assigned. It retains that count while a
containing DynamicCombo detaches the widgets to cache their values.

Row headers and the add button are presentation widgets excluded from both
workflow values and execution. The count is also excluded from execution.
Deleting a row renumbers the remaining fields and preserves their values and
connections. API import restores submitted rows in encounter order with contiguous
indices, including rows exceeding `max`. Saving and reloading preserves those
rows. Adding a row remains disabled at or above `max`; execution validity belongs
to backend validation. Restoration uses the common positional or named binding:
missing values retain defaults, and values beyond the current widgets are unused.
Template changes do not trigger a group-specific value-count or type check;
positional saves can therefore shift values when a template changes. Allocation
rejects row counts exceeding both the configured maximum and the number of saved
widget values, without requiring values for every current field. Invalid group
definitions fail construction so the existing error-node restoration retains
the original workflow data.

Reject a second group-owned value store or a composite widget that renders its
children itself: both would duplicate existing restoration, error, link and
visibility handling. Group fields resolve their original template definitions
so combo refresh and later row creation see the same options.

## Consequences

### Positive

Field widgets retain the common editing, error and persistence behavior without
new node instance properties or a separate workflow format.

### Negative

The controller must precede its fields in serialized widget order. Presentation
widgets require unique names but must never become backend input keys. This
feature covers widget templates; socket-only and nested dynamic templates are
outside the backend contract.
69 changes: 69 additions & 0 deletions packages/object-info-parser/src/__tests__/nodeDefSchema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,75 @@ const EXAMPLE_NODE_DEF: ComfyNodeDef = {
}

describe('validateNodeDef', () => {
it.for([
{ min: 2, max: 1 },
{ max: 21 },
{ max: -1 },
{ min: 0.5 },
{ template: 'invalid' },
{ template: {} },
{
template: {
required: {
nested: [
'COMFY_DYNAMICGROUP_V3',
{ min: 1, template: { required: { value: ['STRING', {}] } } }
]
}
}
},
{ template: { required: { nested: ['COMFY_AUTOGROW_V3', {}] } } },
{ template: { required: { nested: ['COMFY_DYNAMICCOMBO_V3', {}] } } },
{ template: { required: { value: ['FLOAT', { forceInput: true }] } } },
{ template: { required: { 'bad.name': ['STRING', {}] } } },
{
template: {
required: { value: ['STRING', {}] },
optional: { value: ['STRING', {}] }
}
}
])(
'rejects malformed DynamicGroup definitions at the boundary: %j',
(options) => {
expect(
validateComfyNodeDef(
{
...EXAMPLE_NODE_DEF,
input: {
required: {
rows: [
'COMFY_DYNAMICGROUP_V3',
{
template: { required: { value: ['STRING', {}] } },
...options
}
]
}
}
},
() => {}
)
).toBeNull()
}
)

it('retains valid DynamicGroup template options and supplies count defaults', () => {
const template = {
required: {
model: ['COMBO', { remote: { route: '/models', refresh_button: true } }]
},
optional: { strength: ['FLOAT', { default: 1 }] }
}
const parsed = validateComfyNodeDef({
...EXAMPLE_NODE_DEF,
input: { required: { rows: ['COMFY_DYNAMICGROUP_V3', { template }] } }
})
expect(parsed?.input?.required?.rows).toEqual([
'COMFY_DYNAMICGROUP_V3',
{ template, min: 0, max: 20 }
])
})

it('accepts a valid node definition', () => {
expect(validateComfyNodeDef(EXAMPLE_NODE_DEF)).not.toBeNull()
})
Expand Down
Loading
Loading