Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 13 additions & 20 deletions .fallow-baselines/dead-code.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,6 @@
"src/composables/sidebarTabs/useJobHistorySidebarTab.ts->src/stores/workspace/sidebarTabStore.ts",
"src/composables/usePaste.ts->src/scripts/app.ts",
"src/extensions/core/load3d/Load3dUtils.ts->src/scripts/app.ts",
"src/lib/litegraph/src/ContextMenu.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/ContextMenu.ts->src/lib/litegraph/src/LiteGraphGlobal.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/DragAndScale.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/DragAndScale.ts->src/lib/litegraph/src/LGraphCanvas.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/DragAndScale.ts->src/lib/litegraph/src/LiteGraphGlobal.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/LGraph.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/LGraphCanvas.ts->src/lib/litegraph/src/LGraphGroup.ts",
"src/lib/litegraph/src/LGraphCanvas.ts->src/lib/litegraph/src/LGraphNode.ts",
"src/lib/litegraph/src/LGraphCanvas.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/LGraphGroup.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/LGraphNode.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/LGraphNode.ts->src/lib/litegraph/src/utils/collections.ts",
"src/lib/litegraph/src/Reroute.ts->src/lib/litegraph/src/litegraph.ts",
"src/lib/litegraph/src/litegraph.ts->src/lib/litegraph/src/node/NodeInputSlot.ts",
"src/lib/litegraph/src/litegraph.ts->src/lib/litegraph/src/node/NodeOutputSlot.ts",
"src/lib/litegraph/src/litegraph.ts->src/lib/litegraph/src/subgraph/ExecutableNodeDTO.ts",
"src/lib/litegraph/src/litegraph.ts->src/lib/litegraph/src/subgraph/SubgraphNode.ts",
"src/lib/litegraph/src/litegraph.ts->src/lib/litegraph/src/subgraph/subgraphUtils.ts",
"src/lib/litegraph/src/litegraph.ts->src/lib/litegraph/src/widgets/LegacyWidget.ts",
"src/lib/litegraph/src/node/NodeInputSlot.ts->src/lib/litegraph/src/node/NodeSlot.ts",
"src/platform/cloud/subscription/composables/useSubscriptionDialog.ts->src/services/dialogService.ts",
"src/platform/missingMedia/missingMediaStore.ts->src/scripts/app.ts",
"src/platform/missingModel/missingModelStore.ts->src/scripts/app.ts",
Expand Down Expand Up @@ -602,14 +582,27 @@
"unresolved_imports": ["index.html:./materialdesignicons.min.css"],
"unlisted_dependencies": [],
"duplicate_exports": [
"BaseLGraph|src/lib/litegraph/src/LGraph.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"Bounds|src/renderer/core/layout/types.ts|src/renderer/core/spatial/QuadTree.ts",
"ComfyDialog|src/scripts/ui.ts|src/scripts/ui/dialog.ts",
"ContextMenu|src/lib/litegraph/src/ContextMenu.ts|src/lib/litegraph/src/ContextMenu.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"Direction|src/lib/litegraph/src/interfaces.ts|src/renderer/core/canvas/pathRenderer.ts",
"GraphOrSubgraph|src/lib/litegraph/src/LGraph.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"IGraphGroupFlags|src/lib/litegraph/src/LGraphGroup.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"JobListItem|src/composables/queue/useJobList.ts|src/platform/remote/comfyui/jobs/jobTypes.ts",
"LGraphCanvas|src/lib/litegraph/src/LGraphCanvas.ts|src/lib/litegraph/src/LGraphCanvas.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"LGraphConfig|src/lib/litegraph/src/LGraph.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"LGraphExtra|src/lib/litegraph/src/LGraph.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"LGraphNode|src/lib/litegraph/src/LGraphNode.ts|src/lib/litegraph/src/LGraphNode.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"ModelFile|src/platform/assets/schemas/assetSchema.ts|src/platform/workflow/validation/schemas/workflowSchema.ts",
"PendingInvite|src/platform/workspace/api/workspaceApi.ts|src/platform/workspace/stores/teamWorkspaceStore.ts",
"Point|src/lib/litegraph/src/interfaces.ts|src/renderer/core/canvas/pathRenderer.ts|src/renderer/core/layout/types.ts",
"RenderLink|src/lib/litegraph/src/canvas/RenderLink.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"ResolvedConnection|src/lib/litegraph/src/LLink.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"SerialisedLLinkArray|src/lib/litegraph/src/LLink.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"Size|src/lib/litegraph/src/interfaces.ts|src/renderer/core/layout/types.ts",
"SlotTypeDefaultNodeOpts|src/lib/litegraph/src/LiteGraphGlobal.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"SubgraphId|src/lib/litegraph/src/LGraph.ts|src/lib/litegraph/src/types/entityRegistry.ts",
"User|src/schemas/apiSchema.ts|src/stores/userStore.ts",
"WidgetValue|src/types/simplifiedWidget.ts|src/utils/widgetUtil.ts",
"WorkspaceWithRole|src/platform/workspace/api/workspaceApi.ts|src/platform/workspace/workspaceTypes.ts",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# ADR-TYPES-LITEGRAPH-0044: Exact entity types without import cycles

Date: 2026-10-11

## Status

Proposed

## Context

Litegraph's runtime imports are acyclic, but its public types are mutually
recursive. A node refers to its graph, and a graph refers to its nodes.
Importing these types from their implementation modules recreates the module
cycles. Replacing a concrete class with a public-member-only interface is not
compatible: TypeScript uses private and protected members when checking class
assignability, and extensions subclass these classes.

## Decision

Use same-name interfaces in `types/entityRegistry.ts`. Each implementation
augments its interface to extend the exact concrete type through a local alias.
Keep union, tuple, and primitive aliases in the merged
`LitegraphEntityRegistry` interface because an interface cannot preserve those
shapes by extending them. Existing public exports retain their names.

This removes module-import cycles, not recursive type relationships or runtime
coupling. It does not add entity members, change layout mutation ownership, or
replace the dedicated stores required by ADR-ECS-0008 and ADR-CRDT-LAYOUT-0003.
All type providers must remain reachable from the public litegraph barrel's
TypeScript import graph. Runtime providers must remain statically reachable
from `main.ts` without type-only or dynamic-import edges.

API Extractor does not reliably preserve local module augmentations. The types
build converts the leaf declarations into type re-exports of each provider's
exact alias, exports those aliases, and removes the internal augmentations
before bundling. The build derives the mapping from the source augmentations
rather than maintaining a second registry. The published package contains
ordinary declarations and does not require consumers to load our providers.

## Alternatives and consequences

- A structural contract layer would lose nominal compatibility or duplicate
hundreds of class members. It belongs to a separate extension API redesign.
- Merging the core class modules would combine unrelated responsibilities and
thousands of lines merely to reduce a graph metric.
- An indexed registry for every type works, but same-name interfaces avoid
indexed lookups for the class and object types that support inheritance.
- Source navigation now passes through the leaf interface. A partial source
program must include its providers; importing the supported barrel does so.
- Declaration publishing has an additional transformation. A compiler and
API Extractor integration test checks nominal, generic, and union types in
an isolated consumer. Source type assertions check the graph/node contracts.
22 changes: 21 additions & 1 deletion oxlint-suppressions.json
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@
},
"src/lib/litegraph/src/litegraph.ts": {
"comfy/no-reexports": {
"count": 54
"count": 55
}
},
"src/lib/litegraph/src/litegraphInstance.ts": {
Expand Down Expand Up @@ -620,6 +620,16 @@
"count": 1
}
},
"src/lib/litegraph/src/subgraph/subgraphUtils.ts": {
"comfy/no-reexports": {
"count": 1
}
},
"src/lib/litegraph/src/types/widgets.ts": {
"comfy/no-reexports": {
"count": 1
}
},
"src/lib/litegraph/src/utils/arrange.ts": {
"comfy/no-positional-boolean-params": {
"count": 1
Expand Down Expand Up @@ -1431,6 +1441,16 @@
"count": 36
}
},
"src/types/nodeState.ts": {
"comfy/no-reexports": {
"count": 1
}
},
"src/types/simplifiedWidget.ts": {
"comfy/no-reexports": {
"count": 1
}
},
"src/types/slotId.test.ts": {
"comfy/prefer-array-containing": {
"count": 1
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@
"@comfyorg/website": "workspace:*",
"@eslint/js": "catalog:",
"@intlify/eslint-plugin-vue-i18n": "catalog:",
"@microsoft/api-extractor": "catalog:",
"@pinia/testing": "catalog:",
"@playwright/test": "catalog:",
"@sentry/vite-plugin": "catalog:",
Expand Down
31 changes: 11 additions & 20 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ catalog:
'@comfyorg/comfy-multi-player': 0.3.10
typescript-native-bridge: 6.0.3-bridge.17.tsgo.7.0.2
dependency-cruiser: ^18.5.0
'@microsoft/api-extractor': 7.58.9

cleanupUnusedCatalogs: true

Expand Down
Loading
Loading