-
Notifications
You must be signed in to change notification settings - Fork 672
test: add failing e2e repro for FE-1539 subgraph unpack boundary links #15002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DrJKL
wants to merge
12
commits into
main
Choose a base branch
from
glary/fe-1539-unpack-missing-link-id-test
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
8d1d5f5
test: add failing e2e repro for FE-1539 subgraph unpack boundary links
Glary-Bot 0a373e0
test: scope spec constants to the describe block
Glary-Bot 25c1911
Merge branch 'main' into glary/fe-1539-unpack-missing-link-id-test
DrJKL 9916e78
fix: stop reporting missing links for unconnected subgraph boundary i…
Glary-Bot 050c1d8
test: serialize widgets in the unpack promotion fixture
Glary-Bot bb1d12e
test: cover undo of the promoted value transfer on unpack
Glary-Bot e8f51b8
Merge branch 'main' into glary/fe-1539-unpack-missing-link-id-test
DrJKL da3b91f
fix: harden boundary slot lookups and name the unpack error accurately
Glary-Bot 0410de2
Merge branch 'main' into glary/fe-1539-unpack-missing-link-id-test
DrJKL 4b7751b
Merge branch 'main' into glary/fe-1539-unpack-missing-link-id-test
DrJKL 6c9beea
Merge remote-tracking branch 'origin/main' into glary/fe-1539-unpack-…
Glary-Bot baa5eab
Merge branch 'main' into glary/fe-1539-unpack-missing-link-id-test
DrJKL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
browser_tests/tests/subgraph/subgraphUnpackUnconnectedInput.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| import { expect } from '@playwright/test' | ||
|
|
||
| import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage' | ||
| import { SubgraphHelper } from '@e2e/fixtures/helpers/SubgraphHelper' | ||
|
|
||
| test.describe( | ||
| 'Subgraph unpack with unconnected input slots', | ||
| { tag: ['@subgraph', '@vue-nodes'] }, | ||
| () => { | ||
| const SUBGRAPH_NODE_TITLE = 'New Subgraph' | ||
| const CLIP_TEXT_ENCODE_TITLE = 'CLIP Text Encode (Prompt)' | ||
| const MISSING_LINK_ID_ERROR = 'Missing Link ID when unpacking' | ||
| const PROMPT_TEXT = 'a painting of a hedgehog' | ||
|
|
||
| test.beforeEach(async ({ comfyPage }) => { | ||
| await comfyPage.workflow.loadWorkflow( | ||
| 'subgraphs/subgraph-with-promoted-text-widget' | ||
| ) | ||
| await expect( | ||
| comfyPage.vueNodes.getNodeByTitle(SUBGRAPH_NODE_TITLE) | ||
| ).toBeVisible() | ||
| }) | ||
|
|
||
| test('does not log "Missing Link ID" for boundary links whose host input is unconnected', async ({ | ||
| comfyPage | ||
| }) => { | ||
| const { warnings, dispose } = SubgraphHelper.collectConsoleWarnings( | ||
| comfyPage.page, | ||
| [MISSING_LINK_ID_ERROR] | ||
| ) | ||
|
|
||
| try { | ||
| await comfyPage.subgraph.unpackViaContextMenu(SUBGRAPH_NODE_TITLE) | ||
| expect(warnings).toEqual([]) | ||
| } finally { | ||
| dispose() | ||
| } | ||
| }) | ||
|
|
||
| test('keeps the promoted widget value when the host input is unconnected', async ({ | ||
| comfyPage | ||
| }) => { | ||
| const promotedText = comfyPage.vueNodes.getWidgetByName( | ||
| SUBGRAPH_NODE_TITLE, | ||
| 'text' | ||
| ) | ||
| await promotedText.fill(PROMPT_TEXT) | ||
| await promotedText.blur() | ||
| await expect(promotedText).toHaveValue(PROMPT_TEXT) | ||
|
|
||
| await comfyPage.subgraph.unpackViaContextMenu(SUBGRAPH_NODE_TITLE) | ||
|
|
||
| await expect( | ||
| comfyPage.vueNodes.getWidgetByName(CLIP_TEXT_ENCODE_TITLE, 'text') | ||
| ).toHaveValue(PROMPT_TEXT) | ||
| }) | ||
|
|
||
| test('restores the promoted widget value when the unpack is undone', async ({ | ||
| comfyPage | ||
| }) => { | ||
| const promotedText = comfyPage.vueNodes.getWidgetByName( | ||
| SUBGRAPH_NODE_TITLE, | ||
| 'text' | ||
| ) | ||
| await promotedText.fill(PROMPT_TEXT) | ||
| await promotedText.blur() | ||
| await expect(promotedText).toHaveValue(PROMPT_TEXT) | ||
|
|
||
| await comfyPage.subgraph.unpackViaContextMenu(SUBGRAPH_NODE_TITLE) | ||
| await comfyPage.keyboard.undo() | ||
|
|
||
| await expect( | ||
| comfyPage.vueNodes.getNodeByTitle(SUBGRAPH_NODE_TITLE) | ||
| ).toBeVisible() | ||
| await expect( | ||
| comfyPage.vueNodes.getWidgetByName(SUBGRAPH_NODE_TITLE, 'text') | ||
| ).toHaveValue(PROMPT_TEXT) | ||
| }) | ||
| } | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import type { INodeInputSlot } from '@/lib/litegraph/src/interfaces' | ||
| import type { LGraphNode } from '@/lib/litegraph/src/litegraph' | ||
| import { isWidgetValue } from '@/lib/litegraph/src/types/widgets' | ||
| import { useWidgetValueStore } from '@/stores/widgetValueStore' | ||
|
|
||
| /** | ||
| * Copies a promoted host widget's value onto the interior widget it forwards to. | ||
| * | ||
| * A promoted input holds the user-facing value on the host subgraph node and | ||
| * never writes it through, so unpacking must move it or the edit is lost. | ||
| */ | ||
| export function adoptPromotedWidgetValue( | ||
| hostInput: INodeInputSlot, | ||
| targetNode: LGraphNode, | ||
| targetSlot: number | ||
| ): void { | ||
| const { widgetId } = hostInput | ||
| if (!widgetId) return | ||
|
|
||
| const value = useWidgetValueStore().getWidget(widgetId)?.value | ||
| if (value === undefined || !isWidgetValue(value)) return | ||
|
|
||
| const targetInput = targetNode.inputs.at(targetSlot) | ||
| if (!targetInput) return | ||
|
|
||
| const widget = targetNode.getWidgetFromSlot(targetInput) | ||
| if (!widget) return | ||
|
|
||
| widget.value = value | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
Route the widget update through the unpack command batch.
Line 29 directly mutates
widget.value. This entity state change has no serializable, replayable, or undoable command record. Put the resolved target widget identity and value in the unpack command payload. Apply that command with the rest of the unpack batch. Add command replay and undo coverage for this value transfer.As per coding guidelines, “All entity state changes must use serializable, idempotent, deterministic commands that are replayable, undoable, and transmittable over CRDT; systems should produce command batches rather than direct side effects.”
🤖 Prompt for AI Agents
Source: Coding guidelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added undo coverage (
bb1d12e9), but I'm pushing back on the command-pattern rewrite. Three things don't hold up when checked against the current code.1. There is no "unpack command batch" to join.
_unpackSubgraphImplis imperative from top to bottom —LiteGraph.createNode,this.add(node, true),node.configure(n_info),originNode.connect(...),this.remove(subgraphNode),new Reroute(...),this.reroutes.set(...). None of it produces commands.grepfor command infrastructure (applyCommand,commandBatch,CommandBatch,WidgetCommand) returns zero matches anywhere insrc/, andwidgetValueStoreexposes a plainsetValue, not a dispatcher. So there is no batch to append to and no replay/undo machinery to register with — the suggestion would require building that layer first and converting all of unpack to it.2. The value transfer is already undoable — undo here is snapshot-based, not command-based.
unpackSubgraphwraps the work inbeforeChange()/afterChange()(commented in-source as "used for undo"), andchangeTrackerimplements undo by snapshotting the serialised graph:Because undo captures whole serialised graph states, anything that appears in serialisation round-trips automatically — no per-mutation command record required. I verified this end-to-end rather than assuming it, and added it as a permanent test: fill the promoted widget → unpack → Ctrl+Z → the subgraph node returns with the promoted value intact. Screenshot below; the test passes (3/3 in this spec).
That satisfies the actual intent of your comment ("add undo coverage for this value transfer") without the architectural change.
3.
widget.value = valueis the established mechanism for exactly this.It's what
LGraphNode.configuredoes when restoring serialised values:Using a different mechanism for this one assignment would make it less consistent, not more.
On the guideline citation: ADR 0003 and ADR 0008 are both
Status: Proposed.AGENTS.mdstates that "Proposed ADRs indicate design direction and should be treated as guidance," reserving "must be consistent with" for accepted ADRs. ADR 0008's own amendment notes the central-registry design "was superseded during implementation." ConvertingunpackSubgraphto command-driven mutation is a real and worthwhile piece of work toward that direction — but it's an architecture-wide migration touching node creation, linking, removal and reroutes, and undo semantics for all of them. Doing it inside a bug fix for a spuriousconsole.errorwould balloon a ~15-line fix into a refactor of the whole unpack path, against the repo's own "keep PRs focused and small" guidance.Happy to file that as a separate issue if it's worth tracking.
Screenshots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.