Repository navigation
Conversation
Collapses the twelve reviewed slices of the ECS migration into one commit so the series can be replayed onto main as a unit. Each slice kept its own review on GitHub: - ECS: Moving widgets out of the Node data (#13322) - ECS: Link topology store (single source of truth for link data) (#13436) - ECS: Reroute chain store with derived link membership (#13449) - ECS: derive slot floating links; reroute cleanup follow-ups (#13451) - refactor: read widgeted-input connectivity from linkStore (#13455) - feat: nodeBadgeStore + badge system (slice A) (#13458) - refactor: derive badge rows on read, delete the badge store (#13686) - refactor: host-scoped promoted widget rows (no source traversal) (#13434) - refactor!: delete the output.links runtime mirror (#13479) - refactor!: delete the input.link runtime mirror (#13498) - fix: ECS stack audit fixes (#13528) - refactor!: make nodeDataStore the source of truth for node shell state (#13963) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
🎭 Playwright: ✅ 1755 passed, 0 failed · 3 flaky📊 Browser Reports
🎨 Storybook: ✅ Built — View Storybook📦 Bundle: 8.15 MB gzip 🔴 +5.31 kBDetailsSummary
Category Glance App Entry Points — 3.63 kB (baseline 3.63 kB) • 🟢 -2 BMain entry bundles and manifests
Status: 1 added / 1 removed Graph Workspace — 1.31 MB (baseline 1.28 MB) • 🔴 +25.4 kBGraph editor runtime, canvas, workflow orchestration
Status: 1 added / 1 removed / 1 unchanged Views & Navigation — 112 kB (baseline 112 kB) • 🔴 +2 BTop-level views, pages, and routed surfaces
Status: 14 added / 14 removed / 2 unchanged Panels & Settings — 551 kB (baseline 551 kB) • 🟢 -7 BConfiguration panels, inspectors, and settings screens
Status: 12 added / 12 removed / 14 unchanged User & Accounts — 29.1 kB (baseline 29.1 kB) • 🔴 +1 BAuthentication, profile, and account management bundles
Status: 8 added / 8 removed / 2 unchanged Editors & Dialogs — 121 kB (baseline 121 kB) • 🟢 -2 BModals, dialogs, drawers, and in-app editors
Status: 6 added / 6 removed UI Components — 110 kB (baseline 64.8 kB) • 🔴 +45 kBReusable component library chunks
Status: 15 added / 14 removed Data & Services — 3.36 MB (baseline 3.42 MB) • 🟢 -58.2 kBStores, services, APIs, and repositories
Status: 15 added / 15 removed / 2 unchanged Utilities & Hooks — 369 kB (baseline 369 kB) • 🟢 -19 BHelpers, composables, and utility bundles
Status: 25 added / 25 removed / 10 unchanged Vendor & Third-Party — 15.7 MB (baseline 15.7 MB) • 🟢 -45 BExternal libraries and shared vendor chunks
Status: 3 added / 3 removed / 13 unchanged Other — 12.5 MB (baseline 12.5 MB) • 🔴 +226 BBundles that do not match a named category
Status: 122 added / 122 removed / 155 unchanged ⚡ Performance
|
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (5)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis PR migrates LiteGraph's link, reroute, and node connectivity state from scattered class fields and slot mirrors ( ChangesECS store migration
Estimated code review effort: 5 (Critical) | ~180 minutes Sequence Diagram(s)sequenceDiagram
participant LGraph
participant LinkStore
participant LLink
participant RerouteStore
participant NodeDataStore
LGraph->>LLink: _addLink(link)
LLink->>LinkStore: registerLinkTopology(graph, link)
LGraph->>RerouteStore: registerRerouteChain(graph, reroute)
LGraph->>NodeDataStore: registerNodeState(graph, node)
LinkStore-->>LGraphNode: isInputSlotConnected / getOutputSlotLinks
Possibly related PRs
Suggested labels: Suggested reviewers: Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (1 inconclusive)
✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #14240 +/- ##
==========================================
+ Coverage 78.69% 79.21% +0.52%
==========================================
Files 1755 1764 +9
Lines 110171 103054 -7117
Branches 36099 34204 -1895
==========================================
- Hits 86698 81636 -5062
+ Misses 22933 20946 -1987
+ Partials 540 472 -68
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 180 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 45
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (5)
src/renderer/extensions/vueNodes/components/LGraphNodePreview.vue (1)
67-95: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDrop deprecated slot mirrors from preview data
previewInputsandpreviewOutputsonly need the core slot fields here;link/linksare deprecated and unused, so omitting them keeps the preview state minimal.🤖 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/renderer/extensions/vueNodes/components/LGraphNodePreview.vue` around lines 67 - 95, Remove the deprecated link and links properties from the slot objects created by previewInputs and previewOutputs. Keep the existing input/output names, types, optional shape handling, spread fields, and boundingRect initialization unchanged.src/components/builder/AppModeWidgetList.vue (1)
141-151: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
nodeToNodeDatabypasses the store contract other files use.This spreads
node._statedirectly, whereasGraphCanvas.vuein this same PR reads node state exclusively throughnodeDataStore.getGraphNodesFor(...). Reading the underscore-prefixed internal field directly here creates an inconsistent access pattern for the same underlying data and leaks an implementation detail (the exact shape of_state) into this component'sWidgetEntry.nodeDatatype instead of going through the store's public API.🤖 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/components/builder/AppModeWidgetList.vue` around lines 141 - 151, Update nodeToNodeData to obtain node state through nodeDataStore.getGraphNodesFor(...) instead of spreading node._state directly. Preserve the existing error, drop-indicator, and drag-handler fields while ensuring WidgetEntry.nodeData uses the store’s public graph-node data contract.src/lib/litegraph/src/canvas/LinkConnector.core.test.ts (1)
49-72: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFixture links now land in the real graph's map but skip store registration.
links: graph._linkspluscreateTestLinkinserting directly means those links exist in the graph withoutregisterLinkTopology, so any code path that consultslinkStoresees no topology for them. Tests exercising store-backed lookups could pass vacuously. Consider routing fixture links throughregisterLinkTopology(as the reroute test at Line 257 does), or usinggraph._addLink.🤖 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/lib/litegraph/src/canvas/LinkConnector.core.test.ts` around lines 49 - 72, The test network fixture exposes graph._links without registering inserted fixture links in linkStore, causing store-backed lookups to miss topology. Update the network setup around the network links and createTestLink flow so fixture links are added through registerLinkTopology, or use graph._addLink, while preserving the existing LinkNetwork interface and reroute behavior.src/lib/litegraph/src/interfaces.ts (1)
363-391: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winExtension-facing break:
link/linksbecomingreadonlyoptional needs migration guidance.Custom nodes commonly write
input.link = …/output.links = […]; those now fail type-check and silently no-op at runtime. Please link the migration doc (e.g. the relevantdocs/architecture/*entry) from these JSDoc blocks so ecosystem authors have a concrete upgrade path.As per coding guidelines, "Under ADR 0008, be cautious with extension-facing changes … without migration guidance, because they affect the custom node ecosystem."
🤖 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/lib/litegraph/src/interfaces.ts` around lines 363 - 391, Update the JSDoc blocks for INodeInputSlot.link and INodeOutputSlot.links to include a link to the relevant ADR 0008 migration guidance in the architecture documentation, directing extension authors to the supported read and mutation APIs. Keep the existing deprecation descriptions and API references intact.Source: Coding guidelines
src/utils/widgetUtil.ts (1)
44-74: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
renameWidgetalways returnstrue, making the failure check inpromptRenameWidgetdead code.With the
parents-based no-op handling removed, no branch inrenameWidgetcan returnfalseanymore, soif (!renameWidget(...)) return nullinpromptRenameWidget(line 99) is now unreachable.♻️ Suggested cleanup
-export function renameWidget( - widget: IBaseWidget, - node: LGraphNode, - newLabel: string -): boolean { +export function renameWidget( + widget: IBaseWidget, + node: LGraphNode, + newLabel: string +): void { ... node.graph?.trigger('node:slot-label:changed', { nodeId: node.id, slotType: NodeSlotType.INPUT }) - - return true }- if (!renameWidget(widget, node, normalizedLabel)) return null + renameWidget(widget, node, normalizedLabel)Also applies to: 88-99
🤖 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/utils/widgetUtil.ts` around lines 44 - 74, Remove the obsolete boolean failure contract from renameWidget and update its callers, including promptRenameWidget, so they no longer check for a false return. Preserve the existing rename side effects and return behavior while eliminating the now-unreachable failure branch.
🤖 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 `@docs/adr/0008-entity-component-system.md`:
- Around line 24-38: The amendment’s proxy-based class-field writes conflict
with the ADR’s command-driven ECS mutation principle. Update the amendment
describing linkStore and rerouteStore to explicitly identify direct
reactive-proxy writes as a transitional exception and document the intended
eventual command boundary, while preserving the existing store registration
details.
- Around line 183-189: Update the architecture records to reflect that
input.link and output.links slot mirrors were deleted and stores are
authoritative: in docs/adr/0008-entity-component-system.md lines 183-189, revise
the SlotConnection amendment; in docs/architecture/output-slot-connectivity.md
lines 108-118, label Decision 4 as historical migration guidance; and in
docs/architecture/proto-ecs-stores.md lines 388-391 and 408-410, remove the
stale “slot mirrors remain” status from the Link gap row and priority list.
In `@docs/architecture/ecs-lifecycle-scenarios.md`:
- Line 268: The load-time reroute-ID repair documentation must consistently
state that link-ID deduplication is absent. In
docs/architecture/ecs-lifecycle-scenarios.md:268, retain the explicit
no-link-ID-dedup rule; in docs/architecture/reroute-chain-store.md:64-67, remove
or correct the claim that subgraph deserialization performs link-ID
deduplication.
In `@docs/architecture/ecs-migration-plan.md`:
- Around line 766-775: Update the nodeDataStore row in the architecture table to
list NodeId as its key format, replacing the incorrect NodeState identity (Set)
description while preserving the root-graph-scoped buckets wording.
- Around line 802-803: Update the Phase 1c dedicated-store inventory annotation
to reflect all nine stores by changing the count to “widgetValueStore + 8
others,” or explicitly document the intentional exclusion of nodeDataStore if
retaining the current count.
In `@docs/architecture/ecs-target-architecture.md`:
- Around line 392-399: Update docs/architecture/ecs-target-architecture.md lines
392-399 to state that linkStore is authoritative for both input and output
connectivity, distinguish keyed entries from unkeyed floating-link cases, and
describe slot fields only as deprecated compatibility accessors. Update
docs/architecture/entity-interactions.md lines 281-285 to remove slot-mirror
update guidance and qualify target-slot indexing for floating and
subgraph-output links.
In `@docs/architecture/link-topology-store.md`:
- Around line 18-20: Add an appropriate language identifier to the fenced code
block in docs/architecture/link-topology-store.md at lines 18-20 and the
corresponding fenced block in docs/architecture/node-badge-store.md at lines
40-44; update both fences only, preserving their contents.
In `@docs/architecture/reroute-chain-store.md`:
- Around line 24-26: Update both fenced code blocks in the documentation
examples around the linksThrough expression to include an explicit language
identifier, using text for the plain-content blocks, while preserving their
contents.
In `@src/components/builder/AppModeWidgetList.vue`:
- Around line 62-110: Remove the widget store mutation from the mappedSelections
computed getter: keep mappedSelections as a pure derivation and retain its
existing filtering and mapping behavior. Register each resolved widget through a
watch or watchEffect driven by resolvedInputs (or the corresponding selection
changes), reusing ensureSelectedWidgetState and preserving its existing guard
against duplicate registration.
In `@src/composables/graph/useVueNodeLifecycle.ts`:
- Around line 150-167: The setupEmptyGraphListener function discards the
useEventListener cleanup, allowing stale one-shot node:added listeners to
accumulate across empty canvas mounts. Store its stop handle alongside
stopNodeListeners, and update disposeVueNodeLayout to invoke and clear that
handle during disposal.
In `@src/composables/node/useNodeBadge.ts`:
- Around line 49-56: Update the event-listener setup in init() to guard
app.canvas before accessing its canvas property, matching the optional guarding
used by app.canvas?.setDirty. Preserve the existing litegraph:set-graph listener
behavior when the canvas is available.
In `@src/composables/node/useNodePricing.ts`:
- Around line 508-514: Update the promise construction in the pricing evaluation
flow around rule._compiled.evaluate so evaluation is deferred via a promise
callback, ensuring synchronous throws reach the existing catch/finally handling.
Preserve the current cache-empty behavior, and add coverage for a synchronous
evaluation throw.
In `@src/lib/litegraph/src/__fixtures__/nodeHelpers.ts`:
- Around line 38-50: Update createTestWidgetNode to register an onTestFinished
cleanup that removes WIDGET_NODE_TYPE from LiteGraph.registered_node_types after
each test. Mirror the existing WIDGET_NODE_TYPE cleanup behavior and ensure the
cleanup targets only the test node registration.
In `@src/lib/litegraph/src/LGraph.ts`:
- Around line 576-578: Document the intentional reactive read in the nodes
getter by adding a concise comment immediately above void this._version,
explaining that accessing _version establishes reactivity for graph.nodes
consumers and must not be removed. Keep the existing getter behavior unchanged.
- Around line 494-503: Update the subgraph branch of clear() in LGraph to also
unregister widget-order/value rows and preview-exposure entries associated with
the graph, using the existing store cleanup APIs or entity-level helpers
alongside unregisterAllLinkTopologies, unregisterAllRerouteChains, and
unregisterAllNodeStates.
In `@src/lib/litegraph/src/LGraphCanvas.ts`:
- Around line 6088-6094: Cache the link store once at the start of
drawConnections and reuse it while iterating node inputs, rather than calling
inputLink() for every slot. Update the link lookup path to use the cached store
(or a per-graph target map) while preserving the existing link-selection
behavior.
In `@src/lib/litegraph/src/LGraphNode.ts`:
- Around line 3255-3268: Update the floating-link removal logic in the slot
handling method around slotFloatingLinks and removeFloatingLink so removing any
floating links marks the canvas dirty before the subsequent no-graph or
no-output-links early returns. Preserve the existing return behavior while
ensuring setDirtyCanvas(false, true) is invoked when floating links were
removed.
- Around line 730-736: Widen the shape setter parameter in LGraphNode to accept
undefined alongside RenderShape and named shape keys. Keep the existing
setTrackedState conversion unchanged so undefined and the default named shape
continue mapping to the established default behavior.
- Around line 4379-4388: Update registerNodeState to remove the node’s existing
registration before assigning its new graph state and registering it in the
current root graph store. Reuse unregisterNodeState for the cleanup, ensuring
re-adding a node instance cannot leave stale state in its previous root-graph
bucket.
In `@src/lib/litegraph/src/linkDeduplication.ts`:
- Around line 108-120: In the endpoint realignment flow, avoid calling
useLinkStore().updateEndpoints when the updates array is empty. Add an early
return after collecting updates and before the store call, while preserving the
existing update and error-logging behavior when updates contains entries.
- Around line 59-66: Remove the unused graph._links.get lookup and its
associated link guard from the loop in the link deduplication function, leaving
_removeLink(id) to handle missing links while preserving the keepId skip
behavior.
In `@src/lib/litegraph/src/LLink.ts`:
- Around line 99-112: Update applyEndpointPatch() to propagate updateEndpoint()
failures instead of only logging them, returning the result or throwing when
result.ok is false so configure(), connectToInput(), and reroute retargeting can
abort. Preserve the direct Object.assign behavior for links without a graph ID
and adjust callers to handle the propagated failure.
In `@src/lib/litegraph/src/node/slotEcosystemPatterns.test.ts`:
- Around line 23-34: Remove the local mockCanvasContext helper and reuse the
shared createMockCanvasRenderingContext2D helper in the affected tests, updating
call sites as needed while preserving the existing test behavior.
In `@src/lib/litegraph/src/node/slotLinks.test.ts`:
- Around line 286-322: Add tests covering the graphless-node branch in
replaceNodeInputs by attempting a non-empty link assignment on a node not added
to a graph and asserting the expected error. Also add coverage for keepReroutes
= true, verifying floating reroutes are preserved when output links are
disconnected; reuse the existing topology assertions and helpers in
slotLinks.test.ts.
In `@src/lib/litegraph/src/node/slotUtils.test.ts`:
- Around line 41-42: Update the ordering assertion in the slot serialization
test to sort link IDs numerically rather than relying on default lexicographic
sort. Preserve the length assertion and compare serialised.links against a copy
sorted with an explicit numeric comparator.
In `@src/lib/litegraph/src/node/slotUtils.ts`:
- Around line 78-86: Update the output-slot construction around
shallowCloneCommonProps and outputWidget so links remains a non-null array for
consumers such as linkFixer, using an empty array when no output link IDs exist.
Preserve populated link IDs unchanged and ensure serialized data remains
compatible without requiring direct .length access to handle null.
In `@src/lib/litegraph/src/Reroute.ts`:
- Around line 796-805: Update the cleanup loop in the reroute-removal flow
around lastReroute and network.removeFloatingLink to iterate over a snapshot
copy of lastReroute.floatingLinkIds rather than the live set. Preserve the
existing parentId check and removal behavior while ensuring every anchored
floating link is processed.
In `@src/lib/litegraph/src/subgraph/__fixtures__/subgraphHelpers.test.ts`:
- Around line 62-73: The disposal test only verifies existing node types are
removed, not that future subgraph creation remains disabled. Update
enableSubgraphNodeCreation and its returned disposer in subgraphHelpers.ts to
remove the registered subgraph-created listener as well as deleting node types,
then extend the test to create another subgraph after dispose() and assert
LiteGraph.createNode remains null.
In `@src/lib/litegraph/src/subgraph/__fixtures__/subgraphHelpers.ts`:
- Around line 66-96: Make subgraph node tracking local to each
enableSubgraphNodeCreation call instead of using the module-level
subgraphNodeTypesToDispose and disposeSubgraphNodeCreation state. Capture the
returned subgraph-created listener, remove it during that call’s disposer, and
delete only the node types registered by that invocation before clearing its
local tracking list.
In `@src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts`:
- Around line 115-119: Update the input mapping in the ExecutableNodeDTO
constructor to pass the already-narrowed this.graph to inputLinkId instead of
using the non-null assertion node.graph!. Preserve the existing link ID and
input mapping behavior.
In `@src/lib/litegraph/src/subgraph/SubgraphConversion.test.ts`:
- Around line 57-63: Update the test around interiorTopology to assert that the
lookup result is defined before accessing its properties. After the assertion,
call subgraph.getLink with interiorTopology.id rather than the optional id,
preserving the existing originNodeId and link-presence checks.
In `@src/lib/litegraph/src/subgraph/subgraphDeduplication.ts`:
- Around line 114-129: Update findNextAvailableId to accept an
allocator-specific label and use it in the exhaustion error message. Pass “Node
ID” from the node-ID call site and “Reroute ID” from the reroute-ID call site,
preserving the existing allocation behavior.
In `@src/lib/litegraph/src/subgraph/SubgraphSerialization.test.ts`:
- Around line 490-505: Remove the Object.keys(link) exact key-order assertion
from the serialization test, including the loop over first.links. Preserve the
Subgraph round-trip setup and the JSON.stringify comparison between second.links
and first.links as the relevant serialization check.
In `@src/renderer/extensions/minimap/composables/useMinimap.test.ts`:
- Line 969: Update the invalid-link test fixture at the registerMockLink call to
mutate moduleMockGraph.links directly, replacing the valid link1-to-node2 entry
with an invalid node reference. Do not use registerMockLink for this case, since
the minimap reads graph.links rather than the link store.
In `@src/renderer/extensions/vueNodes/components/LGraphNode.vue`:
- Around line 703-711: Update the widgetIds computed property to derive graphId
from the reactive canvasStore.rootGraphId instead of app.rootGraph?.id. Keep the
existing empty-array guard and widget ID lookup unchanged so
hasRenderableWidgets and NodeWidgets react after workflow loads.
In `@src/renderer/extensions/vueNodes/components/NodeSlots.test.ts`:
- Around line 37-48: Update the makeNodeData fixture to use the existing
zeroUuid sentinel for NodeState.graphId instead of an empty string, preserving
the root-graph representation and keeping the rest of the fixture unchanged.
In `@src/renderer/extensions/vueNodes/components/NodeWidgets.test.ts`:
- Around line 18-24: Update the test setup around useCanvasStore so it seeds the
real store’s currentGraph with the graph-test fixture instead of mocking the
canvasStore module. Remove the partial vi.mock for canvasStore, preserve the
GRAPH_ID fixture, and initialize currentGraph through the store before the tests
run.
In `@src/renderer/extensions/vueNodes/composables/useNodeTooltips.ts`:
- Around line 138-142: Define or reuse a shared exported tooltip-source
interface from the appropriate leaf type module, then update getWidgetTooltip
and the duplicate useProcessedWidgets and test-fixture declarations to reference
it instead of repeating { name: string; tooltip?: string }. Keep the existing
optional tooltip behavior unchanged.
In `@src/renderer/extensions/vueNodes/composables/usePartitionedBadges.test.ts`:
- Around line 36-45: Update the seedGraph test fixture to construct a real
LGraph instance with new LGraph() and add the node via graph.add(node), then
assign it to the canvas store as before. Remove the fromPartial stub and manual
getNodeById, subgraphs, and rootGraph setup so resolveNode and rootGraph
traversal use the real graph behavior.
In `@src/renderer/extensions/vueNodes/composables/usePartitionedBadges.ts`:
- Around line 24-30: Update usePartitionedBadges to accept
MaybeRefOrGetter<NodeState> and resolve it with the existing toValue import
inside the computed callback. Use the resolved node state for type and other
nodeData accesses so replaced node objects are tracked rather than retaining the
initial identity.
In `@src/renderer/extensions/vueNodes/composables/useProcessedWidgets.ts`:
- Line 375: Update the read path around the `widgetState.value as WidgetValue`
assertion to pass the store value through `normalizeWidgetValue`, matching the
existing update path normalization. Remove the unchecked cast and ensure the
normalized result is what gets handed to widget components, preserving
consistent handling of loosely typed store payloads.
In `@src/stores/linkStore.ts`:
- Around line 194-334: Remove validateEndpointUpdates from the returned store
API while keeping the function private and preserving its use by updateEndpoints
for internal validation.
In `@src/stores/nodeDataStore.ts`:
- Around line 12-51: Optimize getGraphNodesFor by adding a secondary index keyed
by rootGraphId and owning graphId, so each lookup returns the relevant node set
without scanning the entire root bucket. Update registerNode and deleteNode to
maintain both indexes, and clearGraph to remove all associated index entries.
Verify and preserve the existing assumption that NodeState.graphId does not
change after registration; if reparenting is supported, add the necessary
invalidation/update path.
In `@src/stores/widgetValueStore.graphReactivity.test.ts`:
- Around line 104-129: Replace the ineffective not.toBeNull() assertions on
node.inputs?.[0]?.link in both tests with assertions that verify a concrete link
id, or use linkStore.isInputSlotConnected for the connection state. Keep the
existing linkedWidgetedInputs expectation and ensure the tests fail when the
input slot is missing or unlinked.
In `@src/stores/widgetValueStore.ts`:
- Around line 61-69: Make the widget-order and render-state read paths
non-mutating: update getNodeWidgetOrder, getGraphNodeWidgetOrders, and
getGraphWidgetRenderStates to return empty/default results for missing graph or
node entries without inserting reactive state. Preserve creation only in
registerWidget and appendNodeWidgetOrder, while keeping existing query results
for entries that already exist.
---
Outside diff comments:
In `@src/components/builder/AppModeWidgetList.vue`:
- Around line 141-151: Update nodeToNodeData to obtain node state through
nodeDataStore.getGraphNodesFor(...) instead of spreading node._state directly.
Preserve the existing error, drop-indicator, and drag-handler fields while
ensuring WidgetEntry.nodeData uses the store’s public graph-node data contract.
In `@src/lib/litegraph/src/canvas/LinkConnector.core.test.ts`:
- Around line 49-72: The test network fixture exposes graph._links without
registering inserted fixture links in linkStore, causing store-backed lookups to
miss topology. Update the network setup around the network links and
createTestLink flow so fixture links are added through registerLinkTopology, or
use graph._addLink, while preserving the existing LinkNetwork interface and
reroute behavior.
In `@src/lib/litegraph/src/interfaces.ts`:
- Around line 363-391: Update the JSDoc blocks for INodeInputSlot.link and
INodeOutputSlot.links to include a link to the relevant ADR 0008 migration
guidance in the architecture documentation, directing extension authors to the
supported read and mutation APIs. Keep the existing deprecation descriptions and
API references intact.
In `@src/renderer/extensions/vueNodes/components/LGraphNodePreview.vue`:
- Around line 67-95: Remove the deprecated link and links properties from the
slot objects created by previewInputs and previewOutputs. Keep the existing
input/output names, types, optional shape handling, spread fields, and
boundingRect initialization unchanged.
In `@src/utils/widgetUtil.ts`:
- Around line 44-74: Remove the obsolete boolean failure contract from
renameWidget and update its callers, including promptRenameWidget, so they no
longer check for a false return. Preserve the existing rename side effects and
return behavior while eliminating the now-unreachable failure branch.
🪄 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: ASSERTIVE
Plan: Pro Plus
Run ID: 79d73bb0-39fc-49ac-a507-b631f47f40c6
⛔ Files ignored due to path filters (14)
browser_tests/tests/domWidget.spec.ts-snapshots/focus-mode-on-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/execution.spec.ts-snapshots/execution-error-unconnected-slot-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/graphCanvasMenu.spec.ts-snapshots/canvas-with-visible-links-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/mobileBaseline.spec.ts-snapshots/mobile-default-workflow-mobile-chrome-linux.pngis excluded by!**/*.pngbrowser_tests/tests/mobileBaseline.spec.ts-snapshots/mobile-graph-canvas-toolbar-mobile-chrome-linux.pngis excluded by!**/*.pngbrowser_tests/tests/nodeBadge.spec.ts-snapshots/node-badge-left-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/saveImageAndWebp.spec.ts-snapshots/save-image-and-webm-preview-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-nodes-border-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-multiple-selections-border-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/selectionToolbox.spec.ts-snapshots/selection-toolbox-single-node-no-border-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/viewport.spec.ts-snapshots/viewport-fits-when-saved-offscreen-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/vueNodes/interactions/canvas/pan.spec.ts-snapshots/vue-nodes-paned-with-touch-mobile-chrome-linux.pngis excluded by!**/*.pngbrowser_tests/tests/vueNodes/nodeStates/colors.spec.ts-snapshots/vue-node-custom-colors-dark-all-colors-chromium-linux.pngis excluded by!**/*.pngbrowser_tests/tests/vueNodes/nodeStates/colors.spec.ts-snapshots/vue-node-custom-colors-light-all-colors-chromium-linux.pngis excluded by!**/*.png
📒 Files selected for processing (272)
browser_tests/assets/missing/missing_model_nested_promoted_widget.jsonbrowser_tests/assets/missing/missing_models_in_subgraph.jsonbrowser_tests/assets/nodes/duplicate_node_ids.jsonbrowser_tests/fixtures/helpers/NodeOperationsHelper.tsbrowser_tests/tests/appModeBuilder.spec.tsbrowser_tests/tests/nodeBadge.spec.tsbrowser_tests/tests/nodeDisplay.spec.tsbrowser_tests/tests/propertiesPanel/errorsTabCloudMissingModels.spec.tsbrowser_tests/tests/propertiesPanel/errorsTabModeAware.spec.tsbrowser_tests/tests/vueNodes/interactions/links/linkInteraction.spec.tsbrowser_tests/tests/vueNodes/nodeStates/registration.spec.tsbrowser_tests/tests/vueNodes/widgets/legacy.spec.tsbrowser_tests/tests/vueNodes/widgets/widgetReactivity.spec.tsbrowser_tests/tests/workflowPersistence.spec.tsdocs/adr/0008-entity-component-system.mddocs/architecture/domain-glossary.mddocs/architecture/ecs-lifecycle-scenarios.mddocs/architecture/ecs-migration-plan.mddocs/architecture/ecs-target-architecture.mddocs/architecture/entity-interactions.mddocs/architecture/entity-problems.mddocs/architecture/link-topology-store.mddocs/architecture/node-badge-store.mddocs/architecture/node-data-store.mddocs/architecture/output-slot-connectivity.mddocs/architecture/proto-ecs-stores.mddocs/architecture/reroute-chain-store.mdsrc/components/builder/AppModeWidgetList.vuesrc/components/graph/GraphCanvas.vuesrc/components/graph/widgets/domWidgetZIndex.test.tssrc/components/rightSidePanel/errors/useErrorGroups.test.tssrc/components/rightSidePanel/errors/useErrorGroups.tssrc/components/rightSidePanel/parameters/SectionWidgets.vuesrc/components/rightSidePanel/parameters/TabSubgraphInputs.test.tssrc/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/composables/graph/useErrorClearingHooks.test.tssrc/composables/graph/useErrorClearingHooks.tssrc/composables/graph/useGraphNodeManager.test.tssrc/composables/graph/useGraphNodeManager.tssrc/composables/graph/useNodeErrorFlagSync.test.tssrc/composables/graph/useVueNodeLifecycle.test.tssrc/composables/graph/useVueNodeLifecycle.tssrc/composables/node/useNodeBadge.tssrc/composables/node/useNodePricing.test.tssrc/composables/node/useNodePricing.tssrc/composables/node/usePriceBadge.test.tssrc/composables/node/usePriceBadge.tssrc/composables/useUpstreamValue.test.tssrc/composables/useUpstreamValue.tssrc/core/graph/subgraph/migration/proxyWidgetMigration.test.tssrc/core/graph/subgraph/migration/proxyWidgetMigration.tssrc/core/graph/subgraph/promotedInputWidget.tssrc/core/graph/subgraph/promotionUtils.test.tssrc/core/graph/subgraph/promotionUtils.tssrc/core/graph/subgraph/resolveConcretePromotedWidget.test.tssrc/core/graph/subgraph/resolveSubgraphInputLink.tssrc/core/graph/widgets/dynamicWidgets.test.tssrc/core/graph/widgets/dynamicWidgets.tssrc/core/graph/widgets/matchTypeConfiguring.test.tssrc/extensions/core/groupNode.tssrc/extensions/core/load3d.tssrc/extensions/core/rerouteNode.tssrc/extensions/core/saveImageExtraOutput.test.tssrc/extensions/core/widgetInputs.test.tssrc/extensions/core/widgetInputs.tssrc/extensions/core/widgetValuePropagation.test.tssrc/extensions/core/widgetValuePropagation.tssrc/lib/litegraph/src/LGraph.inputSlotRealign.test.tssrc/lib/litegraph/src/LGraph.serialise.test.tssrc/lib/litegraph/src/LGraph.test.tssrc/lib/litegraph/src/LGraph.tssrc/lib/litegraph/src/LGraphBadge.tssrc/lib/litegraph/src/LGraphCanvas.clipboard.test.tssrc/lib/litegraph/src/LGraphCanvas.cloneZIndex.test.tssrc/lib/litegraph/src/LGraphCanvas.drawConnections.test.tssrc/lib/litegraph/src/LGraphCanvas.ghost.test.tssrc/lib/litegraph/src/LGraphCanvas.groupSelection.test.tssrc/lib/litegraph/src/LGraphCanvas.slotHitDetection.test.tssrc/lib/litegraph/src/LGraphCanvas.tssrc/lib/litegraph/src/LGraphNode.nodeState.test.tssrc/lib/litegraph/src/LGraphNode.test.tssrc/lib/litegraph/src/LGraphNode.tssrc/lib/litegraph/src/LGraphNodeProperties.test.tssrc/lib/litegraph/src/LGraphNodeProperties.tssrc/lib/litegraph/src/LLink.store.test.tssrc/lib/litegraph/src/LLink.test.tssrc/lib/litegraph/src/LLink.tssrc/lib/litegraph/src/LiteGraphGlobal.tssrc/lib/litegraph/src/Reroute.store.test.tssrc/lib/litegraph/src/Reroute.tssrc/lib/litegraph/src/__fixtures__/nodeHelpers.tssrc/lib/litegraph/src/canvas/FloatingRenderLink.test.tssrc/lib/litegraph/src/canvas/FloatingRenderLink.tssrc/lib/litegraph/src/canvas/LinkConnector.core.test.tssrc/lib/litegraph/src/canvas/LinkConnector.integration.test.tssrc/lib/litegraph/src/canvas/LinkConnector.test.tssrc/lib/litegraph/src/canvas/LinkConnector.tssrc/lib/litegraph/src/canvas/LinkConnectorSubgraphInputValidation.test.tssrc/lib/litegraph/src/canvas/ToInputFromIoNodeLink.tssrc/lib/litegraph/src/canvas/ToInputRenderLink.tssrc/lib/litegraph/src/infrastructure/LGraphEventMap.tssrc/lib/litegraph/src/interfaces.tssrc/lib/litegraph/src/linkDeduplication.tssrc/lib/litegraph/src/litegraph.tssrc/lib/litegraph/src/node/NodeInputSlot.test.tssrc/lib/litegraph/src/node/NodeInputSlot.tssrc/lib/litegraph/src/node/NodeOutputSlot.test.tssrc/lib/litegraph/src/node/NodeOutputSlot.tssrc/lib/litegraph/src/node/NodeSlot.test.tssrc/lib/litegraph/src/node/NodeSlot.tssrc/lib/litegraph/src/node/SlotBase.tssrc/lib/litegraph/src/node/slotEcosystemPatterns.test.tssrc/lib/litegraph/src/node/slotLinks.test.tssrc/lib/litegraph/src/node/slotLinks.tssrc/lib/litegraph/src/node/slotUtils.test.tssrc/lib/litegraph/src/node/slotUtils.tssrc/lib/litegraph/src/nodeBadgeDraw.test.tssrc/lib/litegraph/src/nodeBadgeDraw.tssrc/lib/litegraph/src/serialization.test.tssrc/lib/litegraph/src/subgraph/ExecutableNodeDTO.test.tssrc/lib/litegraph/src/subgraph/ExecutableNodeDTO.tssrc/lib/litegraph/src/subgraph/SubgraphConversion.test.tssrc/lib/litegraph/src/subgraph/SubgraphIO.test.tssrc/lib/litegraph/src/subgraph/SubgraphInput.tssrc/lib/litegraph/src/subgraph/SubgraphInputNode.tssrc/lib/litegraph/src/subgraph/SubgraphNode.tssrc/lib/litegraph/src/subgraph/SubgraphOutput.tssrc/lib/litegraph/src/subgraph/SubgraphSerialization.test.tssrc/lib/litegraph/src/subgraph/SubgraphSlotConnections.test.tssrc/lib/litegraph/src/subgraph/SubgraphWidgetPromotion.test.tssrc/lib/litegraph/src/subgraph/__fixtures__/README.mdsrc/lib/litegraph/src/subgraph/__fixtures__/subgraphHelpers.test.tssrc/lib/litegraph/src/subgraph/__fixtures__/subgraphHelpers.tssrc/lib/litegraph/src/subgraph/subgraphDeduplication.test.tssrc/lib/litegraph/src/subgraph/subgraphDeduplication.tssrc/lib/litegraph/src/subgraph/subgraphUtils.test.tssrc/lib/litegraph/src/subgraph/subgraphUtils.tssrc/lib/litegraph/src/types/graphTriggers.tssrc/lib/litegraph/src/types/serialisation.tssrc/lib/litegraph/src/types/widgets.tssrc/lib/litegraph/src/utils/collections.test.tssrc/lib/litegraph/src/utils/collections.tssrc/lib/litegraph/src/utils/widget.tssrc/lib/litegraph/src/widgets/BaseWidget.test.tssrc/lib/litegraph/src/widgets/BaseWidget.tssrc/locales/ar/main.jsonsrc/locales/en/main.jsonsrc/locales/es/main.jsonsrc/locales/fa/main.jsonsrc/locales/fr/main.jsonsrc/locales/he/main.jsonsrc/locales/ja/main.jsonsrc/locales/ko/main.jsonsrc/locales/pt-BR/main.jsonsrc/locales/ru/main.jsonsrc/locales/tr/main.jsonsrc/locales/zh-TW/main.jsonsrc/locales/zh/main.jsonsrc/platform/cloud/subscription/composables/useFreeTierQuota.tssrc/platform/missingMedia/missingMediaStore.tssrc/platform/missingModel/missingModelScan.test.tssrc/platform/missingModel/missingModelScan.tssrc/platform/missingModel/missingModelStore.tssrc/platform/nodeReplacement/useNodeReplacement.test.tssrc/platform/nodeReplacement/useNodeReplacement.tssrc/platform/telemetry/nodeAdded/installNodeAddedTelemetry.test.tssrc/platform/telemetry/nodeAdded/installNodeAddedTelemetry.tssrc/platform/workflow/core/services/workflowService.insertWorkflow.test.tssrc/platform/workflow/core/services/workflowService.tssrc/renderer/core/canvas/canvasStore.test.tssrc/renderer/core/canvas/canvasStore.tssrc/renderer/core/canvas/links/linkConnectorAdapter.tssrc/renderer/core/layout/operations/layoutMutations.test.tssrc/renderer/core/layout/operations/layoutMutations.tssrc/renderer/core/layout/store/layoutStore.test.tssrc/renderer/core/layout/store/layoutStore.tssrc/renderer/core/layout/types.tssrc/renderer/extensions/linearMode/PartnerNodesList.vuesrc/renderer/extensions/minimap/composables/useMinimap.test.tssrc/renderer/extensions/minimap/composables/useMinimapGraph.test.tssrc/renderer/extensions/minimap/composables/useMinimapGraph.tssrc/renderer/extensions/minimap/data/AbstractMinimapDataSource.tssrc/renderer/extensions/minimap/data/LayoutStoreDataSource.tssrc/renderer/extensions/minimap/data/MinimapDataSource.test.tssrc/renderer/extensions/minimap/data/MinimapDataSourceFactory.tssrc/renderer/extensions/minimap/minimapCanvasRenderer.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.subgraph.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.test.tssrc/renderer/extensions/vueNodes/components/LGraphNode.vuesrc/renderer/extensions/vueNodes/components/LGraphNodePreview.test.tssrc/renderer/extensions/vueNodes/components/LGraphNodePreview.vuesrc/renderer/extensions/vueNodes/components/NodeContent.vuesrc/renderer/extensions/vueNodes/components/NodeHeader.test.tssrc/renderer/extensions/vueNodes/components/NodeHeader.vuesrc/renderer/extensions/vueNodes/components/NodeSlots.test.tssrc/renderer/extensions/vueNodes/components/NodeSlots.vuesrc/renderer/extensions/vueNodes/components/NodeWidgets.test.tssrc/renderer/extensions/vueNodes/components/NodeWidgets.vuesrc/renderer/extensions/vueNodes/components/WidgetGrid.vuesrc/renderer/extensions/vueNodes/composables/useNodeEventHandlers.test.tssrc/renderer/extensions/vueNodes/composables/useNodeEventHandlers.tssrc/renderer/extensions/vueNodes/composables/useNodePointerInteractions.test.tssrc/renderer/extensions/vueNodes/composables/useNodePointerInteractions.tssrc/renderer/extensions/vueNodes/composables/useNodeTooltips.test.tssrc/renderer/extensions/vueNodes/composables/useNodeTooltips.tssrc/renderer/extensions/vueNodes/composables/usePartitionedBadges.test.tssrc/renderer/extensions/vueNodes/composables/usePartitionedBadges.tssrc/renderer/extensions/vueNodes/composables/useProcessedWidgets.test.tssrc/renderer/extensions/vueNodes/composables/useProcessedWidgets.tssrc/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.autoPan.test.tssrc/renderer/extensions/vueNodes/composables/useSlotLinkInteraction.tssrc/renderer/extensions/vueNodes/layout/ensureCorrectLayoutScale.test.tssrc/renderer/extensions/vueNodes/layout/nodeSizeReflow.test.tssrc/renderer/extensions/vueNodes/types/widgetGrid.tssrc/renderer/extensions/vueNodes/utils/__tests__/nodeDataUtils.test.tssrc/renderer/extensions/vueNodes/utils/nodeDataUtils.tssrc/renderer/extensions/vueNodes/utils/nodeErrorState.tssrc/renderer/extensions/vueNodes/widgets/components/WidgetButton.test.tssrc/renderer/extensions/vueNodes/widgets/components/WidgetButton.vuesrc/renderer/extensions/vueNodes/widgets/components/WidgetDOM.test.tssrc/renderer/extensions/vueNodes/widgets/components/WidgetDOM.vuesrc/renderer/extensions/vueNodes/widgets/components/WidgetLegacy.vuesrc/renderer/extensions/vueNodes/widgets/composables/useImageUploadWidget.test.tssrc/renderer/extensions/vueNodes/widgets/composables/useProgressTextWidget.tssrc/renderer/extensions/vueNodes/widgets/composables/useWidgetRenderer.test.tssrc/renderer/extensions/vueNodes/widgets/registry/widgetRegistry.tssrc/renderer/glsl/glslPreviewUtils.tssrc/renderer/glsl/useGLSLUniforms.test.tssrc/renderer/glsl/useGLSLUniforms.tssrc/scripts/app.test.tssrc/scripts/app.tssrc/scripts/promotedWidgetControl.test.tssrc/scripts/promotedWidgetControl.tssrc/scripts/widgets.tssrc/services/litegraphService.tssrc/stores/appModeStore.test.tssrc/stores/linkStore.test.tssrc/stores/linkStore.tssrc/stores/nodeDataStore.test.tssrc/stores/nodeDataStore.tssrc/stores/rerouteStore.test.tssrc/stores/rerouteStore.tssrc/stores/widgetValueStore.graphReactivity.test.tssrc/stores/widgetValueStore.test.tssrc/stores/widgetValueStore.tssrc/stores/workspace/favoritedWidgetsStore.tssrc/systems/badgeSystem.pricing.test.tssrc/systems/badgeSystem.subgraph.test.tssrc/systems/badgeSystem.test.tssrc/systems/badgeSystem.tssrc/types/badgeData.tssrc/types/linkTopology.tssrc/types/nodeState.tssrc/types/rerouteChain.tssrc/types/simplifiedWidget.tssrc/types/widgetState.tssrc/utils/__tests__/litegraphTestUtils.tssrc/utils/graphTraversalUtil.test.tssrc/utils/graphTraversalUtil.tssrc/utils/linkFixer.test.tssrc/utils/linkFixer.tssrc/utils/litegraphUtil.test.tssrc/utils/litegraphUtil.tssrc/utils/searchAndReplace.test.tssrc/utils/widgetUtil.tstools/devtools/web/legacyWidget.js
💤 Files with no reviewable changes (27)
- src/lib/litegraph/src/LGraphBadge.ts
- src/lib/litegraph/src/LGraphNodeProperties.test.ts
- src/composables/graph/useGraphNodeManager.test.ts
- src/lib/litegraph/src/canvas/ToInputFromIoNodeLink.ts
- src/lib/litegraph/src/LGraphNodeProperties.ts
- src/composables/graph/useGraphNodeManager.ts
- src/locales/fa/main.json
- src/lib/litegraph/src/canvas/ToInputRenderLink.ts
- src/locales/zh/main.json
- src/composables/node/usePriceBadge.test.ts
- src/locales/ar/main.json
- src/locales/pt-BR/main.json
- src/locales/ko/main.json
- src/locales/ru/main.json
- src/composables/node/usePriceBadge.ts
- src/locales/fr/main.json
- src/lib/litegraph/src/node/SlotBase.ts
- src/locales/tr/main.json
- src/locales/he/main.json
- browser_tests/fixtures/helpers/NodeOperationsHelper.ts
- src/scripts/app.ts
- src/locales/ja/main.json
- src/locales/es/main.json
- browser_tests/tests/nodeBadge.spec.ts
- src/lib/litegraph/src/types/graphTriggers.ts
- src/renderer/core/layout/types.ts
- src/locales/zh-TW/main.json
| ### Amendment (2026-07-05, PRs 13436/13449) | ||
|
|
||
| Two stores joined the dedicated-store set: `linkStore` (link topology, | ||
| keyed by target input slot in root-graph-scoped buckets — see | ||
| [Link Topology Store](../architecture/link-topology-store.md)) and | ||
| `rerouteStore` (reroute chain state with link membership derived from | ||
| the links' `parentId` chains — see | ||
| [Reroute Chain Store](../architecture/reroute-chain-store.md)). Both | ||
| follow the proxy-returning registration pattern established by | ||
| `BaseWidget`/`widgetValueStore`: the store bucket is a `reactive(Map)`, | ||
| registration inserts the class's state object by reference and the class | ||
| adopts the reactive proxy read back from the bucket, so class field | ||
| writes are tracked without an action chokepoint. The `layoutStore` link | ||
| connectivity mirror and the `slot._floatingLinks` sets were deleted in | ||
| the same work; the layout store now holds geometry only. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Clarify the mutation model for the new stores.
The ADR says command-driven mutation remains an ECS principle, but this amendment explicitly permits class-field writes through reactive proxies without an action chokepoint. Mark that as a transitional exception and document the eventual command boundary, or align the design with the stated principle.
🤖 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 `@docs/adr/0008-entity-component-system.md` around lines 24 - 38, The
amendment’s proxy-based class-field writes conflict with the ADR’s
command-driven ECS mutation principle. Update the amendment describing linkStore
and rerouteStore to explicitly identify direct reactive-proxy writes as a
transitional exception and document the intended eventual command boundary,
while preserving the existing store registration details.
| > **Amended (2026-07-05):** the input side of `SlotConnection` is | ||
| > subsumed by the `linkStore` key — the input-slot→link mapping _is_ the | ||
| > store's primary index (`isInputSlotConnected` / `getInputSlotLink`). | ||
| > The `slot._floatingLinks` sets were deleted; floating-link attachment | ||
| > is derived from the links' own endpoints (`slotFloatingLinks`). The | ||
| > `input.link` / `output.links` class mirrors remain un-migrated. | ||
|
|
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Align all architecture records with the shipped slot-mirror deletion.
Several records still describe input.link/output.links as active mirrors, while the migration records say both were removed and the stores are authoritative.
docs/adr/0008-entity-component-system.md#L183-L189: update the SlotConnection amendment to the deleted-mirror state.docs/architecture/output-slot-connectivity.md#L108-L118: mark Decision 4 as historical migration guidance.docs/architecture/proto-ecs-stores.md#L388-L391: remove “slot mirrors remain” from the Link gap row.docs/architecture/proto-ecs-stores.md#L408-L410: remove the same stale status from the priority list.
📍 Affects 3 files
docs/adr/0008-entity-component-system.md#L183-L189(this comment)docs/architecture/output-slot-connectivity.md#L108-L118docs/architecture/proto-ecs-stores.md#L388-L391docs/architecture/proto-ecs-stores.md#L408-L410
🤖 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 `@docs/adr/0008-entity-component-system.md` around lines 183 - 189, Update the
architecture records to reflect that input.link and output.links slot mirrors
were deleted and stores are authoritative: in
docs/adr/0008-entity-component-system.md lines 183-189, revise the
SlotConnection amendment; in docs/architecture/output-slot-connectivity.md lines
108-118, label Decision 4 as historical migration guidance; and in
docs/architecture/proto-ecs-stores.md lines 388-391 and 408-410, remove the
stale “slot mirrors remain” status from the Link gap row and priority list.
|
|
||
| Problems: two-phase creation is necessary because nodes need to reference each other's links during configure. Widget value restoration happens deep inside `node.configure()`. Store population is a side effect of configuration. Subgraph creation requires topological sorting to handle nested subgraphs. | ||
|
|
||
| Note on load-time id hygiene: root `configure()` deduplicates **node ids** and **reroute ids** across sibling subgraph definitions before configuring them (`deduplicateSubgraphNodeIds` / `deduplicateSubgraphRerouteIds`), because both share root-graph-scoped store buckets. Link-id dedup is deliberately absent — the linkStore key is the target input slot, not the link id, so duplicate link ids across definitions cannot collide. Orphaned reroutes are pruned by the derived `totalLinks === 0` check; the old `validateLinks` set-repair is gone (membership is derived, so there is no stored set to drift). |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Make the reroute-ID load-time repair contract consistent.
These records disagree about whether link-ID deduplication exists during subgraph deserialization.
docs/architecture/ecs-lifecycle-scenarios.md#L268-L268: retain the explicit no-link-ID-dedup rule if that is the shipped behavior.docs/architecture/reroute-chain-store.md#L64-L67: remove or correct the reference to an existing link-ID deduplication pass.
📍 Affects 2 files
docs/architecture/ecs-lifecycle-scenarios.md#L268-L268(this comment)docs/architecture/reroute-chain-store.md#L64-L67
🤖 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 `@docs/architecture/ecs-lifecycle-scenarios.md` at line 268, The load-time
reroute-ID repair documentation must consistently state that link-ID
deduplication is absent. In docs/architecture/ecs-lifecycle-scenarios.md:268,
retain the explicit no-link-ID-dedup rule; in
docs/architecture/reroute-chain-store.md:64-67, remove or correct the claim that
subgraph deserialization performs link-ID deduplication.
| | Store | Key Format | | ||
| | ------------------------- | ------------------------------------------------------------------------------------ | | ||
| | `widgetValueStore` | `WidgetId` (`graphId:nodeId:name`) | | ||
| | `domWidgetStore` | Widget UUID | | ||
| | `layoutStore` | Raw nodeId/linkId/rerouteId | | ||
| | `nodeOutputStore` | `"${subgraphId}:${nodeId}"` | | ||
| | `subgraphNavigationStore` | subgraphId or `'root'` | | ||
| | `linkStore` | `` `${targetNodeId}:${targetSlot}` `` (target input slot), root-graph-scoped buckets | | ||
| | `rerouteStore` | `RerouteId`, root-graph-scoped buckets | | ||
| | `nodeDataStore` | `NodeState` identity (`Set`), root-graph-scoped buckets | |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
Correct the nodeDataStore key format.
The table lists NodeState identity (Set), but this document describes root-scoped buckets keyed by NodeId. Replace the entry with NodeId to match the shipped store contract.
🤖 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 `@docs/architecture/ecs-migration-plan.md` around lines 766 - 775, Update the
nodeDataStore row in the architecture table to list NodeId as its key format,
replacing the incorrect NodeState identity (Set) description while preserving
the root-graph-scoped buckets wording.
| Phase 1c (dedicated stores) ──┘── widgetValueStore + 7 others shipped | ||
| (PR 12617; linkStore PR 13436; rerouteStore PR 13449) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Fix the dedicated-store count.
The inventory contains nine stores total, so widgetValueStore + 7 others is off by one. It should be widgetValueStore + 8 others, unless nodeDataStore is intentionally excluded and explicitly explained.
🤖 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 `@docs/architecture/ecs-migration-plan.md` around lines 802 - 803, Update the
Phase 1c dedicated-store inventory annotation to reflect all nine stores by
changing the count to “widgetValueStore + 8 others,” or explicitly document the
intentional exclusion of nodeDataStore if retaining the current count.
| const GRAPH_ID = 'graph-test' | ||
|
|
||
| vi.mock('@/renderer/core/canvas/canvasStore', () => ({ | ||
| useCanvasStore: () => ({ | ||
| canvas: { | ||
| graph: { | ||
| rootGraph: { | ||
| id: GRAPH_ID | ||
| } | ||
| } | ||
| } | ||
| rootGraphId: GRAPH_ID | ||
| }) | ||
| })) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -nP '^export ' src/renderer/core/canvas/canvasStore.ts
rg -nP -C3 'type UUID' src/utils/uuid.ts src/types/*.ts
rg -nP -C3 'useCanvasStore' src/renderer/extensions/vueNodes/composables/useProcessedWidgets.tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 1844
🏁 Script executed:
#!/bin/bash
set -euo pipefail
sed -n '1,220p' src/renderer/extensions/vueNodes/components/NodeWidgets.test.ts
printf '\n--- canvasStore ---\n'
sed -n '1,220p' src/renderer/core/canvas/canvasStore.ts
printf '\n--- widgetId ---\n'
sed -n '1,220p' src/types/widgetId.ts
printf '\n--- NodeSlots test ---\n'
sed -n '1,220p' src/renderer/extensions/vueNodes/components/NodeSlots.test.ts
printf '\n--- useProcessedWidgets ---\n'
sed -n '500,620p' src/renderer/extensions/vueNodes/composables/useProcessedWidgets.tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 22824
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n 'canvasStore|useCanvasStore|useTitleEditorStore|currentGraph|rootGraphId|widgetId\(' src/renderer/extensions/vueNodes/components/NodeWidgets.test.ts src/renderer/extensions/vueNodes/components/NodeSlots.test.ts src/renderer/core/canvas/canvasStore.ts src/renderer/extensions/vueNodes/composables/useProcessedWidgets.ts src/types/widgetId.tsRepository: Comfy-Org/ComfyUI_frontend
Length of output: 4250
Seed useCanvasStore().currentGraph instead of mocking canvasStore. The current stub only covers rootGraphId; using the real store keeps the module shape intact and avoids brittle partial mocks.
🤖 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/renderer/extensions/vueNodes/components/NodeWidgets.test.ts` around lines
18 - 24, Update the test setup around useCanvasStore so it seeds the real
store’s currentGraph with the graph-test fixture instead of mocking the
canvasStore module. Remove the partial vi.mock for canvasStore, preserve the
GRAPH_ID fixture, and initialize currentGraph through the store before the tests
run.
Source: Path instructions
| const getWidgetTooltip = (widget: { name: string; tooltip?: string }) => { | ||
| if (!tooltipsEnabled.value || !nodeDef.value) return '' | ||
|
|
||
| // First try widget-specific tooltip | ||
| const widgetTooltip = (widget as { tooltip?: string }).tooltip | ||
| const widgetTooltip = widget.tooltip |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
Share one type for the tooltip source shape.
{ name: string; tooltip?: string } is now declared inline here, again as WidgetTooltipSource in useProcessedWidgets.ts (lines 69-72), and again in the test fixture. Exporting the interface from a leaf type module and referencing it here keeps the three in sync.
♻️ Sketch
- const getWidgetTooltip = (widget: { name: string; tooltip?: string }) => {
+ const getWidgetTooltip = (widget: WidgetTooltipSource) => {🤖 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/renderer/extensions/vueNodes/composables/useNodeTooltips.ts` around lines
138 - 142, Define or reuse a shared exported tooltip-source interface from the
appropriate leaf type module, then update getWidgetTooltip and the duplicate
useProcessedWidgets and test-fixture declarations to reference it instead of
repeating { name: string; tooltip?: string }. Keep the existing optional tooltip
behavior unchanged.
| function seedGraph(node: LGraphNode): void { | ||
| const graph = fromPartial<LGraph>({ | ||
| id: 'graph-test', | ||
| getNodeById: (id: NodeId) => (id === NODE_ID ? node : null), | ||
| subgraphs: new Map() | ||
| }) | ||
| Reflect.set(graph, 'rootGraph', graph) | ||
| node.graph = graph | ||
| useCanvasStore().currentGraph = graph | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Prefer a real LGraph over a fromPartial graph stub.
resolveNode and rootGraph traversal are the parts this composable now depends on; stubbing getNodeById/subgraphs/rootGraph means those paths aren't exercised and the fixture will drift if resolution changes. A real new LGraph() plus graph.add(node) (as done in NodeSlots.test.ts) gives the same setup without the mock.
🤖 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/renderer/extensions/vueNodes/composables/usePartitionedBadges.test.ts`
around lines 36 - 45, Update the seedGraph test fixture to construct a real
LGraph instance with new LGraph() and add the node via graph.add(node), then
assign it to the canvas store as before. Remove the fromPartial stub and manual
getNodeById, subgraphs, and rootGraph setup so resolveNode and rootGraph
traversal use the real graph behavior.
Source: Path instructions
| export function usePartitionedBadges(nodeData: NodeState) { | ||
| const settingStore = useSettingStore() | ||
| const canvasStore = useCanvasStore() | ||
| const nodeDefStore = useNodeDefStore() | ||
|
|
||
| // Cache pricing metadata (won't change during node lifetime) | ||
| const isDynamicPricing = computed(() => | ||
| nodeData?.apiNode ? hasDynamicPricing(nodeData.type) : false | ||
| ) | ||
| const relevantPricingWidgets = computed(() => | ||
| nodeData?.apiNode ? getRelevantWidgetNames(nodeData.type) : [] | ||
| ) | ||
| const inputGroupPrefixes = computed(() => | ||
| nodeData?.apiNode ? getInputGroupPrefixes(nodeData.type) : [] | ||
| ) | ||
| const relevantInputNames = computed(() => | ||
| nodeData?.apiNode ? getInputNames(nodeData.type) : [] | ||
| ) | ||
| const unpartitionedBadges = computed<NodeBadgeProps[]>(() => { | ||
| if (nodeData?.id != null) { | ||
| const wrapper = app.canvas?.graph?.getNodeById(nodeData.id) | ||
| if (wrapper?.isSubgraphNode()) trackSubgraphInnerNodePrices(wrapper) | ||
| } | ||
| // For ALL API nodes: access per-node revision ref to detect when async pricing evaluation completes | ||
| // This is needed even for static pricing because JSONata 2.x evaluation is async | ||
| if (nodeData?.apiNode && nodeData?.id != null) { | ||
| // Access per-node revision ref to establish dependency (each node has its own ref) | ||
| void getNodeRevisionRef(nodeData.id).value | ||
|
|
||
| // For dynamic pricing, also track widget values and input connections | ||
| if (isDynamicPricing.value) { | ||
| // Access only the widget values that affect pricing (from widgetValueStore) | ||
| const relevantNames = relevantPricingWidgets.value | ||
| const widgetStore = useWidgetValueStore() | ||
| const graphId = app.canvas?.graph?.rootGraph.id | ||
| if (relevantNames.length > 0 && nodeData?.id != null) { | ||
| for (const name of relevantNames) { | ||
| // Access value from store to create reactive dependency | ||
| if (!graphId) continue | ||
| void widgetStore.getWidget(widgetId(graphId, nodeData.id, name)) | ||
| ?.value | ||
| } | ||
| } | ||
| // Access input connections for regular inputs | ||
| const inputNames = relevantInputNames.value | ||
| if (inputNames.length > 0) { | ||
| nodeData?.inputs?.forEach((inp) => { | ||
| if (inp.name && inputNames.includes(inp.name)) { | ||
| void inp.link // Access link to create reactive dependency | ||
| } | ||
| }) | ||
| } | ||
| // Access input connections for input_groups (e.g., autogrow inputs) | ||
| const groupPrefixes = inputGroupPrefixes.value | ||
| if (groupPrefixes.length > 0) { | ||
| nodeData?.inputs?.forEach((inp) => { | ||
| if ( | ||
| groupPrefixes.some((prefix) => inp.name?.startsWith(prefix + '.')) | ||
| ) { | ||
| void inp.link // Access link to create reactive dependency | ||
| } | ||
| }) | ||
| } | ||
| } | ||
| } | ||
| return [...(nodeData?.badges ?? [])].map(toValue) | ||
| }) | ||
| const nodeDef = useNodeDefStore().nodeDefsByName[nodeData.type] | ||
| return computed(() => { | ||
| const displaySource = settingStore.get( | ||
| 'Comfy.NodeBadge.NodeSourceBadgeMode' | ||
| ) | ||
| const isCoreNode = | ||
| nodeDef?.isCoreNode && displaySource === NodeBadgeMode.ShowAll | ||
| const nodeDef = nodeDefStore.nodeDefsByName[nodeData.type] |
There was a problem hiding this comment.
🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
Accept MaybeRefOrGetter<NodeState> so a replaced node object is tracked.
The parameter captures one NodeState object identity for the lifetime of the computed; callers pass a destructured prop (LGraphNode.vue line 402), so if the prop is re-assigned a different state object the badges stay bound to the old one. toValue is already imported here.
♻️ Suggested change
-export function usePartitionedBadges(nodeData: NodeState) {
+export function usePartitionedBadges(state: MaybeRefOrGetter<NodeState>) {
const settingStore = useSettingStore()
const canvasStore = useCanvasStore()
const nodeDefStore = useNodeDefStore()
return computed(() => {
+ const nodeData = toValue(state)
const nodeDef = nodeDefStore.nodeDefsByName[nodeData.type]📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export function usePartitionedBadges(nodeData: NodeState) { | |
| const settingStore = useSettingStore() | |
| const canvasStore = useCanvasStore() | |
| const nodeDefStore = useNodeDefStore() | |
| // Cache pricing metadata (won't change during node lifetime) | |
| const isDynamicPricing = computed(() => | |
| nodeData?.apiNode ? hasDynamicPricing(nodeData.type) : false | |
| ) | |
| const relevantPricingWidgets = computed(() => | |
| nodeData?.apiNode ? getRelevantWidgetNames(nodeData.type) : [] | |
| ) | |
| const inputGroupPrefixes = computed(() => | |
| nodeData?.apiNode ? getInputGroupPrefixes(nodeData.type) : [] | |
| ) | |
| const relevantInputNames = computed(() => | |
| nodeData?.apiNode ? getInputNames(nodeData.type) : [] | |
| ) | |
| const unpartitionedBadges = computed<NodeBadgeProps[]>(() => { | |
| if (nodeData?.id != null) { | |
| const wrapper = app.canvas?.graph?.getNodeById(nodeData.id) | |
| if (wrapper?.isSubgraphNode()) trackSubgraphInnerNodePrices(wrapper) | |
| } | |
| // For ALL API nodes: access per-node revision ref to detect when async pricing evaluation completes | |
| // This is needed even for static pricing because JSONata 2.x evaluation is async | |
| if (nodeData?.apiNode && nodeData?.id != null) { | |
| // Access per-node revision ref to establish dependency (each node has its own ref) | |
| void getNodeRevisionRef(nodeData.id).value | |
| // For dynamic pricing, also track widget values and input connections | |
| if (isDynamicPricing.value) { | |
| // Access only the widget values that affect pricing (from widgetValueStore) | |
| const relevantNames = relevantPricingWidgets.value | |
| const widgetStore = useWidgetValueStore() | |
| const graphId = app.canvas?.graph?.rootGraph.id | |
| if (relevantNames.length > 0 && nodeData?.id != null) { | |
| for (const name of relevantNames) { | |
| // Access value from store to create reactive dependency | |
| if (!graphId) continue | |
| void widgetStore.getWidget(widgetId(graphId, nodeData.id, name)) | |
| ?.value | |
| } | |
| } | |
| // Access input connections for regular inputs | |
| const inputNames = relevantInputNames.value | |
| if (inputNames.length > 0) { | |
| nodeData?.inputs?.forEach((inp) => { | |
| if (inp.name && inputNames.includes(inp.name)) { | |
| void inp.link // Access link to create reactive dependency | |
| } | |
| }) | |
| } | |
| // Access input connections for input_groups (e.g., autogrow inputs) | |
| const groupPrefixes = inputGroupPrefixes.value | |
| if (groupPrefixes.length > 0) { | |
| nodeData?.inputs?.forEach((inp) => { | |
| if ( | |
| groupPrefixes.some((prefix) => inp.name?.startsWith(prefix + '.')) | |
| ) { | |
| void inp.link // Access link to create reactive dependency | |
| } | |
| }) | |
| } | |
| } | |
| } | |
| return [...(nodeData?.badges ?? [])].map(toValue) | |
| }) | |
| const nodeDef = useNodeDefStore().nodeDefsByName[nodeData.type] | |
| return computed(() => { | |
| const displaySource = settingStore.get( | |
| 'Comfy.NodeBadge.NodeSourceBadgeMode' | |
| ) | |
| const isCoreNode = | |
| nodeDef?.isCoreNode && displaySource === NodeBadgeMode.ShowAll | |
| const nodeDef = nodeDefStore.nodeDefsByName[nodeData.type] | |
| export function usePartitionedBadges(state: MaybeRefOrGetter<NodeState>) { | |
| const settingStore = useSettingStore() | |
| const canvasStore = useCanvasStore() | |
| const nodeDefStore = useNodeDefStore() | |
| return computed(() => { | |
| const nodeData = toValue(state) | |
| const nodeDef = nodeDefStore.nodeDefsByName[nodeData.type] |
🤖 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/renderer/extensions/vueNodes/composables/usePartitionedBadges.ts` around
lines 24 - 30, Update usePartitionedBadges to accept MaybeRefOrGetter<NodeState>
and resolve it with the existing toValue import inside the computed callback.
Use the resolved node state for type and other nodeData accesses so replaced
node objects are tracked rather than retaining the initial identity.
| const visible = isWidgetVisible(options, ctx.showAdvanced, slotInfo?.linked) | ||
| const isDisabled = slotInfo?.linked || widgetState.disabled | ||
| const widgetOptions = isDisabled ? { ...options, disabled: true } : options | ||
| const value = widgetState.value as WidgetValue |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win
Reuse normalizeWidgetValue instead of asserting the store value.
The update path normalizes through normalizeWidgetValue (line 225), but the read path asserts widgetState.value as WidgetValue. Any non-WidgetValue payload that reaches the store (widget state values are loosely typed) is then handed to widget components unchecked, and the two paths can disagree.
♻️ Proposed change
- const value = widgetState.value as WidgetValue
+ const value = normalizeWidgetValue(widgetState.value)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const value = widgetState.value as WidgetValue | |
| const value = normalizeWidgetValue(widgetState.value) |
🤖 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/renderer/extensions/vueNodes/composables/useProcessedWidgets.ts` at line
375, Update the read path around the `widgetState.value as WidgetValue`
assertion to pass the store value through `normalizeWidgetValue`, matching the
existing update path normalization. Remove the unchecked cast and ensure the
normalized result is what gets handed to widget components, preserving
consistent handling of loosely typed store payloads.
| const interiorTopology = linkStore.getInputSlotLink( | ||
| rootGraph.id, | ||
| target.id, | ||
| 0 | ||
| ) | ||
| expect(interiorTopology?.originNodeId).toBe(origin.id) | ||
| expect(subgraph.getLink(interiorTopology?.id)).toBeDefined() |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Assert the topology before dereferencing its id.
subgraph.getLink(interiorTopology?.id) passes undefined through when the lookup misses, so the failure surfaces as a confusing toBeDefined() mismatch (and relies on getLink tolerating undefined).
♻️ Proposed tweak
const interiorTopology = linkStore.getInputSlotLink(
rootGraph.id,
target.id,
0
)
+ assert(interiorTopology)
expect(interiorTopology?.originNodeId).toBe(origin.id)
- expect(subgraph.getLink(interiorTopology?.id)).toBeDefined()
+ expect(subgraph.getLink(interiorTopology.id)).toBeDefined()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const interiorTopology = linkStore.getInputSlotLink( | |
| rootGraph.id, | |
| target.id, | |
| 0 | |
| ) | |
| expect(interiorTopology?.originNodeId).toBe(origin.id) | |
| expect(subgraph.getLink(interiorTopology?.id)).toBeDefined() | |
| const interiorTopology = linkStore.getInputSlotLink( | |
| rootGraph.id, | |
| target.id, | |
| 0 | |
| ) | |
| assert(interiorTopology) | |
| expect(interiorTopology?.originNodeId).toBe(origin.id) | |
| expect(subgraph.getLink(interiorTopology.id)).toBeDefined() |
🤖 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/lib/litegraph/src/subgraph/SubgraphConversion.test.ts` around lines 57 -
63, Update the test around interiorTopology to assert that the lookup result is
defined before accessing its properties. After the assertion, call
subgraph.getLink with interiorTopology.id rather than the optional id,
preserving the existing originNodeId and link-presence checks.
| return { | ||
| code: 'occupied-target', | ||
| message: `Link target slot ${key} is already occupied` | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** Atomically validates and applies endpoint updates and removals. */ | ||
| function updateEndpoints( | ||
| graphId: UUID, | ||
| updates: readonly EndpointUpdate[], | ||
| removals: readonly LinkTopology[] = [] | ||
| ): EndpointUpdateResult<LinkTopology[]> { | ||
| const error = validateEndpointUpdates(graphId, updates, removals) | ||
| if (error) return { ok: false, error } | ||
|
|
||
| for (const { topology } of updates) displace(graphId, topology) | ||
| for (const topology of removals) displace(graphId, topology) | ||
|
|
||
| const value = updates.map(({ topology, patch }) => { | ||
| Object.assign(reactive(topology), patchedEndpoints(topology, patch)) | ||
| return placeValidated(graphId, topology) | ||
| }) | ||
| return { ok: true, value } | ||
| } | ||
|
|
||
| /** Applies one endpoint patch atomically. */ | ||
| function updateEndpoint( | ||
| graphId: UUID, | ||
| topology: LinkTopology, | ||
| patch: EndpointPatch | ||
| ): EndpointUpdateResult<LinkTopology> { | ||
| const result = updateEndpoints(graphId, [{ topology, patch }]) | ||
| return result.ok ? { ok: true, value: result.value[0] } : result | ||
| } | ||
|
|
||
| function isInputSlotConnected( | ||
| graphId: UUID, | ||
| nodeId: NodeId, | ||
| slot: number | ||
| ): boolean { | ||
| return targetIndex.value.get(graphId)?.has(targetKey(nodeId, slot)) ?? false | ||
| } | ||
|
|
||
| function getInputSlotLink( | ||
| graphId: UUID, | ||
| nodeId: NodeId, | ||
| slot: number | ||
| ): LinkTopology | undefined { | ||
| return targetIndex.value.get(graphId)?.get(targetKey(nodeId, slot)) | ||
| } | ||
|
|
||
| function isOutputSlotConnected( | ||
| graphId: UUID, | ||
| nodeId: NodeId, | ||
| slot: number | ||
| ): boolean { | ||
| return originIndex.value.get(graphId)?.has(originKey(nodeId, slot)) ?? false | ||
| } | ||
|
|
||
| function getOutputSlotLinks( | ||
| graphId: UUID, | ||
| nodeId: NodeId, | ||
| slot: number | ||
| ): ReadonlySet<LinkTopology> { | ||
| return ( | ||
| originIndex.value.get(graphId)?.get(originKey(nodeId, slot)) ?? | ||
| EMPTY_LINKS | ||
| ) | ||
| } | ||
|
|
||
| /** Iterates every registered topology in a graph's bucket. */ | ||
| function* graphTopologies(graphId: UUID): Generator<LinkTopology> { | ||
| const targets = targetIndex.value.get(graphId) | ||
| if (targets) yield* targets.values() | ||
| const unkeyed = unkeyedLinks.value.get(graphId) | ||
| if (unkeyed) yield* unkeyed.values() | ||
| } | ||
|
|
||
| function clearGraph(graphId: UUID): void { | ||
| targetIndex.value.delete(graphId) | ||
| unkeyedLinks.value.delete(graphId) | ||
| originIndex.value.delete(graphId) | ||
| } | ||
|
|
||
| return { | ||
| registerLink, | ||
| updateEndpoint, | ||
| updateEndpoints, | ||
| validateEndpointUpdates, | ||
| deleteLink: displace, | ||
| isInputSlotConnected, | ||
| getInputSlotLink, | ||
| isOutputSlotConnected, | ||
| getOutputSlotLinks, | ||
| graphTopologies, | ||
| clearGraph | ||
| } | ||
| }) |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
rg -n --type=ts -C2 '\bvalidateEndpointUpdates\s*\(' -g '!src/stores/linkStore.ts' -g '!src/stores/linkStore.test.ts'Repository: Comfy-Org/ComfyUI_frontend
Length of output: 164
Keep validateEndpointUpdates private unless a downstream caller needs the dry-run check. Nothing outside src/stores/linkStore.ts references it, so returning it from the store only widens the public API.
🤖 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/stores/linkStore.ts` around lines 194 - 334, Remove
validateEndpointUpdates from the returned store API while keeping the function
private and preserving its use by updateEndpoints for internal validation.
Source: Learnings
| export const useNodeDataStore = defineStore('nodeData', () => { | ||
| const graphNodeStates = ref(new Map<UUID, Set<NodeState>>()) | ||
|
|
||
| function getGraphNodes(rootGraphId: UUID): Set<NodeState> { | ||
| const existing = graphNodeStates.value.get(rootGraphId) | ||
| if (existing) return existing | ||
|
|
||
| const created = reactive(new Set<NodeState>()) | ||
| graphNodeStates.value.set(rootGraphId, created) | ||
| return created | ||
| } | ||
|
|
||
| function registerNode(rootGraphId: UUID, state: NodeState): void { | ||
| getGraphNodes(rootGraphId).add(state) | ||
| } | ||
|
|
||
| function getGraphNodesFor( | ||
| rootGraphId: UUID, | ||
| owningGraphId: UUID | ||
| ): NodeState[] { | ||
| const bucket = graphNodeStates.value.get(rootGraphId) | ||
| if (!bucket) return [] | ||
| return [...bucket].filter((state) => state.graphId === owningGraphId) | ||
| } | ||
|
|
||
| function deleteNode(rootGraphId: UUID, state: NodeState): boolean { | ||
| return graphNodeStates.value.get(rootGraphId)?.delete(state) ?? false | ||
| } | ||
|
|
||
| function clearGraph(rootGraphId: UUID): void { | ||
| graphNodeStates.value.delete(rootGraphId) | ||
| } | ||
|
|
||
| return { | ||
| clearGraph, | ||
| deleteNode, | ||
| getGraphNodesFor, | ||
| registerNode | ||
| } | ||
| }) |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win
getGraphNodesFor linearly scans every node in the root graph on each call.
For large graphs with many subgraphs, each subgraph's node list is recomputed by filtering the entire root-graph node set, giving O(N×S) work if called per-subgraph on a render/reactive path.
♻️ Suggested secondary index (verify reparenting semantics first)
export const useNodeDataStore = defineStore('nodeData', () => {
const graphNodeStates = ref(new Map<UUID, Set<NodeState>>())
+ // Secondary index: rootGraphId -> owningGraphId -> Set<NodeState>
+ const byOwningGraph = ref(new Map<UUID, Map<UUID, Set<NodeState>>>())
function registerNode(rootGraphId: UUID, state: NodeState): void {
getGraphNodes(rootGraphId).add(state)
+ // maintain byOwningGraph[rootGraphId][state.graphId] as well
}
function getGraphNodesFor(
rootGraphId: UUID,
owningGraphId: UUID
): NodeState[] {
- const bucket = graphNodeStates.value.get(rootGraphId)
- if (!bucket) return []
- return [...bucket].filter((state) => state.graphId === owningGraphId)
+ const bucket = byOwningGraph.value.get(rootGraphId)?.get(owningGraphId)
+ return bucket ? [...bucket] : []
}This requires confirming that a node's graphId field is never mutated after registration (reparenting into a different subgraph) — otherwise the secondary index would need an explicit invalidation hook.
🤖 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/stores/nodeDataStore.ts` around lines 12 - 51, Optimize getGraphNodesFor
by adding a secondary index keyed by rootGraphId and owning graphId, so each
lookup returns the relevant node set without scanning the entire root bucket.
Update registerNode and deleteNode to maintain both indexes, and clearGraph to
remove all associated index entries. Verify and preserve the existing assumption
that NodeState.graphId does not change after registration; if reparenting is
supported, add the necessary invalidation/update path.
| it('exposes linked widget input slots through the live node inputs', () => { | ||
| const { node } = createWidgetInputGraph() | ||
|
|
||
| expect(node.inputs?.[0]?.widget?.name).toBe('prompt') | ||
| expect(node.inputs?.[0]?.link).not.toBeNull() | ||
| }) | ||
|
|
||
| it('marks a widget input slot as linked when connected to a SubgraphInput', () => { | ||
| const subgraph = createTestSubgraph({ | ||
| inputs: [{ name: 'prompt', type: 'STRING' }] | ||
| }) | ||
| const node = new LGraphNode('test') | ||
| node.addWidget('string', 'prompt', 'hello', () => undefined, {}) | ||
| const input = node.addInput('prompt', 'STRING') | ||
| input.widget = { name: 'prompt' } | ||
| subgraph.add(node) | ||
|
|
||
| expect(subgraph.inputNode.slots[0].connect(input, node)).not.toBeNull() | ||
|
|
||
| expect(node.inputs?.[0]?.link).not.toBeNull() | ||
| expect( | ||
| linkedWidgetedInputs(node.id, node.inputs, subgraph.rootGraph.id).map( | ||
| (s) => s.name | ||
| ) | ||
| ).toEqual(['prompt']) | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
expect(...link).not.toBeNull() can never fail here.
node.inputs?.[0]?.link is read through optional chaining, so a missing slot or an unlinked slot yields undefined, which satisfies not.toBeNull(). These assertions pass even if the connection was never made. Assert the concrete link id (or isInputSlotConnected via linkStore) instead.
💚 Proposed tightening
- expect(node.inputs?.[0]?.widget?.name).toBe('prompt')
- expect(node.inputs?.[0]?.link).not.toBeNull()
+ expect(node.inputs[0].widget?.name).toBe('prompt')
+ expect(node.inputs[0].link).toEqual(expect.any(Number))As per path instructions, .agents/checks/test-quality.md requires avoiding fragile assertions that don't exercise behavior.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| it('exposes linked widget input slots through the live node inputs', () => { | |
| const { node } = createWidgetInputGraph() | |
| expect(node.inputs?.[0]?.widget?.name).toBe('prompt') | |
| expect(node.inputs?.[0]?.link).not.toBeNull() | |
| }) | |
| it('marks a widget input slot as linked when connected to a SubgraphInput', () => { | |
| const subgraph = createTestSubgraph({ | |
| inputs: [{ name: 'prompt', type: 'STRING' }] | |
| }) | |
| const node = new LGraphNode('test') | |
| node.addWidget('string', 'prompt', 'hello', () => undefined, {}) | |
| const input = node.addInput('prompt', 'STRING') | |
| input.widget = { name: 'prompt' } | |
| subgraph.add(node) | |
| expect(subgraph.inputNode.slots[0].connect(input, node)).not.toBeNull() | |
| expect(node.inputs?.[0]?.link).not.toBeNull() | |
| expect( | |
| linkedWidgetedInputs(node.id, node.inputs, subgraph.rootGraph.id).map( | |
| (s) => s.name | |
| ) | |
| ).toEqual(['prompt']) | |
| }) | |
| it('exposes linked widget input slots through the live node inputs', () => { | |
| const { node } = createWidgetInputGraph() | |
| expect(node.inputs[0].widget?.name).toBe('prompt') | |
| expect(node.inputs[0].link).toEqual(expect.any(Number)) | |
| }) | |
| it('marks a widget input slot as linked when connected to a SubgraphInput', () => { | |
| const subgraph = createTestSubgraph({ | |
| inputs: [{ name: 'prompt', type: 'STRING' }] | |
| }) | |
| const node = new LGraphNode('test') | |
| node.addWidget('string', 'prompt', 'hello', () => undefined, {}) | |
| const input = node.addInput('prompt', 'STRING') | |
| input.widget = { name: 'prompt' } | |
| subgraph.add(node) | |
| expect(subgraph.inputNode.slots[0].connect(input, node)).not.toBeNull() | |
| expect(node.inputs?.[0]?.link).not.toBeNull() | |
| expect( | |
| linkedWidgetedInputs(node.id, node.inputs, subgraph.rootGraph.id).map( | |
| (s) => s.name | |
| ) | |
| ).toEqual(['prompt']) | |
| }) |
🤖 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/stores/widgetValueStore.graphReactivity.test.ts` around lines 104 - 129,
Replace the ineffective not.toBeNull() assertions on node.inputs?.[0]?.link in
both tests with assertions that verify a concrete link id, or use
linkStore.isInputSlotConnected for the connection state. Keep the existing
linkedWidgetedInputs expectation and ensure the tests fail when the input slot
is missing or unlinked.
Source: Path instructions
| function getNodeWidgetOrder(graphId: UUID, nodeId: NodeId): WidgetId[] { | ||
| const graphOrders = getGraphNodeWidgetOrders(graphId) | ||
| const order = graphOrders.get(nodeId) | ||
| if (order) return order | ||
|
|
||
| const nextOrder = reactive<WidgetId[]>([]) | ||
| graphOrders.set(nodeId, nextOrder) | ||
| return nextOrder | ||
| } |
There was a problem hiding this comment.
🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win
Read paths allocate reactive state; make lookups non-mutating.
getNodeWidgetOrder inserts a new reactive array for any (graphId, nodeId) it is asked about, and getGraphNodeWidgetOrders / getGraphWidgetRenderStates do the same at graph level. These are reached from pure query APIs (getNodeWidgetIds at Line 194, getNodeWidgets at Line 169, getWidgetRenderState at Line 146), which are in turn called from computed getters (e.g. useUpstreamValue in src/composables/useUpstreamValue.ts:14-29, and touchPricingSources in src/systems/badgeSystem.ts:120-139). Two consequences:
- Every lookup for an unknown node/graph permanently allocates an entry that is only reclaimed by
clearGraph, so probing deleted or transient nodes grows the maps without bound. - The store's
refmaps are mutated during computed evaluation, which is a side effect inside derivation.
Keep creation on the write paths (registerWidget / appendNodeWidgetOrder) and let queries return empty results without inserting.
♻️ Proposed split of read vs. write accessors
+ function peekNodeWidgetOrder(
+ graphId: UUID,
+ nodeId: NodeId
+ ): readonly WidgetId[] {
+ return graphNodeWidgetOrders.value.get(graphId)?.get(nodeId) ?? []
+ }
+
function getNodeWidgetOrder(graphId: UUID, nodeId: NodeId): WidgetId[] {
const graphOrders = getGraphNodeWidgetOrders(graphId) function getNodeWidgetIds(graphId: UUID, localNodeId: NodeId): WidgetId[] {
- return [...getNodeWidgetOrder(graphId, localNodeId)]
+ return [...peekNodeWidgetOrder(graphId, localNodeId)]
}🤖 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/stores/widgetValueStore.ts` around lines 61 - 69, Make the widget-order
and render-state read paths non-mutating: update getNodeWidgetOrder,
getGraphNodeWidgetOrders, and getGraphWidgetRenderStates to return empty/default
results for missing graph or node entries without inserting reactive state.
Preserve creation only in registerWidget and appendNodeWidgetOrder, while
keeping existing query results for entries that already exist.
|
Updating Playwright Expectations |
Summary
CI probe for
feature/ecs-migrationrebased onto currentmain. Not for merge — this exists to get Playwright results on the reconciled tree beforefeature/ecs-migrationis force-pushed.Changes
main, which had moved 232 commits ahead of the fork point. The collapse was verified lossless — the collapsed tree is identical tofeature/ecs-migration's — so this branch differs from the old branch only by main's changes and the conflict resolutions below.input.link,output.links,VueNodeData/useGraphNodeManager, the badge store) stays deleted.Review Focus
28 conflicts, resolved once. 20 source, 8 binary screenshots.
The two that mattered were modify/delete, where git's default is wrong — it leaves main's version in the tree and silently resurrects a file the migration exists to remove:
usePriceBadge.ts— deleted by refactor: derive badge rows on read, delete the badge store #13686, modified by main's Add indicator for free tier quota system #13657 (free-tier quota). Deletion kept; main'suseCreditsBadgesInGraphre-expressed againstgraphCreditsBadgesfrombadgeSystem.ts, anduseFreeTierQuotare-pointed at it.useGraphNodeManager.test.ts— deleted by refactor!: make nodeDataStore the source of truth for node shell state #13963, modified by main's refactor: encapsulate execution error store writes behind record actions #13636. Deletion kept; the module is gone, and refactor: encapsulate execution error store writes behind record actions #13636's coverage lives in the error-store tests.Verified: of the 207 files only this branch touches, 205 are byte-identical to the pre-rebase branch. The two that moved are a forced API change — main's #13636 made
lastNodeErrorsa read-only computed, sostore.lastNodeErrors = {…}becamestore.recordNodeErrors({…}). The remaining 75 files overlap with main's changes and are genuine review surface.typecheck,typecheck:browser,lint,knipclean. Unit: 239 files / 3495 passing;ColorWidget.test.tsfails only under parallel load and passes 12/12 in isolation across three runs.Worth a second opinion:
useMinimapGraph.ts—onTriggerwrapping dropped, on the grounds that main deleted it from this file outright and the ECS side only kept it to host property-change detection, which is now anode:property:changedlistener.useMinimapGraph.test.ts— two of main's regression tests retargeted fromonNodeAddedtoonConnectionChange, the one callback still wrapped. Our resolution had made them vacuous.linkInteraction.spec.ts— assertion moved off the deprecatedoutputs[0].linksmirror togetOutputNodes(0). Equivalent, but not verifiable without a browser run — which is what this PR is for.LGraphCanvas.clipboard.test.ts— kept the ECS side'senableSubgraphNodeCreationover main'sregisterTestSubgraphNodeTypesfor intra-file consistency; if the latter fixed a specific cleanup bug, that intent is reverted.Supersedes #14108, whose two integration fixes were independently rediscovered here.