Comfy-Org / Comfy-Org/ComfyUI_frontend

test: add coverage for _resolveLegacyEntry disambiguator preservation and safeDeepClone catch branch

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

Description

## Context

Follow-up from PR #11559 (fix: restore SubgraphNode.widgets_values dead-field invariant) — review comment: https://github.com/Comfy-Org/ComfyUI_frontend/pull/11559#discussion_r3137985383

Requested by: @dante01yoon

---

## Coverage gaps to address

### 1. Disambiguator preservation in `_resolveLegacyEntry` (PATH 1)

The existing test at `promotedWidgetView.test.ts:1340` manually sets `input._widget = createPromotedWidgetView(...)` before `_internalConfigureAfterSlots`, which forces PATH 2 inside the resolver. In production, `input._widget` is always `undefined` at that point, so PATH 1 runs instead.

**Missing coverage:** No test exercises a legacy `-1` entry whose resolution chain terminates at a nested `PromotedWidgetView` with a non-null `disambiguatingSourceNodeId`.

A direct repro should:
- Assert that the `pendingValues` key matches the eventual `view.instanceKey`
- Confirm that the per-instance value survives the `restorePerInstanceValue` call

### 2. `safeDeepClone` catch branch (SubgraphNode.ts ~L77-83)

The fallback behavior — "preserve raw reference when `structuredClone` throws" — is only documented in a comment in `SubgraphNode.ts`. No automated test locks in this contract.

**Missing coverage:** A single test passing a circular-reference value (or an object with a `toJSON` that throws) through `serialize()` would ensure that `configure` does not crash and falls back gracefully, preventing future regressions.

---

## Notes

Both are low-frequency edge cases and are fine to address in a follow-up PR.

┆Issue is synchronized with this [Notion page](https://www.notion.so/Issue-11618-test-add-coverage-for-_resolveLegacyEntry-disambiguator-preservation-and-safeDeepClo-34c6d73d365081e88ef5c4d330184f77) 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.