Repository navigation
test: guard Clear workflow against inherited widget values (FE-3347) - #20701
Conversation
🎨 Storybook: ✅ Built — View Storybook🧩 Custom Nodes Ecosystem Matrix: 🟡 Withheld — could not measureExecutes the frontend JS of every registry pack that ships any, against this change, in both renderers. The eight 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: ✅ PassedFallow 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 |
|
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. |
|
Thanks for the approval. No specific comments came through with it, so I've left the branch unchanged. |
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
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
benceruleanlu
left a comment
There was a problem hiding this comment.
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). _configureBaserefuses the all-zeros id on a root graph (LGraph.ts:3071).app.clean()also callsensureNonZeroUuid(src/scripts/app.ts:2845).
So starting the test from
new LGraph()is correct, and the description's explanation of #14246 holds. - The constructor's
-
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
- (Optional) It overlaps the existing test. In every case above, the new test fails only when
LGraph.test.ts:1029already 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
describeas the:1029test rather than a new file. Per the guidance's "smallest set of tests", either option is fine; it's a 1 ms test.
- Issue linkage. The PR says
Ref #20648, so the issue stays open after merge, even though the PR showsmainno longer reproduces it. Either change it toFixes #20648, or close the issue by hand and point to a8abe57 / #14246. - Nit:
createNode(type)!andwidgets![0]use!assertions wheredocs/guidance/testing-principles.mdasks forassert.existsnarrowing. 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?
|
@benceruleanlu thanks. I made all three changes in fa08533:
|
This comment has been minimized.
This comment has been minimized.
|
Thanks for the re-approval on fa08533. It didn't include any specific comments, so I haven't changed anything. |
|
@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:
So I've left the branch unchanged. If a comment didn't come through, please re-post it. |
christian-byrne
left a comment
There was a problem hiding this comment.
the tests are all failing
…idget-value-regression-test
|
@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.
Fix: merge
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. |
|
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 |
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'swidgetValueStorerow, and the oldgraphId:nodeId:widgetrow must be gone. The test lives inLGraph.test.ts, in the "Graph Clearing and Callbacks" group, next to the existingclear()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) changedclear()so it gives the root graph a fresh UUID instead of resetting it tozeroUuid, which used to skip the purge.mainalso discards each cleared node's widget rows on its own, throughclearNodeOwnedStoreStateanddetachNodeFromStores(..., 'discard-values'). The test overlaps the existing graph-wideclear()purge test as a guard. Its value is recording the reported scenario with real nodes.I chose a unit test over Playwright because
Comfy.ClearWorkflowcomes down toapp.clean() → rootGraph.clear(), and the leak happens entirely insideLGraphandwidgetValueStore.Fixes #20648 (already fixed on
mainby #14246; this PR adds the regression test)Verification
pnpm exec vitest run src/lib/litegraph/src/LGraph.test.ts: 127/127 pass.LGraph.tsedited temporarily and then reverted: restoring 1.52.7 behavior (no purges, root reset tozeroUuid) makes the new test fail.