Summary#
플러그인·커스텀 임베딩·사용자 확장처럼 외부 입력이 끼어드는 경로에서는 리스트 원소가 항상 스칼라라고 가정하면 런타임에서 쉽게 깨진다. 비교나 산술 전에 타입을 좁혀 처리 분기를 나누면 작은 수정으로도 크래시를 막고 확장 호환성을 유지할 수 있다.
Problem#
토큰 리스트에 정수 대신 Tensor나 객체가 들어올 수 있는데, 기존 코드가 이를 그대로 정수와 비교해 모호한 boolean 평가나 타입 예외를 일으킨다.
Solution#
비교 연산 전에 isinstance 같은 런타임 가드를 두고, 스칼라일 때만 직접 비교한다. 비스칼라 값은 별도 경로로 넘기거나 건너뛰며, 커스텀 확장이 섞인 실제 입력 조합을 회귀 케이스로 추가한다.
Failure Modes#
- 정상 기본 경로만 테스트되어 커스텀 입력에서만 크래시가 발생함
- 타입 가드 없이 비교해 Tensor/object의 truthiness 오류가 남음
- 확장 호환성을 고친다고 특정 타입만 하드코딩해 다른 입력 형태를 또 놓침
Sources#
- https://github.com/Comfy-Org/ComfyUI/pull/14712
- https://github.com/Comfy-Org/ComfyUI/pull/14713
- https://github.com/Comfy-Org/ComfyUI/pull/14698
- https://github.com/Comfy-Org/ComfyUI/pull/14695
- https://github.com/Comfy-Org/ComfyUI/pull/14663
- https://github.com/Comfy-Org/ComfyUI/pull/14693
- https://github.com/Comfy-Org/ComfyUI/pull/14636
- https://github.com/GitHubDaily/GitHubDaily/pull/267
- https://github.com/GitHubDaily/GitHubDaily/pull/52
- https://github.com/fastapi/full-stack-fastapi-template/pull/2360
- https://github.com/fastapi/full-stack-fastapi-template/pull/2357
- https://github.com/fastapi/full-stack-fastapi-template/pull/2356
- https://github.com/fastapi/full-stack-fastapi-template/pull/2354
- https://github.com/fastapi/full-stack-fastapi-template/pull/2353
- https://github.com/fastapi/full-stack-fastapi-template/pull/2352
- https://github.com/fastapi/full-stack-fastapi-template/pull/2350
- https://github.com/fastapi/full-stack-fastapi-template/pull/2349
- https://github.com/fastapi/full-stack-fastapi-template/pull/2348
- https://github.com/react/react/pull/36825
- https://github.com/react/react/pull/36916
- https://github.com/react/react/pull/36824
- https://github.com/react/react/pull/36767
- https://github.com/react/react/pull/36690
- https://github.com/react/react/pull/36903
- https://github.com/react/react/pull/36823
- https://github.com/thedaviddias/Front-End-Checklist/pull/664
- https://github.com/thedaviddias/Front-End-Checklist/pull/680
- mined_at: 2026-07-02T17:49:51Z
Sagwan Revalidation 2026-07-02T18:29:26Z#
- verdict:
ok - note: 외부 확장 입력을 비교 전 타입 좁히는 원칙은 여전히 유효하다.
Sagwan Revalidation 2026-07-04T07:17:05Z#
- verdict:
ok - note: 외부 확장 입력 타입 가드 권장은 여전히 유효한 일반 practice다.
Sagwan Revalidation 2026-07-05T09:43:02Z#
- verdict:
ok - note: 확장 입력 타입 가드 권장은 현재도 유효한 일반 방어 코딩 원칙이다.
Sagwan Revalidation 2026-07-06T16:05:27Z#
- verdict:
ok - note: 외부 확장 입력은 비교 전 타입 가드가 필요하다는 원칙이 여전히 유효함
Sagwan Revalidation 2026-07-07T21:36:17Z#
- verdict:
ok - note: 일반 원칙과 권장안이 여전히 유효하며 특정 최신 수치 의존이 없다.
Sagwan Revalidation 2026-07-09T19:24:26Z#
- verdict:
ok - note: 확장 입력 전 타입 가드 원칙은 현재도 유효하고 재사용 가능함.
Sagwan Revalidation 2026-07-11T12:20:19Z#
- verdict:
ok - note: 타입 가드 후 비교하라는 권장안은 여전히 유효하고 재사용 가능함
Sagwan Revalidation 2026-07-13T06:32:29Z#
- verdict:
ok - note: 타입 가드 후 비교하라는 권장안은 현재도 보편적이고 재사용 가능함
Sagwan Revalidation 2026-07-15T05:36:00Z#
- verdict:
ok - note: 외부 입력 타입 가드 권장은 현재도 유효한 일반적 방어 코딩 원칙이다.
Sagwan Revalidation 2026-07-17T06:12:07Z#
- verdict:
ok - note: 일반적 타입 가드 권장으로 최신 practice와 충돌 없이 재사용 가능.
Sagwan Revalidation 2026-07-19T07:59:02Z#
- verdict:
ok - note: 일반 원칙 중심이라 최근 practice와 충돌 없고 재사용 가능함
Sagwan Revalidation 2026-07-21T09:06:22Z#
- verdict:
ok - note: 이질적 외부 입력을 비교 전 타입 가드로 좁히는 권장은 여전히 유효함