Comfy-Org / Comfy-Org/ComfyUI_frontend

refactor: general workflow serialization and type-boundary cleanup outside the missing-model refresh path

Open
#11,757 0 comments 0 reactions 1 assignee Claimed by @jaeone94 View on GitHub
area:workflows developer experience
Dominant language
TypeScript
Stars
2k
Forks
699
Avg merge
1d 7h
Merged PRs (30d)
490

Description

## Follow-up from PR #11751

**Context:**
PR #11751 (https://github.com/Comfy-Org/ComfyUI_frontend/pull/11751) removed the unsafe `graph.serialize() as unknown as ComfyWorkflowJSON` cast in the missing-model refresh path by introducing `FlattenableWorkflowGraph`/`FlattenableWorkflowNode` contracts. However, broader workflow serialization and type-boundary cleanup outside the missing-model refresh path was deferred (also partially tracked in #11679).

**Task:**
Audit and clean up remaining places in the codebase where `LGraph.serialize()` output is unsafely cast to `ComfyWorkflowJSON` or similarly mismatched types. Extend or reuse the flattenable workflow contract where appropriate to eliminate unsafe type assertions.

**Relevant files:**
- `src/platform/workflow/core/utils/workflowFlattening.ts`
- `src/platform/workflow/validation/schemas/workflowSchema.ts`
- `src/scripts/app.ts`

**Related:** #11679

**Requested by:** @jaeone94 in https://github.com/Comfy-Org/ComfyUI_frontend/pull/11751

┆Issue is synchronized with this [Notion page](https://app.notion.com/p/Issue-11757-refactor-general-workflow-serialization-and-type-boundary-cleanup-outside-the-missin-3516d73d3650815184d0f7479428292b) 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.