Skip to content

test: guard Clear workflow against inherited widget values (FE-3347) - #20701

Merged
christian-byrne merged 4 commits into
mainfrom
glary/fe-3347-clear-widget-value-regression-test
Oct 10, 2026
Merged

christian-byrne merged 4 commits into
mainfrom
glary/fe-3347-clear-widget-value-regression-test

Conversation

@christian-byrne

@christian-byrne christian-byrne commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Regression test for #20648 / FE-3347. It covers this case: after LGraph.clear(), a new node that reuses a cleared node's id must not pick up that node's widgetValueStore row, and the old graphId:nodeId:widget row must be gone. The test lives in LGraph.test.ts, in the "Graph Clearing and Callbacks" group, next to the existing clear() store-cleanup test.

This test passes on current main. The bug was reported on 1.52.7, and it does not reproduce from 1.53.1 onward. Commit a8abe57 (#14246) changed clear() so it gives the root graph a fresh UUID instead of resetting it to zeroUuid, which used to skip the purge. main also discards each cleared node's widget rows on its own, through clearNodeOwnedStoreState and detachNodeFromStores(..., 'discard-values'). The test overlaps the existing graph-wide clear() purge test as a guard. Its value is recording the reported scenario with real nodes.

I chose a unit test over Playwright because Comfy.ClearWorkflow comes down to app.clean() → rootGraph.clear(), and the leak happens entirely inside LGraph and widgetValueStore.

Fixes #20648 (already fixed on main by #14246; this PR adds the regression test)

Verification

  • pnpm exec vitest run src/lib/litegraph/src/LGraph.test.ts: 127/127 pass.
  • Mutation check, with LGraph.ts edited temporarily and then reverted: restoring 1.52.7 behavior (no purges, root reset to zeroUuid) makes the new test fail.
  • oxfmt is clean. Test-only change, so no browser or tmux QA.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: ✅ Built — View Storybook

Details

⏰ Completed at: 10/10/2026, 08:23:22 PM UTC

Links

🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measure

Executes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight ecosystem-matrix shard checks are a harness self-test; the pack verdict is matrix-verdict.

This candidate changes nothing the matrix measures, so every expensive stage was skipped.

Reproduce locally
# build one shard's fixture, then run it
python3 scripts/registry-census/build_matrix.py --shard 1/4
MATRIX_RENDERER=vue MATRIX_VUE=1 \
  npx vitest run --config vitest.matrix.config.mts

Full docs: scripts/registry-census/README.md

🌾 Fallow: ✅ Passed

Fallow audits the diff for duplication, complexity and dead code. It gates on new findings only, so when the audit completes, a red is something this PR introduced or moved — never inherited backlog. A red can also mean the audit itself did not finish; the details below say which happened.

No new findings in the changed files.

Reproduce locally
# the base the gate compared against
npx fallow audit --root . --quiet --format json \
  --changed-since cf1ec2e64810320ee6a6338dfb47a24fa84fcf37

Full docs: ADR-DEVEX-LINT-0015

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 38615415-7db1-46ef-b645-4624fdbed880

📥 Commits

Reviewing files that changed from the base of the PR and between fa08533 and edd2109.


You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Comfy-Org/ComfyUI_frontend/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 29356a3b-b509-4832-b345-148bfc293779


📥 Commits

Reviewing files that changed from the base of the PR and between 36e74e8 and fa08533.



📒 Files selected for processing (1)
  • src/lib/litegraph/src/LGraph.test.ts


Included review availability: This review used your included allowance. 7 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 8 reviews per hour.




📝 Walkthrough
📝 Walkthrough

Walkthrough

Adds a regression test for sampler widget values after graph.clear(). The test confirms that a replacement node can reuse the cleared node’s ID and retain its own default widget value.

Changes

Widget value cleanup

Layer / File(s) Summary
Graph clear regression test
src/lib/litegraph/src/LGraph.test.ts
The test sets a sampler widget value, clears the graph, and verifies that a node reusing the cleared node’s ID keeps its default value, 'euler'.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: anupreet-comfy



Merge Risk: ⚪ Minimal · up to fa085

This PR adds a focused regression test and does not change runtime behavior. No actionable merge-blocking risk is established.

Pre-merge checks | Passed 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check Passed The title clearly identifies the change as a regression test for the Clear workflow and includes the relevant issue identifier.
Description check Passed The description includes the required Summary and Verification sections. It explains the regression scenario, test scope, verification command, mutation check, formatting result, and the absence of br…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
End-To-End Regression Coverage For Fixes Passed No bug-fix signal appears in the PR title or commit subjects. The title and all three subjects use test/merge wording, so the failure conditions are not all met.
Website End-To-End Regression Coverage Passed PASS: The changed file is src/lib/litegraph/src/LGraph.test.ts, not a file under apps/website/src/ or apps/website/public/. The website end-to-end regression coverage check does not apply.
Adr Compliance For Entity/Litegraph Changes Passed PASS. The PR changes only src/lib/litegraph/src/LGraph.test.ts and adds a regression test. The available diff and description show no new entity methods, properties, mutation APIs, component methods…




✨ Finishing Touches 💡 1
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR







🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR



🛠️ Fix failing CI checks 💡
  • Commit to this branch
  • Create a new PR

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@glary-bot

glary-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

This CodeRabbit comment is only the "review in progress" status placeholder and has no findings in it, so I haven't made any changes. I'll address any inline feedback once the review finishes.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 10, 2026
@glary-bot

glary-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

Thanks for the approval. No specific comments came through with it, so I've left the branch unchanged.

@christian-byrne
christian-byrne marked this pull request as ready for review October 10, 2026 02:07
@christian-byrne
christian-byrne requested a review from a team October 10, 2026 02:07
@github-actions github-actions Bot added the risk:high PR risk grade (advisory shadow check; grader-owned) label Oct 10, 2026
@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main   #20701      +/-   ##
==========================================
+ Coverage   86.07%   86.87%   +0.80%     
==========================================
  Files        3632     2583    -1049     
  Lines      173392   145187   -28205     
  Branches    47846    37749   -10097     
==========================================
- Hits       149242   126127   -23115     
+ Misses      22143    18674    -3469     
+ Partials     2007      386    -1621     
Flag Coverage Δ
billing-web-unit ?
unit 84.71% <ø> (ø)
website-unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1049 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@benceruleanlu benceruleanlu left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This review was performed agentically. Ben will be notified to review manually soon.

Review details

Reviewed head: 36e74e8c1974f24cf9f111fc5c75de7183e23232
Reviewed actual base tip (main): a67953153e68e04f172cfff175130804d4da50b0

I'd approve this PR. It adds one test file, the test is correct, and everything the description claims checks out. My only substantive point is that it adds almost no coverage the suite didn't already have.

What I verified

  • The test passes at 36e74e8c. CI shows 58 checks passed, 38 skipped and none failed. CodeRabbit approved it with no findings.

  • The starting state matches real use. The issue's trigger is a root graph with the all-zeros id, and that can't happen on main:

    • The constructor's clear() gives the graph a fresh id (LGraph.ts:888).
    • _configureBase refuses the all-zeros id on a root graph (LGraph.ts:3071).
    • app.clean() also calls ensureNonZeroUuid (src/scripts/app.ts:2845).

    So starting the test from new LGraph() is correct, and the description's explanation of #14246 holds.

  • The mutation checks reproduce. I edited LGraph.ts, ran each case, then restored it; the worktree is clean. I ran the new test alongside the existing test "clear() removes graph-scoped preview and widget-value state" (LGraph.test.ts:1029):

Change to LGraph.ts New test Existing test at :1029
Remove only the graph-wide clearGraph purge pass fail
Remove only the per-node purges pass pass
Remove all three purges, keep the fresh id fail (line 44) fail
Stop giving a fresh id, keep the purges pass pass
Undo both (1.52.7 behaviour) fail (line 44) fail

With line 44 removed, the last case fails at line 48 with dpmpp_2m, the reported symptom, as the description says.

Points for the author

  1. (Optional) It overlaps the existing test. In every case above, the new test fails only when LGraph.test.ts:1029 already fails, so as a guard it catches nothing new.
    • The stale-row check (line 44) duplicates the existing test.
    • The id-reuse check (line 48) can only fail if the fresh-id change is undone too. While the root gets a new id on clear, the new node's key can't match the old row.
    • Its real value is as a record of the reported scenario, using a real node instead of a row seeded by hand. That's worth keeping, but it could go in the same describe as the :1029 test rather than a new file. Per the guidance's "smallest set of tests", either option is fine; it's a 1 ms test.
  2. Issue linkage. The PR says Ref #20648, so the issue stays open after merge, even though the PR shows main no longer reproduces it. Either change it to Fixes #20648, or close the issue by hand and point to a8abe57 / #14246.
  3. Nit: createNode(type)! and widgets![0] use ! assertions where docs/guidance/testing-principles.md asks for assert.exists narrowing. The neighbouring test (LGraph.configureStoreScope.test.ts) does the same, so this is low priority.

I haven't posted anything on the PR. Want me to post this as a review comment?

@glary-bot

glary-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

@benceruleanlu thanks. I made all three changes in fa08533:

  1. Overlap: I agree it adds no new guard coverage. I've kept it as a record of the reported scenario using real nodes, but moved it into LGraph.test.ts under "Graph Clearing and Callbacks", next to the clear() store-cleanup test, and deleted the separate file.
  2. Issue linkage: the description now says Fixes #20648 and explains that Still Draft Feature: ECS Migration #14246 (a8abe57) already fixed it on main.
  3. Nit: the ! assertions are replaced with assert.exists narrowing.

LGraph.test.ts passes 127/127. The 1.52.7 mutation (no purges, id reset to zeroUuid) still makes the new test fail.

@datadog-official

This comment has been minimized.

@glary-bot

glary-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

Thanks for the re-approval on fa08533. It didn't include any specific comments, so I haven't changed anything.

@glary-bot

glary-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

@benceruleanlu thanks for approving. This approval came through with no inline comments or body text, and fa08533 already covers your earlier review's three points:

  • The test now lives in LGraph.test.ts, next to the clear() store-cleanup test.
  • The description says Fixes #20648.
  • The ! assertions now use assert.exists.

So I've left the branch unchanged. If a comment didn't come through, please re-post it.

@christian-byrne christian-byrne left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the tests are all failing

@glary-bot

glary-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

@christian-byrne I looked into the red checks. The new test is not what's failing. CI is failing because this branch's base is behind main.

  • Root cause: lint-pr / server-facts fails with ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL: Command "lint:server-facts" not found. The workflow calls a script that FE-3350 / FE-3351 / FE-3352 / FE-3353 feat: server-fact guardrails (ADR, changed-line lint gate, agent hooks) #20679 (a679531) added to package.json on main after this branch last synced.
  • Knock-on failures: preflight, lint-and-format, test and e2e-status all fail on their gate step (LINT: failure / PREFLIGHT: failure), downstream of that one job. No unit test or Playwright test actually ran.
  • The test itself: LGraph.test.ts passes 127/127 locally, both on the branch head and merged with current main.

Fix: merge origin/main into the branch. I did this locally (no conflicts). On the merged tree:

  • pnpm lint exits 0.
  • pnpm lint:server-facts --base origin/main reports no findings.
  • LGraph.test.ts passes 127/127.

Not pushed yet: our push tool fails with "Could not determine the current git branch", so the merge is still local. Until that's resolved, the "Update branch" button on this PR applies the same fix, since it's purely a merge of main.

@glary-bot

glary-bot Bot commented Oct 10, 2026

Copy link
Copy Markdown

The push failure is fixed and the main merge is now on the branch (edd2109). CI is green: 58 checks passed, 38 skipped, none failed. That includes server-facts, preflight, lint-and-format, e2e-status and every unit / test-shards job.

@christian-byrne
christian-byrne added this pull request to the merge queue Oct 10, 2026
Merged via the queue into main with commit d6cd2d3 Oct 10, 2026
97 checks passed
@christian-byrne
christian-byrne deleted the glary/fe-3347-clear-widget-value-regression-test branch October 10, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:high PR risk grade (advisory shadow check; grader-owned)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clear workflow: new nodes inherit widget values of deleted nodes (widgetValueStore not purged for the zero-UUID root graph)

3 participants