Repository navigation
feat(subgraph): Subgraph Link Only Promotion (ADR 0009) + migration/store hygiene - #12197
Conversation
Replaces planner/classifier/repair/quarantine helpers and their tests with a single proxyWidgetMigration module exercised through black-box round-trip tests. Hook registry indirection replaced with a static LGraph.proxyWidgetMigrationFlush field assigned in main.ts. Includes a real semantic fix: classifier now preserves surviving primitive targets when other targets are dangling. Net: -16 files, ~-2,300 LoC in src/core/graph/subgraph/migration/.
…rialize tests - 3-key promoted-view cache replaced with a single version counter; exposes invalidatePromotedViews() so promotionUtils can call it at the actual mutation site (the missing invalidation was the bug the multi-key cache was masking). - Inline single-use key builders into _getPromotedViews. - Drop id===-1 sentinel guard in clipboard path by fixing construction order: clone path now assigns id before configure(). - SubgraphNode.serialize.test.ts merged into SubgraphWidgetPromotion.test.ts as table-driven round-trip invariants, replacing spy-on-private assertions.
Adds the four node trigger event payloads (property/slot-errors/ slot-links/slot-label) to LGraphEventMap and makes LGraph.trigger() dispatch via this.events in addition to calling onTrigger. Removes the leaky onTrigger monkey-patch in AppModeWidgetList.vue, replacing it with useEventListener on the events target. The onTrigger callback path is preserved for back-compat with useGraphNodeManager (see FE-667 for converting that one too).
- appModeStore: collapse 4 legacy-tuple migration helpers into one upgradeAndValidateInput; pruneLinearData becomes a thin map+filter. - nodeOutputStore: derive *ByExecutionId from the locator index instead of mirroring state. - previewExposureStore: demote unused ResolveNestedHostFn export to a local type. - Inline two trivial wrapper modules (resolvePromotedWidgetSource, previewExposureTypes) into their primary consumers. - previewExposureChain: strip JSDoc, extract leaf builder helper, fix double-warn bug on cycle detection.
- SubgraphEditor.test.ts: drop 4 reorder/serialize tests that duplicated coverage already in promotionUtils.test.ts and SubgraphWidgetPromotion.test.ts; keep the unique preview-exposure rendering test. - useGraphNodeManager.test.ts: add test verifying duplicate-named promoted widgets retain distinct storeNodeId identities (ADR 0009). - WidgetActions.test.ts: add test covering handleHideInput per-parent demote branch with sourceNodeId computed from node.id===parent.id.
Amp-Thread-ID: https://ampcode.com/threads/T-019e1d98-44cc-7459-bcc5-cc4f0d3b4268 Co-authored-by: Amp <amp@ampcode.com>
When a host SubgraphNode's child has deduplicated promoted widget names (e.g. `text`, `text_1`), the legacy `proxyWidgets` migration was matching only by widget name and always picked the first widget. The third tuple element (source-node id disambiguator, e.g. `["3", "text", "2"]`) was preserved in the normalized entry but never consulted during resolution, so outer subgraph nodes ended up exposing the wrong interior widget. Add `findSourceWidget` that prefers a `PromotedWidgetView` whose interior identity (`sourceNodeId`, `sourceWidgetName`) matches the disambiguator, falling back to a name match. Wire it into `classify` and `repairCreateSubgraphInput`. Update the existing browser test to actually inspect the outer subgraph node's exposed widget value (the previous assertion only checked the inner node, so it passed against the regression). Add a unit test for the disambiguator path. Re-flip the "deep leaf" SubgraphWidgetPromotion test to assert resolution via the immediate child's PromotedWidgetView identity, which is the correct behavior under ADR 0009. Amp-Thread-ID: https://ampcode.com/threads/T-019e1db0-3c55-75fe-a542-8bfcbcf87d60 Co-authored-by: Amp <amp@ampcode.com>
Tag the duplicate-widget-names test with @vue-nodes and use DOM
locators (`getNodeLocator`, `getByRole('textbox')`, `enterSubgraph`)
instead of `page.evaluate`-based graph introspection. The outer
node assertion now checks the rendered textbox value directly, and
the inner node assertion enters the outer subgraph and reads the
two distinguishable text inputs from the inner SubgraphNode in the
DOM.
Amp-Thread-ID: https://ampcode.com/threads/T-019e1db0-3c55-75fe-a542-8bfcbcf87d60
Co-authored-by: Amp <amp@ampcode.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughLarge ADR-0009 change: remove PromotionStore, add PreviewExposureStore and WidgetEntityId; implement proxyWidgets migration and new preview exposure pipeline; refactor promoted-widget identity/resolution, SubgraphNode serialization, LGraph hooks, stores, UI components, scripts, and extensive tests/browser fixtures. ChangesADR 0009 implementation
Estimated code review effort: 🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related issues
Possibly related PRs
Suggested labels Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
|
…ed-widget-ratchet-squashed Amp-Thread-ID: https://ampcode.com/threads/T-019e1e0b-1b64-778a-9cbc-e2675fe6a11b Co-authored-by: Amp <amp@ampcode.com> # Conflicts: # src/schemas/nodeDefSchema.ts # src/stores/nodeOutputStore.ts
🎨 Storybook: ✅ Built — View Storybook |
🎭 Playwright: ✅ 1641 passed, 0 failed · 1 flaky📊 Browser Reports
|
📦 Bundle: 5.39 MB gzip 🔴 +11.2 kBDetailsSummary
Category Glance App Entry Points — 45.5 kB (baseline 26.1 kB) • 🔴 +19.4 kBMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.24 MB (baseline 1.24 MB) • 🔴 +5.37 kBGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed Views & Navigation — 82.6 kB (baseline 82.9 kB) • 🟢 -297 BTop-level views, pages, and routed surfaces
Status: 11 added / 11 removed Panels & Settings — 527 kB (baseline 527 kB) • 🟢 -196 BConfiguration panels, inspectors, and settings screens
Status: 24 added / 24 removed User & Accounts — 17.7 kB (baseline 17.8 kB) • 🟢 -107 BAuthentication, profile, and account management bundles
Status: 7 added / 7 removed Editors & Dialogs — 112 kB (baseline 112 kB) • 🟢 -5 BModals, dialogs, drawers, and in-app editors
Status: 4 added / 4 removed UI Components — 58 kB (baseline 58 kB) • 🟢 -4 BReusable component library chunks
Status: 13 added / 13 removed Data & Services — 262 kB (baseline 3.16 MB) • 🟢 -2.9 MBStores, services, APIs, and repositories
Status: 17 added / 17 removed Utilities & Hooks — 3.28 MB (baseline 367 kB) • 🔴 +2.91 MBHelpers, composables, and utility bundles
Status: 31 added / 31 removed Vendor & Third-Party — 9.95 MB (baseline 9.94 MB) • 🔴 +84 BExternal libraries and shared vendor chunks
Status: 13 added / 13 removed / 3 unchanged Other — 9.23 MB (baseline 9.23 MB) • 🟢 -481 BBundles that do not match a named category
Status: 139 added / 140 removed / 3 unchanged ⚡ Performance
|
There was a problem hiding this comment.
Actionable comments posted: 13
🧹 Nitpick comments (2)
src/core/graph/subgraph/preview/previewExposureChain.test.ts (1)
12-12: 💤 Low valueRemove redundant
FixtureExposureinterface.The
FixtureExposureinterface extendsPreviewExposurewithout adding any fields. UsePreviewExposuredirectly in the test fixture types instead.♻️ Simplify by removing the redundant interface
-interface FixtureExposure extends PreviewExposure {} - interface NestedHostMapping {Then update line 22:
function makeContext( - exposureMap: Map<string, FixtureExposure[]>, + exposureMap: Map<string, PreviewExposure[]>, nested: NestedHostMapping[]Based on learnings: In TypeScript test files, avoid duplicating interface/type definitions. Import real type definitions from the component modules under test.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/graph/subgraph/preview/previewExposureChain.test.ts` at line 12, Remove the redundant FixtureExposure interface declaration (which merely extends PreviewExposure) and update the test fixture type annotations to use PreviewExposure directly (replace any FixtureExposure references with PreviewExposure). Delete the "interface FixtureExposure extends PreviewExposure {}" line and ensure PreviewExposure is imported from the module under test if it isn't already, then run type checks to confirm no remaining references to FixtureExposure remain.src/core/graph/subgraph/migration/proxyWidgetMigration.test.ts (1)
454-475: ⚡ Quick winAssert the surviving link, not just counters, in the dangling-link regression case
This case’s name claims surviving primitive targets are kept, but it only checks
primitiveRepaired/quarantined. Add a direct assertion that the valid target link still exists after flush.Suggested patch
- it('keeps surviving primitive targets when one fan-out link is dangling', () => { + it('keeps surviving primitive targets when one fan-out link is dangling', () => { const host = buildHost() - const { primitive } = addPrimitiveWithTargets(host, { targetCount: 1 }) + const { primitive, targets } = addPrimitiveWithTargets(host, { + targetCount: 1 + }) const danglingLinkId = 999_999 expect(host.subgraph.links.has(danglingLinkId)).toBe(false) @@ expect(result).toMatchObject({ primitiveRepaired: 0, quarantined: 1 }) + const survivingLinkId = targets[0].inputs[0].link + expect(survivingLinkId).not.toBeNull() + expect(host.subgraph.links.has(survivingLinkId!)).toBe(true) expect(readHostQuarantine(host)).toEqual([ expect.objectContaining({ originalEntry: [String(primitive.id), 'value'], reason: 'primitiveBypassFailed' }) ]) })As per coding guidelines: “Write tests for all changes, especially bug fixes to catch future regressions.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/core/graph/subgraph/migration/proxyWidgetMigration.test.ts` around lines 454 - 475, The test currently only checks primitiveRepaired/quarantined counters; add an assertion that the surviving valid target link is still present after calling flushProxyWidgetMigration by checking primitive.outputs[0].links (or host.subgraph.links.has(...) for the actual link id returned by addPrimitiveWithTargets) to ensure the non-dangling link remains; update the test around buildHost/addPrimitiveWithTargets so you capture the valid link id before injecting danglingLinkId and assert it exists after flushProxyWidgetMigration and before/after readHostQuarantine as appropriate.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@browser_tests/tests/vueNodes/interactions/node/imagePreview.spec.ts`:
- Around line 96-100: Add an explicit assertion that hosts whose only promoted
content are previews do not render the regular widget container: after the
existing checks in imagePreview.spec.ts, assert that the DOM does not contain
the `.lg-node-widgets` container (e.g., verify `.lg-node-widgets` is absent via
wrapper/find or query and expect exists() to be false). This ties the behavior
to the NodeWidgets v-if (nodeData.widgets?.length) condition so the test will
fail if `.lg-node-widgets` is rendered accidentally.
In `@src/core/graph/subgraph/migration/proxyWidgetMigration.ts`:
- Around line 45-55: When disambiguatingSourceNodeId is provided, don't fall
back to any promoted widget with the same name; only accept the targeted
promoted widget (byDisambiguator) or a concrete/non-promoted widget. Update the
logic around widgets.find and isPromotedWidgetView so that: if
disambiguatingSourceNodeId !== undefined you first try the byDisambiguator match
and if that misses you only return a widget whose name === sourceWidgetName and
!isPromotedWidgetView(widget); if disambiguatingSourceNodeId is undefined keep
the existing naive name-based find. Use the symbols disambiguatingSourceNodeId,
byDisambiguator, widgets, isPromotedWidgetView, and sourceWidgetName to locate
and change the conditional.
In `@src/core/graph/subgraph/preview/previewExposureChain.ts`:
- Around line 46-55: In chainFromLastStep(), when building the fallback leaf use
the last resolved step's graph id instead of the outer currentRootGraphId;
replace leaf.rootGraphId: currentRootGraphId with the graph id from the last
exposure (e.g., last.rootGraphId or the exposure's resolved graph id property)
so the returned leaf matches last.sourceNodeId/sourcePreviewName and downstream
resolution stays consistent.
In `@src/core/graph/subgraph/promotedWidgetView.ts`:
- Around line 425-452: afterQueued/applyValueControlToHost currently assigns the
computed next into this.value which propagates to the shared interior widget;
instead, locate the host-specific overlay/interior instance returned by
resolveAtHost() and write the new value to that host-local widget (not
this.value) so the mutation stays per-host. Concretely: in
applyValueControlToHost use the resolved object from resolveAtHost() to find the
host overlay/interior widget (the same place you read controlWidget from) and
set its value or call its host-specific setter (rather than assigning
this.value); keep all existing mode/min/max/step2 logic but apply the final next
to the resolved host-local widget instance to avoid mutating the shared source.
In `@src/core/graph/subgraph/promotionUtils.ts`:
- Around line 358-360: promoteValueWidgetViaSubgraphInput(parent, node as
LGraphNode, widget) can return {ok:false, reason} but the callers ignore
failures; update both call sites (the one using 'getSlotFromWidget' in node and
the other at the second location) to check the returned result, and on failure
either propagate the error (throw) or return a failed result up the call chain,
including the returned reason; ensure you reference the returned value from
promoteValueWidgetViaSubgraphInput and handle cases like
'missingSourceSlot'/'connectFailed' instead of silently continuing so callers
can react or fail fast.
In `@src/core/graph/subgraph/resolveSubgraphInputTarget.ts`:
- Around line 18-27: The current flow calls getTargetWidget() before checking
inputNode.isSubgraphNode(), causing opaque subgraph inputs to fail when the
child slot has no concrete widget; change the control flow in
resolveSubgraphInputTarget (the function containing getTargetWidget,
inputNode.isSubgraphNode, and targetInput) so the isSubgraphNode branch executes
first and returns the promoted target ({ nodeId: String(inputNode.id),
widgetName: targetInput.name }) without requiring getTargetWidget(), and only
call getTargetWidget() in the non-subgraph branch when a backing widget is
required.
In `@src/core/schemas/previewExposureSchema.ts`:
- Around line 20-24: The code double-parses `property` then still uses a
conditional JSON.parse when calling previewExposuresPropertySchema.safeParse;
remove the redundant conditional and call safeParse with the already-parsed
value. Specifically, in the try block after `if (typeof property === 'string')
property = JSON.parse(property)`, pass `property` directly into
`previewExposuresPropertySchema.safeParse(property)` (or use the original value
when not a string) instead of `typeof property === 'string' ?
JSON.parse(property) : property`, ensuring no double JSON.parse occurs.
In `@src/lib/litegraph/src/LGraph.ts`:
- Around line 185-193: Remove the static mutable hook proxyWidgetMigrationFlush
from LGraph and instead move the wiring responsibility into a dedicated
migration orchestrator: implement a MigrationOrchestrator (or similar) in the
wiring layer that knows about PreviewExposureStore and subscribes to graph
lifecycle events (or is invoked from the existing configure() call path) to
perform migration by calling a method with the host node (SubgraphNode) and node
data (ISerialisedNode | undefined); update wiring to call
MigrationOrchestrator.migrate(hostNode, nodeData) during app init/graph
configure rather than setting LGraph.proxyWidgetMigrationFlush, so the core
LGraph type remains free of mutable integration hooks.
- Around line 1367-1377: The current early returns prevent legacy callbacks from
receiving non-whitelisted actions; change the logic so this.onTrigger is invoked
for any action (call this.onTrigger?.({ type: action, ...param } as
LGraphTriggerEvent) unconditionally) and only gate this.events.dispatch behind
the validEventTypes and param checks (i.e., only call
this.events.dispatch(action as LGraphTriggerAction, param as never) when
validEventTypes.has(action) and param is an object), keeping the same type casts
(LGraphTriggerAction / LGraphTriggerEvent) and using the existing symbols
validEventTypes, action, param, this.onTrigger, and this.events.dispatch.
In `@src/lib/litegraph/src/LGraphNode.ts`:
- Around line 1026-1032: The current UUID path sets data.id before borrowing the
node id, which allows node.configure(data) to overwrite the borrowed id and
break id-keyed hydration; change the order and behavior so the instance's id is
borrowed first (set node.id = this.id) and only then run node.configure(data),
and avoid preassigning data.id when LiteGraph.use_uuids is true (or delay
assigning data.id until after configure) so configure cannot overwrite the
borrowed node.id; update references in this block (LiteGraph.use_uuids, data.id,
node.id, node.configure) accordingly.
In `@src/lib/litegraph/src/subgraph/SubgraphNode.ts`:
- Around line 645-667: The method _applyPromotedWidgetValues is reapplying
legacy widgets_values after flushProxyWidgetMigration already restored host
values, causing misalignment; modify _applyPromotedWidgetValues to no-op when a
proxy-widget migration has been flushed (e.g. check a migration flag set by
flushProxyWidgetMigration) or when the incoming widgetValues array length
doesn't match the current count/order of promoted input widgets (compute
promoted inputs by iterating this.inputs and filtering isPromotedWidgetView),
and only apply values when the lengths align and migration flag is false to
avoid replaying legacy tuples onto migrated hosts.
In `@src/stores/appModeStore.test.ts`:
- Around line 601-619: The test that spies on console.warn should ensure the spy
is always restored even if an assertion fails: wrap the mocking and test
invocation of store.pruneLinearData (the warnSpy created via vi.spyOn(console,
'warn').mockImplementation(() => {})) in a try/finally and call
warnSpy.mockRestore() in the finally block (or use a test-level afterEach to
restore the spy); do the same for the other test block referencing
mockResolveNode and warnSpy so the global console.warn cannot leak into
subsequent tests.
In `@src/utils/litegraphUtil.ts`:
- Around line 341-344: The current code in litegraphUtil.ts short-circuits when
host?.isSubgraphNode() is true by returning [] if
host.widgets?.find((w)=>w.name===widgetName) misses, which prevents the legacy
fallback in resolveNodeWidget() from running; change the logic so that you
attempt to find the widget on the subgraph host (using host.isSubgraphNode(),
host.widgets and widgetName) but do not return [] immediately when not
found—instead allow the function to continue to the legacy fallback resolution
and only return an empty array if no resolution succeeds.
---
Nitpick comments:
In `@src/core/graph/subgraph/migration/proxyWidgetMigration.test.ts`:
- Around line 454-475: The test currently only checks
primitiveRepaired/quarantined counters; add an assertion that the surviving
valid target link is still present after calling flushProxyWidgetMigration by
checking primitive.outputs[0].links (or host.subgraph.links.has(...) for the
actual link id returned by addPrimitiveWithTargets) to ensure the non-dangling
link remains; update the test around buildHost/addPrimitiveWithTargets so you
capture the valid link id before injecting danglingLinkId and assert it exists
after flushProxyWidgetMigration and before/after readHostQuarantine as
appropriate.
In `@src/core/graph/subgraph/preview/previewExposureChain.test.ts`:
- Line 12: Remove the redundant FixtureExposure interface declaration (which
merely extends PreviewExposure) and update the test fixture type annotations to
use PreviewExposure directly (replace any FixtureExposure references with
PreviewExposure). Delete the "interface FixtureExposure extends PreviewExposure
{}" line and ensure PreviewExposure is imported from the module under test if it
isn't already, then run type checks to confirm no remaining references to
FixtureExposure remain.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5cdafafa-1d9f-4818-a3b4-20fbe33b4186
⛔ Files ignored due to path filters (2)
browser_tests/tests/vueNodes/interactions/node/imagePreview.spec.ts-snapshots/vue-node-multiple-promoted-previews-chromium-linux.pngis excluded by!**/*.pngsrc/lib/litegraph/src/__snapshots__/litegraph.test.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (81)
browser_tests/fixtures/helpers/SubgraphHelper.tsbrowser_tests/fixtures/utils/promotedWidgets.tsbrowser_tests/tests/subgraph/subgraphNested.spec.tsbrowser_tests/tests/subgraph/subgraphSerialization.spec.tsbrowser_tests/tests/vueNodes/interactions/node/imagePreview.spec.tsdocs/adr/0009-subgraph-promoted-widgets-use-linked-inputs.mddocs/architecture/proto-ecs-stores.mdsrc/components/builder/AppBuilder.vuesrc/components/builder/AppModeWidgetList.vuesrc/components/rightSidePanel/parameters/SectionWidgets.vuesrc/components/rightSidePanel/parameters/TabSubgraphInputs.vuesrc/components/rightSidePanel/parameters/WidgetActions.test.tssrc/components/rightSidePanel/parameters/WidgetActions.vuesrc/components/rightSidePanel/parameters/WidgetItem.test.tssrc/components/rightSidePanel/parameters/WidgetItem.vuesrc/components/rightSidePanel/subgraph/SubgraphEditor.test.tssrc/components/rightSidePanel/subgraph/SubgraphEditor.vuesrc/components/rightSidePanel/subgraph/SubgraphNodeWidget.vuesrc/composables/graph/useGraphNodeManager.test.tssrc/composables/graph/useGraphNodeManager.tssrc/composables/node/usePromotedPreviews.test.tssrc/composables/node/usePromotedPreviews.tssrc/core/graph/subgraph/legacyProxyWidgetNormalization.test.tssrc/core/graph/subgraph/legacyProxyWidgetNormalization.tssrc/core/graph/subgraph/migration/proxyWidgetMigration.test.tssrc/core/graph/subgraph/migration/proxyWidgetMigration.tssrc/core/graph/subgraph/preview/previewExposureChain.test.tssrc/core/graph/subgraph/preview/previewExposureChain.tssrc/core/graph/subgraph/promotedWidgetTypes.tssrc/core/graph/subgraph/promotedWidgetView.test.tssrc/core/graph/subgraph/promotedWidgetView.tssrc/core/graph/subgraph/promotionUtils.test.tssrc/core/graph/subgraph/promotionUtils.tssrc/core/graph/subgraph/resolveConcretePromotedWidget.test.tssrc/core/graph/subgraph/resolveConcretePromotedWidget.tssrc/core/graph/subgraph/resolvePromotedWidgetSource.tssrc/core/graph/subgraph/resolveSubgraphInputTarget.tssrc/core/graph/subgraph/subgraphNodePromotion.test.tssrc/core/schemas/previewExposureSchema.test.tssrc/core/schemas/previewExposureSchema.tssrc/core/schemas/promotionSchema.tssrc/core/schemas/proxyWidgetQuarantineSchema.test.tssrc/core/schemas/proxyWidgetQuarantineSchema.tssrc/lib/litegraph/src/LGraph.repointAncestorPromotions.test.tssrc/lib/litegraph/src/LGraph.test.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LiteGraphGlobal.tssrc/lib/litegraph/src/infrastructure/LGraphEventMap.tssrc/lib/litegraph/src/subgraph/SubgraphConversion.test.tssrc/lib/litegraph/src/subgraph/SubgraphIO.test.tssrc/lib/litegraph/src/subgraph/SubgraphNode.tssrc/lib/litegraph/src/subgraph/SubgraphWidgetPromotion.test.tssrc/lib/litegraph/src/subgraph/subgraphDeduplication.tssrc/lib/litegraph/src/widgets/BaseWidget.tssrc/main.tssrc/renderer/extensions/vueNodes/composables/useProcessedWidgets.test.tssrc/renderer/extensions/vueNodes/composables/useProcessedWidgets.tssrc/renderer/extensions/vueNodes/widgets/utils/resolvePromotedWidget.tssrc/schemas/apiSchema.tssrc/schemas/colorPaletteSchema.tssrc/schemas/nodeDefSchema.tssrc/schemas/resultItemTypeSchema.tssrc/scripts/controlWidgetMarker.tssrc/scripts/domWidget.test.tssrc/scripts/domWidget.tssrc/scripts/widgets.tssrc/services/litegraphService.tssrc/stores/appModeStore.test.tssrc/stores/appModeStore.tssrc/stores/nodeDefStore.tssrc/stores/nodeOutputStore.test.tssrc/stores/nodeOutputStore.tssrc/stores/previewExposureStore.test.tssrc/stores/previewExposureStore.tssrc/stores/promotionStore.test.tssrc/stores/promotionStore.tssrc/utils/litegraphUtil.tssrc/utils/widgetUtil.test.tssrc/utils/widgetUtil.ts
💤 Files with no reviewable changes (10)
- src/lib/litegraph/src/LGraph.repointAncestorPromotions.test.ts
- src/stores/promotionStore.ts
- src/lib/litegraph/src/subgraph/SubgraphConversion.test.ts
- src/stores/promotionStore.test.ts
- src/core/graph/subgraph/promotedWidgetView.test.ts
- src/lib/litegraph/src/LiteGraphGlobal.ts
- src/core/graph/subgraph/subgraphNodePromotion.test.ts
- src/lib/litegraph/src/subgraph/SubgraphIO.test.ts
- src/scripts/domWidget.ts
- src/core/graph/subgraph/resolvePromotedWidgetSource.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/stores/nodeOutputStore.ts`:
- Around line 92-96: The SVG detection is too loose and case-sensitive: in the
images filter block (outputs.images / images array, image.filename) replace the
current endsWith('svg') check with a normalized, extension-accurate test such as
verifying image.filename exists, trimming/normalizing it, converting to
lower-case, and checking it endsWith('.svg') so uppercase variants and
non-extension suffixes are not misdetected.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 887ddab3-c049-4250-a7d5-91dcbd0054d4
📒 Files selected for processing (3)
browser_tests/tests/vueNodes/interactions/node/imagePreview.spec.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/stores/nodeOutputStore.ts
✅ Files skipped from review due to trivial changes (1)
- src/lib/litegraph/src/LGraphCanvas.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- browser_tests/tests/vueNodes/interactions/node/imagePreview.spec.ts
Amp-Thread-ID: https://ampcode.com/threads/T-019e1e22-c4f0-76fb-b57e-e325abb07d6d Co-authored-by: Amp <amp@ampcode.com>
Switch the multi-host primitive fanout test to @vue-nodes and assert against rendered widget inputs. Previous version asserted the same string-widget value 8 times instead of covering both promoted widgets per host. Amp-Thread-ID: https://ampcode.com/threads/T-019e1e14-fdd4-70f4-a3f7-da15caefcd71 Co-authored-by: Amp <amp@ampcode.com>
DrJKL
left a comment
There was a problem hiding this comment.
A handful of nits while reading through — all defer-able.
- proxyWidgetMigration: when a disambiguator is supplied but doesn't
match, only fall back to non-promoted widgets with the same name so
we don't silently bind to a sibling PromotedWidgetView.
- previewExposureChain: chainFromLastStep was using the already-advanced
currentRootGraphId for the leaf, producing an inconsistent
(rootGraphId, sourceNodeId) pair on cycle / no-exposure / max-depth
exits. Use the last pushed step's rootGraphId instead.
- promotedWidgetView.applyValueControlToHost: control-after-generate
was reassigning this.value, which cascades into the shared interior
widget via the value setter. Switch to hydrateHostValue so the
per-host overlay is updated without touching shared state.
- promotionUtils: capture promoteValueWidgetViaSubgraphInput results at
both call sites and emit a warning Sentry breadcrumb on failure
instead of silently dropping {ok:false, reason}.
- LGraphNode.clone: in UUID mode, configure() was overwriting the
borrowed source id with the freshly generated UUID before subclass
hydration could run. Generate the UUID up front and reapply it after
configure() so hydration sees the borrowed id and the cloned node
still gets a fresh identity.
Amp-Thread-ID: https://ampcode.com/threads/T-019e1e84-3270-730a-8c95-49a383ffdf20
Co-authored-by: Amp <amp@ampcode.com>
resolveSubgraphInputTarget previously gated on getTargetWidget() before the SubgraphNode-host branch, so an outer SubgraphInput linked to a nested SubgraphNode whose inner slot has no concrete widget resolved to undefined. The consumer in useGraphNodeManager then fell back to the interior PromotedWidgetView's deep (sourceNodeId, sourceWidgetName) identity, which contradicts ADR 0009's host-scoped opaque contract: identity is (hostNodeLocator, SubgraphInput.name). Reorder so the SubgraphNode-host branch runs first and returns (child.id, targetInput.name) regardless of whether the inner slot has a backing widget. The widget lookup remains the gate for the plain-interior-node branch, where a non-widget input legitimately has no promotable target. Three existing tests asserted the pre-ADR undefined behavior on nested-SubgraphNode + non-widget inputs. Update those assertions and test names to reflect the host-opaque contract; capture the inner node id from the helper since two helper calls collide on the hard-coded id. Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019e1e84-3270-730a-8c95-49a383ffdf20
Replace in-test workflow synthesis with saved-workflow assets so the subgraph serialization tests load fixtures the same way a user would. Drop the local mutable-workflow types and the manual setting toggles by adopting the @vue-nodes tag, which auto-enables Vue Nodes and waits for the rendered surface. Amp-Thread-ID: https://ampcode.com/threads/T-019e1f0b-176e-7659-80f5-20323ac54898 Co-authored-by: Amp <amp@ampcode.com>
Two CI Playwright failures in the multi-host primitive fanout test and the legacy-prefixed proxyWidget normalization test traced to the same class of mismatch: the migration wrote per-host widget state to a key the Vue rendering layer didn't read from, and `classify()` accepted source widgets that `repairCreateSubgraphInput()` then rejected. Failure 1 — Per-host independence The migration's `setHostWidgetState` registers values under `(rootGraphId, hostNodeId, "<name>:<sourceNodeId>:<sourceWidgetName>")`, but `safeWidgetMapper` produced `storeNodeId/storeName` pointing at the shared interior key `(rootGraphId, sourceNodeId, sourceWidgetName)`. The host-scoped value was therefore invisible to Vue; the rendered input fell back to the empty interior default. Add `ensureHostWidgetState()` on `PromotedWidgetView` that idempotently registers a host-scoped store entry seeded with the current effective value (factored shared registration into `registerHostWidgetState`). Update `safeWidgetMapper` so promoted widgets call it and expose the host-scoped `storeNodeId`/`storeName` derived from `getPromotedWidgetHostStateName`. Two unit tests asserted the previous interior-keyed identity; updated to assert the host-scoped key while preserving the same distinct-identity invariant. Failure 2 — Legacy nested proxy entries `classify()` resolved source widgets via `findSourceWidget(...) ?? getPromotableWidgets(...).find(...)`, but `repairCreateSubgraphInput()` used only `findSourceWidget(...)`. A legacy entry whose source was a nested SubgraphNode passed classification then quarantined at repair time, leaving the host with fewer rendered widgets than expected. Extract a shared `resolveSourceWidget()` helper applying the same fallback in both call sites. Amp-Thread-ID: https://ampcode.com/threads/T-019e1f0b-176e-7659-80f5-20323ac54898 Co-authored-by: Amp <amp@ampcode.com>
…shots Refactor PR-review feedback on SubgraphHelper.ts and promotedWidgets.ts: - Replace inline boolean checks (that masqueraded as type guards) with real `is`-predicate functions: `isPromotedWidgetSource`, `isNodeProperty`. - Drop duplicated `[string, string]` tuple shapes in favor of the existing `PromotedWidgetEntry` type alias. - Move validation outside `page.evaluate` so we can use the canonical `parsePreviewExposures` zod schema and the shared `PromotedWidgetSource` type from `src/core/...`. - Eliminate type assertions; narrow via `in` checks and predicate guards. Amp-Thread-ID: https://ampcode.com/threads/T-019e1f3a-a617-70b4-8945-3f0fbd34c1de Co-authored-by: Amp <amp@ampcode.com>
Tie the test to the NodeWidgets v-if="nodeData.widgets?.length" gate so a regression that renders the .lg-node-widgets container for hosts whose only promoted content is preview exposures will fail. Amp-Thread-ID: https://ampcode.com/threads/T-019e1f3a-a617-70b4-8945-3f0fbd34c1de Co-authored-by: Amp <amp@ampcode.com>
Inline the page.evaluate call into getPromotedWidgets so TypeScript infers the structural shape from the canonical NodeProperty type on SerializedNode.properties. No separate intermediate type needed. Amp-Thread-ID: https://ampcode.com/threads/T-019e1f3a-a617-70b4-8945-3f0fbd34c1de Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019e1f3a-a617-70b4-8945-3f0fbd34c1de Co-authored-by: Amp <amp@ampcode.com>
Audit finding: 3 of 4 new tests in this PR either lacked the @vue-nodes tag or relied solely on canvas/state assertions. Bring them in line with the rest of the @vue-nodes coverage: - 'Legacy primitive proxy widgets migrate...' — add @vue-nodes tag and assert host renders 2 migrated widget rows before and after reload. - 'Nested preview exposures render...' — add explicit .lg-node-widgets absence assertion (preview-only host has no widgets container). - 'Legacy unresolvable proxy entry...' — add @vue-nodes tag and assert the missing_widget label is not rendered on the host. Amp-Thread-ID: https://ampcode.com/threads/T-019e1f3a-a617-70b4-8945-3f0fbd34c1de Co-authored-by: Amp <amp@ampcode.com>
…tore hygiene (#12197) ## Summary Introduces **Subgraph Link Only Promotion** (ADR 0009) — a new model for surfacing inner subgraph widgets on the parent SubgraphNode by *promoting through links* rather than by duplicating widget state on the host. Ships with the hygiene/refactor pass on the migration, store, and event layers that the new model depends on. ## What changes ### Subgraph Link Only Promotion (ADR 0009) Promoted widgets are defined by the link from a SubgraphNode input to the interior node, not by a duplicated widget instance on the host. Consequences: - A SubgraphNode renders inner widgets purely as a **projection** of the interior widgets and links — no host-side state to drift. - **Per-host independence**: multiple instances of the same SubgraphNode render and edit their own values without cross-talk. - **Reversible promote/demote**: structural link operation, so demote preserves host slots and external connections (#12278). ### Supporting refactors - **Migration** — Planner/classifier/repair/quarantine helpers collapsed into a single `proxyWidgetMigration` entry point with black-box round-trip coverage. Honors the source-node-id disambiguator on `proxyWidgets`, so deduplicated names (e.g. `text`, `text_1`) resolve to the right interior widget. - **Widget identity** — `appMode` unified on `WidgetEntityId`; promoted widget state is keyed by entityId across the store, DOM, and migration paths. - **SubgraphNode** — 3-key promoted-view cache replaced with a single version counter + explicit `invalidatePromotedViews()` at mutation sites; `id === -1` sentinel removed. - **Events** — `LGraph.trigger()` now dispatches node trigger payloads through `this.events`, replacing a leaky `onTrigger` monkey-patch. `SubgraphEditor` reactivity is driven from subgraph events instead of imperative refresh. - **Stores** — `appModeStore` migration helpers collapsed into `upgradeAndValidateInput`; `nodeOutputStore.*ByExecutionId` derived from the locator index; `previewExposureStore` cleanup and cycle-detection double-warn fix. - **Misc** — `Outcome` types consolidated; mutable accumulators replaced with `flatMap`; new ESLint rule forbids litegraph imports under `src/world/`. ### Tests - Browser tests for promoted widgets retagged `@vue-nodes` and rewritten to assert against the rendered Vue node DOM (via `getNodeLocator` / `getByRole('textbox')` / `enterSubgraph`) instead of `page.evaluate` graph introspection. - Per-host widget independence asserted via DOM. - Migration coverage moved to black-box round-trip tests. - Added coverage for duplicate-named promoted widget identity (ADR 0009) and the per-parent demote branch in `WidgetActions`. ## Review focus - ADR 0009 conformance of the link-only promotion model. - Disambiguator resolution path in `proxyWidgetMigration`. - Single-version-counter promoted-view cache and its `invalidatePromotedViews()` call sites. - `LGraph.trigger()` event dispatch and the `AppModeWidgetList.vue` migration off `onTrigger` (FE-667 tracks the remaining `useGraphNodeManager` conversion). ## Breaking changes None for users. Internal subgraph promotion APIs changed — see ADR 0009. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-12197-feat-subgraph-link-only-widget-promotion-migration-store-hygiene-35e6d73d365081fd882cf3a69bc09956) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com> Co-authored-by: AustinMroz <austin@comfy.org>
## Summary This PR intentionally narrows workflow-embedded model metadata handling so root-level `models[]` and node-level embedded model metadata can enrich existing missing-model candidates, but can no longer create new candidates by themselves. ## Why this PR exists ADR 0009, **Subgraph promoted widgets use linked inputs**, changes promoted value ownership for subgraphs. That design was implemented by [#12197](#12197), **Subgraph Link Only Promotion (ADR 0009)**. Under ADR 0009, a promoted widget is represented as a standard linked `SubgraphInput` on the host `SubgraphNode`. The host boundary owns the promoted value identity through the host node locator plus `SubgraphInput.name`. The interior source widget remains the provider of schema, type, options, tooltip, defaults, diagnostics, and migration metadata, but it is not the persistence owner of the promoted value. This PR is a preparatory cleanup discovered while working on the missing model detection follow-up required by that ADR 0009 / [#12197](#12197) behavior. The follow-up needs missing model detection to respect the new subgraph promoted-widget ownership model. While reviewing that path, we found that the existing embedded model metadata fallback in `enrichWithEmbeddedMetadata` was doing more than metadata enrichment. The important finding was that this fallback was not just attaching metadata to candidates that had already been detected from live node widgets. It could also synthesize brand-new `MissingModelCandidate` entries from workflow JSON metadata, including root-level `models[]` entries, when no live candidate existed. That behavior is inaccurate for the missing model system for two reasons. First, the normal missing model lifecycle is anchored to a real node/widget binding. A candidate found from a COMBO or asset widget has a concrete `nodeId + widgetName` reference. That reference is what lets the UI surface the error, cache it as a pending warning, and later clear or resolve it when the underlying node/widget value is fixed. A root-level `models[]` entry does not reliably provide that anchor. If metadata-only fallback creates a candidate without a real live widget reference, the resulting error can be detected but cannot reliably travel through the existing clearing path. In practice, that can become an effectively unremovable missing model warning unless the user downloads exactly the same model referenced by the stale metadata. Second, a missing model error is meant to mean that a model-selecting widget on an active node references a value that is not available. Workflow JSON metadata by itself is not the same source of truth. If a model only appears in root workflow metadata, or appears in node metadata that is not represented by an active COMBO or asset widget candidate, that is a different kind of state from the existing missing model error model. Treating that metadata as a candidate creates a second, less reliable detector that is not aligned with the scan/clear lifecycle. This is especially important before the ADR 0009 missing-model follow-up. With linked-input promoted widgets, the host promoted value is the value that matters. The interior source widget may still carry stale or default metadata, and it must not become a second source of truth for missing model errors. A detection path that can create candidates directly from workflow metadata would make it harder to reason about which value actually produced the warning. For those reasons, this PR removes metadata-only candidate synthesis and keeps embedded metadata in the role it can perform safely: metadata enrichment. If the live widget/asset scan produces a candidate, embedded metadata may fill in `directory`, `url`, `hash`, and `hashType`. If no live candidate exists, the metadata is not enough to create a missing model warning. This PR is intended to land before the child PR that updates runtime missing model detection for ADR 0009 linked-input promoted widgets. ## Changes - **What**: Restrict `enrichWithEmbeddedMetadata` to enriching existing candidates instead of creating fallback candidates from unmatched root `models[]` or embedded model metadata. - **What**: Remove the now-unused installed-model check callback and asset-support callback from `enrichWithEmbeddedMetadata`. - **What**: Remove the now-unnecessary `modelStore.loadModelFolders()` path from the missing model pipeline, since embedded metadata no longer performs installed-model fallback detection. - **What**: Remove dead source-tracking metadata (`EmbeddedModelWithSource`, source node/widget fields, and widget-name lookup) that only existed to support metadata-only synthesis. - **What**: Update missing model tests so they assert the new contract: metadata enriches live candidates, but does not create candidates without a live scan result. - **What**: Delete obsolete fixtures that only covered the removed metadata-only synthesis path. - **Breaking**: None expected. This is an intentional narrowing of an inaccurate fallback detector, not a public API change. - **Dependencies**: None. ## Review Focus Please focus on whether the candidate lifecycle now has a single source of truth: live COMBO/asset widget scanning creates candidates, while workflow metadata only enriches those candidates. The intended behavioral change is that a model present only in workflow-level metadata, with no active node widget candidate referencing it, no longer appears as a missing model. This avoids surfacing warnings that cannot be cleared through the normal `nodeId + widgetName` path. The expected retained behavior is that active widget-referenced missing models are still detected by `scanAllModelCandidates`, and metadata from root `models[]` or node `properties.models` still supplies download-related fields for those live candidates. ## Screenshots (if applicable) Not applicable. This is a detection/pipeline behavior change covered by unit tests. ## Validation - `pnpm test:unit src/platform/missingModel/missingModelScan.test.ts src/platform/missingModel/missingModelPipeline.test.ts` - `pnpm exec eslint src/platform/missingModel/missingModelScan.ts src/platform/missingModel/missingModelScan.test.ts src/platform/missingModel/missingModelPipeline.ts src/platform/missingModel/missingModelPipeline.test.ts src/platform/missingModel/types.ts` - `pnpm exec oxfmt --check src/platform/missingModel/missingModelScan.ts src/platform/missingModel/missingModelScan.test.ts src/platform/missingModel/missingModelPipeline.ts src/platform/missingModel/missingModelPipeline.test.ts src/platform/missingModel/types.ts` - `pnpm typecheck` - pre-push hook: `knip --cache`
## Summary Bind asset-browser modal selections to the widget that actually opened the modal, so promoted subgraph asset widgets commit through the host promoted widget instead of the internal source widget closure. ## Changes - **What**: Makes the asset-browser modal commit path widget-owned: after a valid selection, `openModal` writes to the widget passed into the modal and notifies that widget's callback. - **What**: Captures workflow state after a successful value-changing asset selection, because the async modal `Use` action can run after the global mouseup-based change capture has already fired. - **What**: Preserves existing asset-browser filtering by keeping `nodeTypeForBrowser` and `inputNameForBrowser` captured in the asset widget's existing modal options closure. - **What**: Avoids adding promoted-widget-specific rebinding code to `litegraphService` and avoids changing LiteGraph core widget option types. - **What**: Only runs the source widget's `onValueChange` callback when the selected widget is the original owner widget created by `createAssetWidget`. - **What**: For cloned/transient host widgets, such as promoted subgraph asset widgets, dispatches `onWidgetChanged` through the widget's owning node instead of the internal source node. - **What**: Removes the duplicate PrimitiveNode callback dispatch because the asset modal commit path now centrally notifies the selected widget callback. - **What**: Adds stable asset-browser `data-testid`s and a cloud E2E regression for legacy promoted subgraph asset selection. - **What**: Adds unit coverage for both regular asset widget commits and cloned promoted-host asset modal commits, including workflow change capture. - **Breaking**: None. - **Dependencies**: None. ## Review Focus This PR supersedes #13074. The earlier direction treated the bug as a missing callback bridge in the async asset-browser commit path, but the ownership issue is more specific: promoted subgraph asset widgets reuse modal options that were created from the deepest concrete source widget. Those options still need to carry source metadata for filtering the asset browser, but the modal's `Use` action must commit to the widget that actually opened the modal. This matters after the History ADR 0009 subgraph widget changes shipped through #12197. In the 1.46 subgraph model, promoted widget values live on the subgraph host node and are not synchronized back into the internal widget. The internal source widget remains useful as the provider of asset-browser metadata, because `SubgraphNode` already resolves nested promotions down to the final concrete widget, but it should not own the edit commit. The final patch keeps that boundary narrow: - no `IWidgetOptions` or LiteGraph core type changes; - no asset-specific promoted-widget rebinding in `litegraphService`; - no new promoted-widget traversal logic, because the existing subgraph promotion path already resolves the final concrete source widget; - the modal commit path uses the widget passed to `openModal` as the value owner; - successful async modal commits explicitly capture workflow state when the selected value changes. Please focus review on whether `createAssetWidget` now preserves regular asset widget behavior while correctly handling cloned/transient host widgets. The key distinction is that the source `onValueChange` path only runs for the original owner widget; promoted host wrappers instead rely on their callback bridge and owning node's `onWidgetChanged` hook. A review pass also found that this PR makes an existing async modal weakness more visible: asset-browser selection happens from the modal button's `click` handler, while the global change tracker also captures on `mouseup`. Depending on event ordering, the automatic capture can occur before the selection mutates the widget. This PR now captures workflow state immediately after a successful value-changing asset selection so undo/modified tracking follows the same user-visible edit. Local verification: - `pnpm exec vitest run src/platform/assets/utils/createAssetWidget.test.ts --reporter=dot` - `pnpm exec vitest run src/platform/assets/utils/createAssetWidget.test.ts --coverage --reporter=dot --coverage.reporter=text --coverage.include=src/platform/assets/utils/createAssetWidget.ts` - `pnpm exec eslint src/platform/assets/utils/createAssetWidget.ts src/platform/assets/utils/createAssetWidget.test.ts` - `pnpm typecheck` - `pnpm format:check` - `pnpm build:cloud` --------- Co-authored-by: Alexis Rolland <alexisrolland@hotmail.com>
…ts (#13059) ## Summary Redesign missing-model detection for ADR 0009 promoted subgraph widgets so candidates are created from the widget value the user can actually edit, while still using the concrete interior widget as the schema/options source. ## Why This PR Exists This PR comes from the follow-up missing-model detection work for the ADR 0009 / 1.46 subgraph widget changes introduced by [#12197](#12197). [#12197](#12197) intentionally changed promoted subgraph widgets to be represented through subgraph input links. After that change, the promoted widget on the host `SubgraphNode` is the editable value owner, and linked interior widgets are no longer guaranteed to mirror that value. The old missing-model contract still treated the concrete interior node widget as the effective source of truth in subgraph cases: - recursive scans entered the subgraph and scanned the interior widget value; - candidates were keyed by the interior node/widget identity; - the parent subgraph host mostly received propagated highlight/navigation behavior; - subgraph container widgets were not treated as first-class candidate sources. That contract breaks after ADR 0009. A user can resolve a missing model by changing the promoted host widget to an installed model, while the linked interior widget can still hold the old stale value. If detection keeps scanning the linked interior value, entering the subgraph or reloading the workflow can re-create a false missing-model error that no longer corresponds to the value the user can edit. ADR 0009 also means the same subgraph definition can be reused by multiple `SubgraphNode` hosts. Once missing-model detection moves from the interior definition widget to the promoted host widget, the selected value is no longer a property of the shared definition alone. It is a property of a specific host instance. That makes the old interior-node identity insufficient for mode changes, removal handling, and re-scan behavior: a single interior leaf definition can be reachable through multiple host execution paths, and only the affected host path should add, remove, or restore a candidate. This PR also builds on [#12990](#12990), which narrowed workflow-level `models[]` and embedded model data to metadata enrichment only. Together, the intended boundary is: - live widgets create missing-model candidates; - workflow/root-level `models[]` and node metadata only enrich candidates that already came from a live widget; - promoted widget values are read from the editable host widget, not inferred from stale interior `widgets_values`. ## Changes - **What**: - Introduces promoted-widget scan targets that split: - host promoted widget value and candidate identity; - concrete leaf widget/node definition data. - Scans the outermost unlinked promoted widget on a `SubgraphNode` host as the selected value owner. - Skips linked interior widgets as candidate sources, preventing stale linked widget values from producing duplicate or false missing-model candidates. - Resolves the concrete leaf widget for combo options, asset-widget support, node type, directory lookup, and embedded metadata enrichment. - Keys promoted missing-model candidates by the host execution id and host promoted widget name. - Adds `sourceExecutionId` to promoted candidates so liveness still follows the concrete source execution path, including nested inactive subgraph containers. - Uses source-scope activity for pipeline filtering and async verification, while keeping highlight/store/clearing identity host-keyed. - Removes host-keyed promoted candidates when their source execution scope is removed or bypassed. - Re-scans ancestor subgraph hosts when an interior source path is un-bypassed, so host-keyed promoted errors can reappear correctly. - Handles shared subgraph definitions by deriving promoted source paths from the concrete host instance path, rather than treating the shared definition node id as globally unique. - Shares promoted source resolution between Vue node processing and the right-side panel to avoid drift. - Aligns missing-model clearing across Vue node widgets, legacy canvas widgets, and right-side panel Parameters/Nodes section widgets. - Adds unit coverage for scan identity, source-scope liveness, dynamic mode changes, source-scope removal, shared-definition host isolation, and right-side panel clearing. - Adds nested promoted-widget E2E coverage for OSS and Cloud flows across Vue, Parameters tab, and legacy widget surfaces. - **Breaking**: None expected. - **Dependencies**: None. ## New Detection Contract A missing-model candidate is created from an unlinked final editable value owner. That value owner can be: - a normal node model widget; or - the outermost promoted model widget displayed on a `SubgraphNode` host. For promoted widgets: - the host promoted widget supplies the selected value; - the host execution id and host widget name are the candidate identity; - the concrete leaf widget supplies definition data such as combo options and asset-browser support; - the concrete source execution path is retained as `sourceExecutionId` for liveness only; - linked interior widgets are skipped as candidate sources because their values are not authoritative when driven by a promoted input. For a nested chain: `Outer promoted widget A -> inner promoted widget B -> concrete widget C` only `A` creates the candidate. `B` and `C` are linked along the promoted-input path and are skipped as selected-value sources, while `C` still provides the concrete widget definition used to evaluate `A`. ## Shared Definition And Source-Scope Liveness ADR 0009 promoted widgets make subgraphs behave more like reusable definitions with host-owned inputs. Two host `SubgraphNode`s can point at the same interior subgraph definition while carrying different promoted widget values. In that shape, the missing-model candidate must be keyed to the editable host surface, but the activity check cannot use the host id alone. For example, if two outer hosts share the same nested subgraph definition, one host can select a valid model while the other still selects a missing model. The result should be one missing-model reference, not a single definition-level error and not two errors after one host is fixed. Likewise, bypassing or un-bypassing an interior nested container should affect only the host execution paths that actually pass through that container. This PR therefore separates two concepts: - **candidate identity**: host execution id + host promoted widget name, used for storage, highlight, navigation, and clearing; - **candidate liveness**: concrete source execution path, used for scan-time activity checks, pipeline filtering, async verification, source-scope removal, and re-exposure after mode changes. That separation is the reason this PR updates more than the scan itself. Moving the detection target to the subgraph host also requires the mode-change and removal paths to understand that a host-keyed candidate can be invalidated by a descendant source path, and can need to be restored by re-scanning an ancestor host when an interior source path becomes active again. ## Review Focus Please review the identity split carefully: - candidate/store/highlight/clearing identity should remain host-keyed for promoted widgets; - liveness should use `sourceExecutionId` when present, falling back to `nodeId` for normal candidates; - scan-time activity checks should account for the source node itself and all ancestor subgraph containers; - source-scope removal should remove host-keyed candidates whose concrete source path was removed or bypassed; - un-bypassing an interior source path should re-scan affected ancestor subgraph hosts so host-keyed candidates can reappear; - shared subgraph definitions should not merge errors across different host instances; - linked interior widgets should not produce their own missing-model candidates; - asset-browser eligibility should be resolved from the concrete leaf node type and widget name, not the synthetic subgraph host type; - right-side panel edits should clear host missing-model errors and source validation errors consistently. The E2E matrix intentionally keeps nested promoted workflows only. Nested promoted widgets cover the same editable host path as single promoted widgets while also exercising the `A -> B -> C` chain that can break source-scope liveness and re-scan behavior. The nested fixture also includes multiple host instances that share the same subgraph definition, so it verifies that fixing one host does not accidentally clear or suppress another host's missing-model candidate. Direct/single promoted behavior is still covered at the unit level. ## Non-Goals - This PR does not reintroduce workflow-level `models[]` candidate creation. - This PR does not infer selected model values from `widgets_values`. - This PR does not synchronize linked interior widget values back from promoted host widgets. - This PR does not redesign missing-media scanning; missing media still skips subgraph containers and remains keyed by concrete interior paths. The shared async post-verification active-scope filter is intentionally stricter, so a pending missing-media candidate is no longer surfaced if its own node is bypassed or removed while verification is in flight. ## Validation - `pnpm exec vitest run src/components/rightSidePanel/parameters/SectionWidgets.test.ts src/platform/missingModel/missingModelScan.test.ts src/composables/graph/useErrorClearingHooks.test.ts src/platform/missingModel/missingModelPipeline.test.ts src/platform/missingModel/missingModelStore.test.ts src/utils/graphTraversalUtil.test.ts src/composables/graph/useGraphNodeManager.test.ts src/renderer/extensions/vueNodes/composables/useProcessedWidgets.test.ts --reporter=dot` - 8 files passed, 294 tests passed. - `pnpm exec vitest run src/platform/missingModel/missingModelScan.test.ts src/core/graph/subgraph/resolveConcretePromotedWidget.test.ts src/components/rightSidePanel/parameters/SectionWidgets.test.ts` - 3 files passed, 71 tests passed. - `pnpm typecheck` - `pnpm typecheck:browser` - `pnpm format:check` - targeted ESLint for changed production/unit/E2E files - `git diff --check` - `pnpm build` - `pnpm build:cloud` - OSS affected E2E on the 8188 build: - `PLAYWRIGHT_LOCAL=1 PLAYWRIGHT_TEST_URL=http://localhost:8188 pnpm exec playwright test browser_tests/tests/propertiesPanel/errorsTabModeAware.spec.ts --project=chromium --grep "Changing an OSS .*promoted|Refreshing a resolved promoted|Reloading a resolved nested"` - 5 passed. - Cloud affected E2E on the 8188 cloud build: - `PLAYWRIGHT_LOCAL=1 PLAYWRIGHT_TEST_URL=http://localhost:8188 pnpm exec playwright test browser_tests/tests/propertiesPanel/errorsTabCloudMissingModels.spec.ts --project=cloud --grep "Changing a Cloud .*promoted"` - 2 passed; the Cloud legacy promoted asset-modal case still fails until [#13075](#13075) is merged. - Full OSS `errorsTabModeAware.spec.ts` on the 8188 build: - 23 passed; 3 existing paste/clipboard cases failed before the promoted subgraph section with node count remaining at 1 after `clipboard.paste()`. - Commit hooks ran `oxfmt`, `oxlint`, `eslint`, `pnpm typecheck`, and browser typecheck where applicable. - Pre-push hook ran `pnpm knip --cache`. ## Screenshots Before https://github.com/user-attachments/assets/6380c1da-1d92-4b70-888e-3ade572c4b5b After https://github.com/user-attachments/assets/4cfc24d6-3dc3-4e36-9b31-72fea6b3d9d5
…tore hygiene (#12197) ## Summary Introduces **Subgraph Link Only Promotion** (ADR 0009) — a new model for surfacing inner subgraph widgets on the parent SubgraphNode by *promoting through links* rather than by duplicating widget state on the host. Ships with the hygiene/refactor pass on the migration, store, and event layers that the new model depends on. ## What changes ### Subgraph Link Only Promotion (ADR 0009) Promoted widgets are defined by the link from a SubgraphNode input to the interior node, not by a duplicated widget instance on the host. Consequences: - A SubgraphNode renders inner widgets purely as a **projection** of the interior widgets and links — no host-side state to drift. - **Per-host independence**: multiple instances of the same SubgraphNode render and edit their own values without cross-talk. - **Reversible promote/demote**: structural link operation, so demote preserves host slots and external connections (#12278). ### Supporting refactors - **Migration** — Planner/classifier/repair/quarantine helpers collapsed into a single `proxyWidgetMigration` entry point with black-box round-trip coverage. Honors the source-node-id disambiguator on `proxyWidgets`, so deduplicated names (e.g. `text`, `text_1`) resolve to the right interior widget. - **Widget identity** — `appMode` unified on `WidgetEntityId`; promoted widget state is keyed by entityId across the store, DOM, and migration paths. - **SubgraphNode** — 3-key promoted-view cache replaced with a single version counter + explicit `invalidatePromotedViews()` at mutation sites; `id === -1` sentinel removed. - **Events** — `LGraph.trigger()` now dispatches node trigger payloads through `this.events`, replacing a leaky `onTrigger` monkey-patch. `SubgraphEditor` reactivity is driven from subgraph events instead of imperative refresh. - **Stores** — `appModeStore` migration helpers collapsed into `upgradeAndValidateInput`; `nodeOutputStore.*ByExecutionId` derived from the locator index; `previewExposureStore` cleanup and cycle-detection double-warn fix. - **Misc** — `Outcome` types consolidated; mutable accumulators replaced with `flatMap`; new ESLint rule forbids litegraph imports under `src/world/`. ### Tests - Browser tests for promoted widgets retagged `@vue-nodes` and rewritten to assert against the rendered Vue node DOM (via `getNodeLocator` / `getByRole('textbox')` / `enterSubgraph`) instead of `page.evaluate` graph introspection. - Per-host widget independence asserted via DOM. - Migration coverage moved to black-box round-trip tests. - Added coverage for duplicate-named promoted widget identity (ADR 0009) and the per-parent demote branch in `WidgetActions`. ## Review focus - ADR 0009 conformance of the link-only promotion model. - Disambiguator resolution path in `proxyWidgetMigration`. - Single-version-counter promoted-view cache and its `invalidatePromotedViews()` call sites. - `LGraph.trigger()` event dispatch and the `AppModeWidgetList.vue` migration off `onTrigger` (FE-667 tracks the remaining `useGraphNodeManager` conversion). ## Breaking changes None for users. Internal subgraph promotion APIs changed — see ADR 0009. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-12197-feat-subgraph-link-only-widget-promotion-migration-store-hygiene-35e6d73d365081fd882cf3a69bc09956) by [Unito](https://www.unito.io) --------- Co-authored-by: Amp <amp@ampcode.com> Co-authored-by: GitHub Action <action@github.com> Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: Glary-Bot <glary-bot@users.noreply.github.com> Co-authored-by: AustinMroz <austin@comfy.org>
## Summary This PR intentionally narrows workflow-embedded model metadata handling so root-level `models[]` and node-level embedded model metadata can enrich existing missing-model candidates, but can no longer create new candidates by themselves. ## Why this PR exists ADR 0009, **Subgraph promoted widgets use linked inputs**, changes promoted value ownership for subgraphs. That design was implemented by [#12197](#12197), **Subgraph Link Only Promotion (ADR 0009)**. Under ADR 0009, a promoted widget is represented as a standard linked `SubgraphInput` on the host `SubgraphNode`. The host boundary owns the promoted value identity through the host node locator plus `SubgraphInput.name`. The interior source widget remains the provider of schema, type, options, tooltip, defaults, diagnostics, and migration metadata, but it is not the persistence owner of the promoted value. This PR is a preparatory cleanup discovered while working on the missing model detection follow-up required by that ADR 0009 / [#12197](#12197) behavior. The follow-up needs missing model detection to respect the new subgraph promoted-widget ownership model. While reviewing that path, we found that the existing embedded model metadata fallback in `enrichWithEmbeddedMetadata` was doing more than metadata enrichment. The important finding was that this fallback was not just attaching metadata to candidates that had already been detected from live node widgets. It could also synthesize brand-new `MissingModelCandidate` entries from workflow JSON metadata, including root-level `models[]` entries, when no live candidate existed. That behavior is inaccurate for the missing model system for two reasons. First, the normal missing model lifecycle is anchored to a real node/widget binding. A candidate found from a COMBO or asset widget has a concrete `nodeId + widgetName` reference. That reference is what lets the UI surface the error, cache it as a pending warning, and later clear or resolve it when the underlying node/widget value is fixed. A root-level `models[]` entry does not reliably provide that anchor. If metadata-only fallback creates a candidate without a real live widget reference, the resulting error can be detected but cannot reliably travel through the existing clearing path. In practice, that can become an effectively unremovable missing model warning unless the user downloads exactly the same model referenced by the stale metadata. Second, a missing model error is meant to mean that a model-selecting widget on an active node references a value that is not available. Workflow JSON metadata by itself is not the same source of truth. If a model only appears in root workflow metadata, or appears in node metadata that is not represented by an active COMBO or asset widget candidate, that is a different kind of state from the existing missing model error model. Treating that metadata as a candidate creates a second, less reliable detector that is not aligned with the scan/clear lifecycle. This is especially important before the ADR 0009 missing-model follow-up. With linked-input promoted widgets, the host promoted value is the value that matters. The interior source widget may still carry stale or default metadata, and it must not become a second source of truth for missing model errors. A detection path that can create candidates directly from workflow metadata would make it harder to reason about which value actually produced the warning. For those reasons, this PR removes metadata-only candidate synthesis and keeps embedded metadata in the role it can perform safely: metadata enrichment. If the live widget/asset scan produces a candidate, embedded metadata may fill in `directory`, `url`, `hash`, and `hashType`. If no live candidate exists, the metadata is not enough to create a missing model warning. This PR is intended to land before the child PR that updates runtime missing model detection for ADR 0009 linked-input promoted widgets. ## Changes - **What**: Restrict `enrichWithEmbeddedMetadata` to enriching existing candidates instead of creating fallback candidates from unmatched root `models[]` or embedded model metadata. - **What**: Remove the now-unused installed-model check callback and asset-support callback from `enrichWithEmbeddedMetadata`. - **What**: Remove the now-unnecessary `modelStore.loadModelFolders()` path from the missing model pipeline, since embedded metadata no longer performs installed-model fallback detection. - **What**: Remove dead source-tracking metadata (`EmbeddedModelWithSource`, source node/widget fields, and widget-name lookup) that only existed to support metadata-only synthesis. - **What**: Update missing model tests so they assert the new contract: metadata enriches live candidates, but does not create candidates without a live scan result. - **What**: Delete obsolete fixtures that only covered the removed metadata-only synthesis path. - **Breaking**: None expected. This is an intentional narrowing of an inaccurate fallback detector, not a public API change. - **Dependencies**: None. ## Review Focus Please focus on whether the candidate lifecycle now has a single source of truth: live COMBO/asset widget scanning creates candidates, while workflow metadata only enriches those candidates. The intended behavioral change is that a model present only in workflow-level metadata, with no active node widget candidate referencing it, no longer appears as a missing model. This avoids surfacing warnings that cannot be cleared through the normal `nodeId + widgetName` path. The expected retained behavior is that active widget-referenced missing models are still detected by `scanAllModelCandidates`, and metadata from root `models[]` or node `properties.models` still supplies download-related fields for those live candidates. ## Screenshots (if applicable) Not applicable. This is a detection/pipeline behavior change covered by unit tests. ## Validation - `pnpm test:unit src/platform/missingModel/missingModelScan.test.ts src/platform/missingModel/missingModelPipeline.test.ts` - `pnpm exec eslint src/platform/missingModel/missingModelScan.ts src/platform/missingModel/missingModelScan.test.ts src/platform/missingModel/missingModelPipeline.ts src/platform/missingModel/missingModelPipeline.test.ts src/platform/missingModel/types.ts` - `pnpm exec oxfmt --check src/platform/missingModel/missingModelScan.ts src/platform/missingModel/missingModelScan.test.ts src/platform/missingModel/missingModelPipeline.ts src/platform/missingModel/missingModelPipeline.test.ts src/platform/missingModel/types.ts` - `pnpm typecheck` - pre-push hook: `knip --cache`
## Summary Bind asset-browser modal selections to the widget that actually opened the modal, so promoted subgraph asset widgets commit through the host promoted widget instead of the internal source widget closure. ## Changes - **What**: Makes the asset-browser modal commit path widget-owned: after a valid selection, `openModal` writes to the widget passed into the modal and notifies that widget's callback. - **What**: Captures workflow state after a successful value-changing asset selection, because the async modal `Use` action can run after the global mouseup-based change capture has already fired. - **What**: Preserves existing asset-browser filtering by keeping `nodeTypeForBrowser` and `inputNameForBrowser` captured in the asset widget's existing modal options closure. - **What**: Avoids adding promoted-widget-specific rebinding code to `litegraphService` and avoids changing LiteGraph core widget option types. - **What**: Only runs the source widget's `onValueChange` callback when the selected widget is the original owner widget created by `createAssetWidget`. - **What**: For cloned/transient host widgets, such as promoted subgraph asset widgets, dispatches `onWidgetChanged` through the widget's owning node instead of the internal source node. - **What**: Removes the duplicate PrimitiveNode callback dispatch because the asset modal commit path now centrally notifies the selected widget callback. - **What**: Adds stable asset-browser `data-testid`s and a cloud E2E regression for legacy promoted subgraph asset selection. - **What**: Adds unit coverage for both regular asset widget commits and cloned promoted-host asset modal commits, including workflow change capture. - **Breaking**: None. - **Dependencies**: None. ## Review Focus This PR supersedes #13074. The earlier direction treated the bug as a missing callback bridge in the async asset-browser commit path, but the ownership issue is more specific: promoted subgraph asset widgets reuse modal options that were created from the deepest concrete source widget. Those options still need to carry source metadata for filtering the asset browser, but the modal's `Use` action must commit to the widget that actually opened the modal. This matters after the History ADR 0009 subgraph widget changes shipped through #12197. In the 1.46 subgraph model, promoted widget values live on the subgraph host node and are not synchronized back into the internal widget. The internal source widget remains useful as the provider of asset-browser metadata, because `SubgraphNode` already resolves nested promotions down to the final concrete widget, but it should not own the edit commit. The final patch keeps that boundary narrow: - no `IWidgetOptions` or LiteGraph core type changes; - no asset-specific promoted-widget rebinding in `litegraphService`; - no new promoted-widget traversal logic, because the existing subgraph promotion path already resolves the final concrete source widget; - the modal commit path uses the widget passed to `openModal` as the value owner; - successful async modal commits explicitly capture workflow state when the selected value changes. Please focus review on whether `createAssetWidget` now preserves regular asset widget behavior while correctly handling cloned/transient host widgets. The key distinction is that the source `onValueChange` path only runs for the original owner widget; promoted host wrappers instead rely on their callback bridge and owning node's `onWidgetChanged` hook. A review pass also found that this PR makes an existing async modal weakness more visible: asset-browser selection happens from the modal button's `click` handler, while the global change tracker also captures on `mouseup`. Depending on event ordering, the automatic capture can occur before the selection mutates the widget. This PR now captures workflow state immediately after a successful value-changing asset selection so undo/modified tracking follows the same user-visible edit. Local verification: - `pnpm exec vitest run src/platform/assets/utils/createAssetWidget.test.ts --reporter=dot` - `pnpm exec vitest run src/platform/assets/utils/createAssetWidget.test.ts --coverage --reporter=dot --coverage.reporter=text --coverage.include=src/platform/assets/utils/createAssetWidget.ts` - `pnpm exec eslint src/platform/assets/utils/createAssetWidget.ts src/platform/assets/utils/createAssetWidget.test.ts` - `pnpm typecheck` - `pnpm format:check` - `pnpm build:cloud` --------- Co-authored-by: Alexis Rolland <alexisrolland@hotmail.com>
…ts (#13059) ## Summary Redesign missing-model detection for ADR 0009 promoted subgraph widgets so candidates are created from the widget value the user can actually edit, while still using the concrete interior widget as the schema/options source. ## Why This PR Exists This PR comes from the follow-up missing-model detection work for the ADR 0009 / 1.46 subgraph widget changes introduced by [#12197](#12197). [#12197](#12197) intentionally changed promoted subgraph widgets to be represented through subgraph input links. After that change, the promoted widget on the host `SubgraphNode` is the editable value owner, and linked interior widgets are no longer guaranteed to mirror that value. The old missing-model contract still treated the concrete interior node widget as the effective source of truth in subgraph cases: - recursive scans entered the subgraph and scanned the interior widget value; - candidates were keyed by the interior node/widget identity; - the parent subgraph host mostly received propagated highlight/navigation behavior; - subgraph container widgets were not treated as first-class candidate sources. That contract breaks after ADR 0009. A user can resolve a missing model by changing the promoted host widget to an installed model, while the linked interior widget can still hold the old stale value. If detection keeps scanning the linked interior value, entering the subgraph or reloading the workflow can re-create a false missing-model error that no longer corresponds to the value the user can edit. ADR 0009 also means the same subgraph definition can be reused by multiple `SubgraphNode` hosts. Once missing-model detection moves from the interior definition widget to the promoted host widget, the selected value is no longer a property of the shared definition alone. It is a property of a specific host instance. That makes the old interior-node identity insufficient for mode changes, removal handling, and re-scan behavior: a single interior leaf definition can be reachable through multiple host execution paths, and only the affected host path should add, remove, or restore a candidate. This PR also builds on [#12990](#12990), which narrowed workflow-level `models[]` and embedded model data to metadata enrichment only. Together, the intended boundary is: - live widgets create missing-model candidates; - workflow/root-level `models[]` and node metadata only enrich candidates that already came from a live widget; - promoted widget values are read from the editable host widget, not inferred from stale interior `widgets_values`. ## Changes - **What**: - Introduces promoted-widget scan targets that split: - host promoted widget value and candidate identity; - concrete leaf widget/node definition data. - Scans the outermost unlinked promoted widget on a `SubgraphNode` host as the selected value owner. - Skips linked interior widgets as candidate sources, preventing stale linked widget values from producing duplicate or false missing-model candidates. - Resolves the concrete leaf widget for combo options, asset-widget support, node type, directory lookup, and embedded metadata enrichment. - Keys promoted missing-model candidates by the host execution id and host promoted widget name. - Adds `sourceExecutionId` to promoted candidates so liveness still follows the concrete source execution path, including nested inactive subgraph containers. - Uses source-scope activity for pipeline filtering and async verification, while keeping highlight/store/clearing identity host-keyed. - Removes host-keyed promoted candidates when their source execution scope is removed or bypassed. - Re-scans ancestor subgraph hosts when an interior source path is un-bypassed, so host-keyed promoted errors can reappear correctly. - Handles shared subgraph definitions by deriving promoted source paths from the concrete host instance path, rather than treating the shared definition node id as globally unique. - Shares promoted source resolution between Vue node processing and the right-side panel to avoid drift. - Aligns missing-model clearing across Vue node widgets, legacy canvas widgets, and right-side panel Parameters/Nodes section widgets. - Adds unit coverage for scan identity, source-scope liveness, dynamic mode changes, source-scope removal, shared-definition host isolation, and right-side panel clearing. - Adds nested promoted-widget E2E coverage for OSS and Cloud flows across Vue, Parameters tab, and legacy widget surfaces. - **Breaking**: None expected. - **Dependencies**: None. ## New Detection Contract A missing-model candidate is created from an unlinked final editable value owner. That value owner can be: - a normal node model widget; or - the outermost promoted model widget displayed on a `SubgraphNode` host. For promoted widgets: - the host promoted widget supplies the selected value; - the host execution id and host widget name are the candidate identity; - the concrete leaf widget supplies definition data such as combo options and asset-browser support; - the concrete source execution path is retained as `sourceExecutionId` for liveness only; - linked interior widgets are skipped as candidate sources because their values are not authoritative when driven by a promoted input. For a nested chain: `Outer promoted widget A -> inner promoted widget B -> concrete widget C` only `A` creates the candidate. `B` and `C` are linked along the promoted-input path and are skipped as selected-value sources, while `C` still provides the concrete widget definition used to evaluate `A`. ## Shared Definition And Source-Scope Liveness ADR 0009 promoted widgets make subgraphs behave more like reusable definitions with host-owned inputs. Two host `SubgraphNode`s can point at the same interior subgraph definition while carrying different promoted widget values. In that shape, the missing-model candidate must be keyed to the editable host surface, but the activity check cannot use the host id alone. For example, if two outer hosts share the same nested subgraph definition, one host can select a valid model while the other still selects a missing model. The result should be one missing-model reference, not a single definition-level error and not two errors after one host is fixed. Likewise, bypassing or un-bypassing an interior nested container should affect only the host execution paths that actually pass through that container. This PR therefore separates two concepts: - **candidate identity**: host execution id + host promoted widget name, used for storage, highlight, navigation, and clearing; - **candidate liveness**: concrete source execution path, used for scan-time activity checks, pipeline filtering, async verification, source-scope removal, and re-exposure after mode changes. That separation is the reason this PR updates more than the scan itself. Moving the detection target to the subgraph host also requires the mode-change and removal paths to understand that a host-keyed candidate can be invalidated by a descendant source path, and can need to be restored by re-scanning an ancestor host when an interior source path becomes active again. ## Review Focus Please review the identity split carefully: - candidate/store/highlight/clearing identity should remain host-keyed for promoted widgets; - liveness should use `sourceExecutionId` when present, falling back to `nodeId` for normal candidates; - scan-time activity checks should account for the source node itself and all ancestor subgraph containers; - source-scope removal should remove host-keyed candidates whose concrete source path was removed or bypassed; - un-bypassing an interior source path should re-scan affected ancestor subgraph hosts so host-keyed candidates can reappear; - shared subgraph definitions should not merge errors across different host instances; - linked interior widgets should not produce their own missing-model candidates; - asset-browser eligibility should be resolved from the concrete leaf node type and widget name, not the synthetic subgraph host type; - right-side panel edits should clear host missing-model errors and source validation errors consistently. The E2E matrix intentionally keeps nested promoted workflows only. Nested promoted widgets cover the same editable host path as single promoted widgets while also exercising the `A -> B -> C` chain that can break source-scope liveness and re-scan behavior. The nested fixture also includes multiple host instances that share the same subgraph definition, so it verifies that fixing one host does not accidentally clear or suppress another host's missing-model candidate. Direct/single promoted behavior is still covered at the unit level. ## Non-Goals - This PR does not reintroduce workflow-level `models[]` candidate creation. - This PR does not infer selected model values from `widgets_values`. - This PR does not synchronize linked interior widget values back from promoted host widgets. - This PR does not redesign missing-media scanning; missing media still skips subgraph containers and remains keyed by concrete interior paths. The shared async post-verification active-scope filter is intentionally stricter, so a pending missing-media candidate is no longer surfaced if its own node is bypassed or removed while verification is in flight. ## Validation - `pnpm exec vitest run src/components/rightSidePanel/parameters/SectionWidgets.test.ts src/platform/missingModel/missingModelScan.test.ts src/composables/graph/useErrorClearingHooks.test.ts src/platform/missingModel/missingModelPipeline.test.ts src/platform/missingModel/missingModelStore.test.ts src/utils/graphTraversalUtil.test.ts src/composables/graph/useGraphNodeManager.test.ts src/renderer/extensions/vueNodes/composables/useProcessedWidgets.test.ts --reporter=dot` - 8 files passed, 294 tests passed. - `pnpm exec vitest run src/platform/missingModel/missingModelScan.test.ts src/core/graph/subgraph/resolveConcretePromotedWidget.test.ts src/components/rightSidePanel/parameters/SectionWidgets.test.ts` - 3 files passed, 71 tests passed. - `pnpm typecheck` - `pnpm typecheck:browser` - `pnpm format:check` - targeted ESLint for changed production/unit/E2E files - `git diff --check` - `pnpm build` - `pnpm build:cloud` - OSS affected E2E on the 8188 build: - `PLAYWRIGHT_LOCAL=1 PLAYWRIGHT_TEST_URL=http://localhost:8188 pnpm exec playwright test browser_tests/tests/propertiesPanel/errorsTabModeAware.spec.ts --project=chromium --grep "Changing an OSS .*promoted|Refreshing a resolved promoted|Reloading a resolved nested"` - 5 passed. - Cloud affected E2E on the 8188 cloud build: - `PLAYWRIGHT_LOCAL=1 PLAYWRIGHT_TEST_URL=http://localhost:8188 pnpm exec playwright test browser_tests/tests/propertiesPanel/errorsTabCloudMissingModels.spec.ts --project=cloud --grep "Changing a Cloud .*promoted"` - 2 passed; the Cloud legacy promoted asset-modal case still fails until [#13075](#13075) is merged. - Full OSS `errorsTabModeAware.spec.ts` on the 8188 build: - 23 passed; 3 existing paste/clipboard cases failed before the promoted subgraph section with node count remaining at 1 after `clipboard.paste()`. - Commit hooks ran `oxfmt`, `oxlint`, `eslint`, `pnpm typecheck`, and browser typecheck where applicable. - Pre-push hook ran `pnpm knip --cache`. ## Screenshots Before https://github.com/user-attachments/assets/6380c1da-1d92-4b70-888e-3ade572c4b5b After https://github.com/user-attachments/assets/4cfc24d6-3dc3-4e36-9b31-72fea6b3d9d5
…ident-94) Adds an e2e test and a unit test that reproduce a distinct subgraph live-preview bug: LGraphNode.vue unconditionally hides the LivePreview element on any SubgraphNode via a `!lgraphNode?.isSubgraphNode()` guard (added in #12197 / 0157b47), so a mid-execution sampler preview never reaches the outer, non-entered SubgraphNode. This is separate from the allowlist gap fixed in this PR: that fix promotes previews through usePromotedPreviews/NodeContent, a rendering path that is not gated by isSubgraphNode(). It does not touch or bypass the LivePreview guard, so it does not fix this scenario - verified empirically: this unit test still fails on top of this branch's fix with the same "Unable to find an accessible element with the role img" error as on main. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
## Summary Move missing-media error surfacing from the interior widget to the promoted host widget, matching the ADR 0009 ownership model. Built as a red-green pair. The tests were written and pushed first and failed on CI; the implementation followed and turned them green, with the failing and passing runs both linked below. ## Changes - **What**: - `refactor: extract the missing media pipeline seam` — moves `runMissingMediaPipeline` / `cacheMediaCandidates` out of `ComfyApp` into `src/platform/missingMedia/missingMediaPipeline.ts`, mirroring the existing `missingModelPipeline.ts`. Pure move. - Test commits — 30 failing unit tests across 6 files plus 3 E2E scenarios, defining the contract below. - `fix: surface missing media on the promoted host widget` — the implementation. - `refactor: derive missing media detection from the input spec` — replaces the hardcoded `MEDIA_NODE_WIDGETS` map with the upload flags the backend already declares. - `fix: move the missing media error surface on promotion as well as demotion` — closes the promotion half of the ownership transfer. - `refactor: address review nits on the promoted missing media surface`. - **Breaking**: none. - **Dependencies**: none. Production total: 332 insertions / 114 deletions across 9 files. ## Why [Comfy-Org#12197](Comfy-Org#12197) (ADR 0009) made promoted widgets host-owned: the host `SubgraphNode` widget owns the value and the interior widget only supplies schema/options metadata. [Comfy-Org#13059](Comfy-Org#13059) updated **missing model** detection for that contract. **Missing media was never updated** — `missingMediaScan.ts` still skips subgraph hosts entirely and reads the interior widget. What the user sees today, with a `LoadImage` inside a subgraph whose `image` widget is promoted: - The error is keyed to the interior node, so the errors-tab row navigates to a node the user cannot edit — the interior widget is disabled while promoted. - Selecting a valid image on the host does not clear it. Entering the subgraph re-creates the candidate from the stale interior value through the `onNodeAdded` rescan. ## The contract these tests pin A candidate is created from the **unlinked final editable value owner**. | | `nodeId` | `widgetName` | `nodeType` | | --- | --- | --- | --- | | plain node widget | node execId | widget name | node type | | promoted host widget | **host execId** | **host SubgraphInput name** | **leaf node type** (e.g. `LoadImage`) | 1. A widget whose paired input slot has a link is not the value owner and is skipped — promoted interior widgets and ordinary link-fed widgets alike. 2. Media-widget identification reads the **leaf** widget's `InputSpec` upload flags (`image_upload`, `animated_image_upload`, `video_upload`, `audio_upload`) via `nodeDefStore.getInputSpecForWidget`. The tests were written against the four-node `MEDIA_NODE_WIDGETS` map that existed at the time; the later spec-based commit keeps every one of them green and additionally covers custom loader nodes. 3. **Value and combo options are both read from the scanned widget** — for a promoted widget that means the host, never the leaf. 4. Nested `A → B → C`: only `A` creates a candidate. 5. Two hosts sharing one subgraph definition produce independent candidates. 6. **Liveness follows an any-consumer rule**: the candidate survives while at least one fully-active path exists from the host input to a concrete widget, and disappears when all of them are inactive or the promotion is released. ## Review Focus ### Two intentional differences from missing model **1. Options are read from the host, not the leaf.** `missingModelScan` reads the interior widget's options. Media cannot: uploading through the host dropdown appends the filename to the *host* widget's option list only (`useWidgetSelectActions.handleFilesUpdate`), so reading leaf options would report a just-uploaded file as missing on the next rescan. Model combos have no upload control — `allowUpload` derives from the same spec flags this PR now reads for detection — so the divergence does not apply to them. **2. Liveness is any-consumer, not first-link.** A `SubgraphInput` can feed N interior widgets, and ADR 0009's primitive-fanout repair creates exactly that shape. `resolveSubgraphInputLink` returns only the first resolvable link as the "promoted representative", and `missingModelScan.ts:219` uses that single representative for liveness. In model today, with consumers A/B/C, bypassing **A alone** clears the host error even though B and C still need the file — the outcome depends on link order, which is an implementation detail. Media does not inherit that. A follow-up PR will align `missingModelScan` to the same rule. ### What each wrong implementation trips on | wrong implementation | caught by | | --- | --- | | reads the interior widget's value | `uses a valid host value even when the linked interior value is stale` | | reads the interior widget's options | `accepts a value found only in the promoted host options` + `reports a value found only in the interior leaf options as missing` | | first-link representative for liveness | first-consumer scan case + fanout lifecycle step 1 | | last-link representative for liveness | last-nested-branch scan case + fanout lifecycle step 2 | | fixes the scan but not removal | the lifecycle reds | | fixes removal but not the scan | the scan reds | All four production liveness call sites are pinned separately — scan, removal/mode-change, workflow-load async verification, realtime async verification — so a partial implementation cannot go green. ### Test notes - Some guards are green today by design. The `scanNodeMediaCandidates` BYPASS/NEVER guards and three `missingMediaStore` tests pass without production changes; they exclude specific wrong implementations rather than proving the bug. Removal authority intentionally lives in the scan rather than in a targeted store API. - `MissingMediaCandidate` gains **no new field**. An earlier design recorded the leaf execution path on the candidate; that cannot express any-consumer liveness and goes stale when consumers change, so liveness is re-derived from the host at check time. - Commit 1 is a pure move. `this.rootGraph` was read lazily inside `.then()` and is now captured as a parameter; these are equivalent because `rootGraphInternal` has exactly one assignment site (`app.ts:955`), so a single `LGraph` exists for the app's lifetime. Verified by applying only the two production files to `main` and running the full unit suite. ### Known unrelated CI noise - `src/platform/cloud/onboarding/onboardingCloudRoutes.test.ts` intermittently times out at 5s on module-level dynamic imports. Reproduced on this branch's base commit. - `.nvmrc` pins a floating `node 25`, resolved fresh per run, so identical commits can behave differently across runs. ## Changes after the green run Three commits landed after the red-green pair. All 51 checks pass on `86382c61`. **Spec-based media detection.** *Ecosystem impact: this broadens detection from four hardcoded node types to every node whose combo input declares an upload flag, so third-party media loaders will now surface missing-media errors where they previously never did. `mesh_upload` stays unhandled — missing media has no mesh surface yet.* Detection was a hardcoded map of four node types (`LoadImage`, `LoadImageMask`, `LoadVideo`, `LoadAudio`) keyed by widget name. It now reads the upload flags the backend already declares on the combo `InputSpec`, resolved through `nodeDefStore.getInputSpecForWidget` — the same API the Vue layer uses to populate `SimplifiedWidget.spec` (`useGraphNodeManager.ts:165`), and the same flag precedence `WidgetSelect.vue` uses to decide whether a widget renders an upload control. Custom loader nodes are now covered. `candidate.nodeType` still comes from the leaf: the errors overlay formats it directly (`missingErrorResolver.ts:265`), and a `SubgraphNode`'s own `type` is a UUID, which `formatNodeTypeName` would pass through verbatim. **Promotion, not just demotion.** Promotion transfers value ownership from the interior widget to the host; demotion transfers it back. Only demotion was handled, so promoting a widget with a missing file left the error keyed to the interior node the user can no longer edit — the same class of bug this PR exists to fix, reached by a different route — and demoting deleted the error without re-checking the widget that regained ownership. Both events now rescan the host subtree: whichever side lost ownership fails the scope check and is dropped, whichever side gained it is scanned fresh. Demotion keeps its explicit host removal because `ensureWidgetRemoved` dispatches before the widget leaves the input, so the scope filter cannot yet see it gone. Two tests, both mutation-proven. Two branches that could not change behaviour were removed: the `app.rootGraph === graph.rootGraph` guard in `onNodeRemoved` (hooks install on `canvasStore.currentGraph`, which may be a `Subgraph`, but `Subgraph.rootGraph` returns the app's single root, so it is always true), and the missing-widget early return in `isMissingMediaCandidateScopeActive` (`getSlotFromWidget` accepts `undefined`, so the branch returned exactly what the code below it already returned). ## Follow-ups An 18-lane blackbox review produced these. Each is real but outside this PR's scope; none block it. | # | item | why deferred | | --- | --- | --- | | 1 | `findNodesReferencingValues` skips subgraph hosts, so a deleted asset stays written into the workflow JSON through a promoted host | named as a non-goal below; extending it needs a decision on what preview-clearing means for a host, whose outputs the interior node produces | | 2 | the promotion-listener `Map` keys on `Subgraph`, retaining definitions until teardown | lifetime question that applies to the sibling model path too | | 3 | the per-node scan lost its node-type early bail, so a full-graph scan is O(M·N) | needs a cheap pre-filter that does not reintroduce the hardcoded map | | 4 | per-node media verification is uncancellable; its `rootGraph` staleness guard cannot fire for same-workflow edits | needs an `AbortSignal` through the scan path, which `verifyMediaCandidates` already accepts | | 5 | `isWidgetMissingMedia` is a linear scan where the model store precomputes a key `Set` | render-path optimisation, measurable only on large graphs | | 6 | `hasActiveConsumer` re-implements `resolveSubgraphInputLink`'s traversal and sits in `resolveConcretePromotedWidget.ts` | unifying them means changing the model path's first-link semantics, which item 8 covers | | 7 | promoted-host uploads set no in-flight flag: the interior widget is disabled so `useNodeImageUpload` never runs, and `WidgetSelectDropdown` tracks upload state in a local `ref` | the `isUploading` guard is therefore unreachable for promoted widgets; fixing it is an upload-path change, not a detection change | | 8 | an active *non-media* consumer keeps a missing-media error alive that the user cannot clear | needs a product decision on what liveness should mean for heterogeneous fanout | | 9 | the scan reaches into the leaf for `candidate.nodeType`, which only the overlay message consumes directly (`missingErrorResolver.ts:265`); the row label already prefers the node's display name | switching the overlay to the display name would let the scan drop `resolvePromotedWidgetSource` entirely — `getInputSpecForWidget` already walks the promoted chain itself, so chain resolution would live behind one store API instead of being re-derived here. Deferred because it changes a user-visible string (i18n) and `nodeType` is a public field on `MissingMediaCandidate` shared with grouping and the model-side symmetry | | 10 | a media file drop calls `showPendingWarnings()` unconditionally (`app.ts:714`), restoring `wf.pendingWarnings.missingMediaCandidates` verbatim — so an error cleared by a bypass, a node deletion or a demotion comes back, keyed to a node that may no longer exist | **pre-existing, reproduces on `main`** — filed as [FE-1487](https://linear.app/comfyorg/issue/FE-1487/cleared-missing-media-errors-reappear-after-a-media-file-drop-keyed-to). Nothing outside the load pipeline updates that cache, and `showPendingWarnings` re-writes what it read, so the divergence is self-perpetuating. The restore path is shared with missing model and missing node, so any fix has to be validated across all three | | 11 | the upload-flag precedence in `mediaTypeFromSpec` duplicates `WidgetSelect.vue:82-90`, which derives the same `AssetKind` from the same flags and also handles `mesh_upload` | a shared `assetKindFromComboSpec` would keep them from drifting when a flag is added, but `WidgetSelect.vue` is outside this PR's diff | ## Non-goals - Does not change missing **model** behavior. - Does not change the hide-vs-disable UX for promoted widgets, which is pending design. - Does not widen `findNodesReferencingValues`; the deleted-asset path will be fixed at its call site so the preview-clearing and value-clearing consumers keep their current behavior. ## Red-green proof | phase | commit | unit | e2e | | --- | --- | --- | --- | | Red | [`e11161a8`](Comfy-Org@e11161a839) | [failed](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/30760755440/job/91530691345) | [failed](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/30760755459/job/91530918284) | | Green | [`1fe2d9a8`](Comfy-Org@1fe2d9a85b) | [passed](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/30765383959/job/91543058867) | [passed](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/30765383923/job/91543279012) | At red, the only failing jobs were the unit suite, one chromium E2E shard, and the `e2e-status` job that aggregates them; the other 47 checks passed. The failing unit files were exactly the six this PR touches. The E2E failures were behavioural assertions rather than setup errors — the first one printed the bug directly, with the errors-tab row naming the interior node the user cannot edit: ``` Locator: getByTestId('missing-media-row') Expected substring: "Subgraph with Promoted Missing Media - outer_image" Received string: "Load Image - image" ``` At green, all 50 checks pass, including the same three jobs. The three commits added after that run are described above; the branch head [`86382c61`](Comfy-Org@86382c6198) is green on every check — [unit](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/30778317952/job/91578007298), [e2e](https://github.com/Comfy-Org/ComfyUI_frontend/actions/runs/30778317997/job/91579591949) (27/27 jobs, covering the `cloud`, `mobile-chrome`, `mobile-safari`, `chromium-2x` and `chromium-0.5x` projects as well as the 16 chromium shards). ### Tests changed between the two runs Two tests were corrected after the red run was recorded. Both are listed here rather than folded in silently: 1. **`missingMediaStore.test.ts`** — the red-phase intersection type and cast were removed and `isWidgetMissingMedia` is now called directly. During red the store did not expose the method, so an optional member kept the failure an `AssertionError` instead of a `TypeError`; once the implementation landed the scaffolding became unnecessary. This completes what was promised in the review thread. 2. **`useProcessedWidgets.test.ts`** — `otherWidget` was re-aimed from `outer_image` to `outer_mask`. As written it shared its entire host identity with `matchingWidget` and differed only in `sourceExecutionId`, so it demanded source-path discrimination that this contract deliberately removes — it could not pass under any implementation. It remains a promoted widget, so the promoted path is still exercised, and a mutation that drops the `widgetName` comparison in the store still fails it. No other test changed: the 193 `it`/`describe` titles across the six red files are identical at both revisions, with no `skip` or `only` added, and the fixtures, E2E specs and helpers are untouched. ### Verification beyond CI - All ten contract rules were checked by mutation: 14 probes, 14 caught, none survived. The commits added after the green run were mutation-proven the same way — reverting the `widget-promoted` listener fails the promotion test, reverting the demotion rescan fails the demotion test, and reverting spec-based detection to the old map fails the custom-node test. - The E2E scenarios were run locally in both harnesses: the OSS chromium project against this branch's Vite dev server on `:5173`, and the `cloud` project against a `pnpm build:cloud` dist served by a local backend, matching how CI builds and serves it. ## Video https://github.com/user-attachments/assets/2e88d76c-c54e-4b69-b4b7-8d97be29b1b4
Summary
Introduces Subgraph Link Only Promotion (ADR 0009) — a new model for surfacing inner subgraph widgets on the parent SubgraphNode by promoting through links rather than by duplicating widget state on the host. Ships with the hygiene/refactor pass on the migration, store, and event layers that the new model depends on.
What changes
Subgraph Link Only Promotion (ADR 0009)
Promoted widgets are defined by the link from a SubgraphNode input to the interior node, not by a duplicated widget instance on the host. Consequences:
Supporting refactors
proxyWidgetMigrationentry point with black-box round-trip coverage. Honors the source-node-id disambiguator onproxyWidgets, so deduplicated names (e.g.text,text_1) resolve to the right interior widget.appModeunified onWidgetEntityId; promoted widget state is keyed by entityId across the store, DOM, and migration paths.invalidatePromotedViews()at mutation sites;id === -1sentinel removed.LGraph.trigger()now dispatches node trigger payloads throughthis.events, replacing a leakyonTriggermonkey-patch.SubgraphEditorreactivity is driven from subgraph events instead of imperative refresh.appModeStoremigration helpers collapsed intoupgradeAndValidateInput;nodeOutputStore.*ByExecutionIdderived from the locator index;previewExposureStorecleanup and cycle-detection double-warn fix.Outcometypes consolidated; mutable accumulators replaced withflatMap; new ESLint rule forbids litegraph imports undersrc/world/.Tests
@vue-nodesand rewritten to assert against the rendered Vue node DOM (viagetNodeLocator/getByRole('textbox')/enterSubgraph) instead ofpage.evaluategraph introspection.WidgetActions.Review focus
proxyWidgetMigration.invalidatePromotedViews()call sites.LGraph.trigger()event dispatch and theAppModeWidgetList.vuemigration offonTrigger(FE-667 tracks the remaininguseGraphNodeManagerconversion).Breaking changes
None for users. Internal subgraph promotion APIs changed — see ADR 0009.
┆Issue is synchronized with this Notion page by Unito