Comfy-Org / Comfy-Org/ComfyUI_frontend

[RFC] Cross-layer violations within layered code — 8 confirmed violations

Open
#11,089 0 comments 0 reactions 0 assignees View on GitHub
refactor
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Problem

Building on Issue #11018's initial findings, the second audit pass confirmed 8 specific violations within the layered code:

### base → platform (2 violations)
- `base/common/downloadUtil.ts` → `platform/distribution/types`
- `base/common/downloadUtil.ts` → `platform/updates/common/toastStore`

### platform → renderer (5 violations)
- `platform/settings/composables/useLitegraphSettings.ts` → `renderer/core/canvas/canvasStore`
- `platform/workflow/core/services/workflowService.ts` → `renderer/core/thumbnail/useWorkflowThumbnail`
- `platform/workflow/management/stores/workflowStore.ts` → `renderer/core/thumbnail/useWorkflowThumbnail`
- `platform/workflow/templates/composables/useTemplateUrlLoader.ts` → `renderer/core/canvas/canvasStore`
- `platform/missingModel/missingModelStore.ts` → `renderer/core/canvas/canvasStore`

### workbench → renderer (1 violation)
- `workbench/eventHelpers.ts` → `renderer/core/canvas/canvasStore`

**Note**: This is a refinement of Issue #11018 with the complete violation list. Consider merging into #11018.

## Proposed Fix

Per violation:
1. `downloadUtil.ts`: Move `isCloud` check to a `base/` constant, inject toast via callback
2. `useLitegraphSettings.ts`: Extract canvas settings interface to `platform/`
3. `workflowService/workflowStore → thumbnail`: Move thumbnail capture to workbench, provide via injection
4. `useTemplateUrlLoader/missingModelStore → canvasStore`: Abstract canvas access behind platform-level interface
5. `eventHelpers.ts → canvasStore`: Move event helpers to renderer

## Testing Strategy

- `pnpm typecheck` passes
- Add ESLint enforcement rule

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11089-RFC-Cross-layer-violations-within-layered-code-8-confirmed-violations-33e6d73d3650815fa5fae560975c5de9) by [Unito](https://www.unito.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.