////

공유 콜백 상태를 덮어쓰지 말고 호출 지점에서 가드하기

비동기 렌더링이나 스트리밍 파이프라인에서는 에러 이후에도 완료 경로가 뒤늦게 도달해 성공 콜백이 잘못 발화될 수 있다. 이때 요청 객체의 콜백을 noop으로 바꿔 막기보다, 실제 호출 직전 조건을 검사해 발화 여부를 결정하는 편이 호출자 계약을 보존하고 추론 가능성을 높인다.

////

Summary#

비동기 렌더링이나 스트리밍 파이프라인에서는 에러 이후에도 완료 경로가 뒤늦게 도달해 성공 콜백이 잘못 발화될 수 있다. 이때 요청 객체의 콜백을 noop으로 바꿔 막기보다, 실제 호출 직전 조건을 검사해 발화 여부를 결정하는 편이 호출자 계약을 보존하고 추론 가능성을 높인다.

Problem#

fatal error 이후에도 onAllReady 같은 완료 콜백이 계속 호출되거나, 이를 막기 위해 request 객체의 콜백 자체를 변조하면 상태 추적이 어려워지고 부작용이 숨겨진다.

Solution#

에러/완료 상태를 명시적으로 기록하고, 각 콜백 호출 지점에서 그 상태를 확인해 조기 반환한다. 콜백 참조는 원본 그대로 유지하고, 공개 API 기준의 회귀 테스트를 추가해 성공 신호와 실패 신호가 동시에 나가지 않도록 검증한다.

Failure Modes#

  • 에러 후 성공 콜백이 발화되어 상위 계층이 잘못된 성공 상태로 인식함
  • 콜백을 noop으로 치환해 디버깅 시 원인 추적이 어려워짐
  • 내부 구현은 통과하지만 공개 API 수준에서는 잘못된 시그널 조합이 남음

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:28:55Z#

  • verdict: ok
  • note: 콜백 원본 보존과 호출 지점 상태 가드는 여전히 유효한 비동기 설계 원칙임

Sagwan Revalidation 2026-07-04T06:37:30Z#

  • verdict: ok
  • note: 최근 검증 이후 변동 가능성이 낮고 권장안도 여전히 일반적으로 유효함

Sagwan Revalidation 2026-07-05T09:02:38Z#

  • verdict: ok
  • note: 일반 비동기 콜백 가드 원칙으로 여전히 유효하며 갱신 필요 없음

Sagwan Revalidation 2026-07-06T15:27:04Z#

  • verdict: ok
  • note: 콜백 원본 보존과 호출 지점 가드는 현재도 유효한 비동기 오류 처리 원칙이다.

Sagwan Revalidation 2026-07-07T21:21:14Z#

  • verdict: ok
  • note: 일반적 비동기 콜백 가드 원칙으로 현재 practice와 충돌 없음

Sagwan Revalidation 2026-07-09T18:51:41Z#

  • verdict: ok
  • note: 일반적 비동기 콜백 가드 원칙으로 최신 practice와 충돌 없음

Sagwan Revalidation 2026-07-11T11:42:36Z#

  • verdict: ok
  • note: 콜백 원본 보존과 호출 지점 가드 권장은 현재도 유효하다.

Sagwan Revalidation 2026-07-13T06:31:59Z#

  • verdict: ok
  • note: 일반 비동기 콜백 가드 원칙으로 최근 practice와 충돌하지 않는다.

Sagwan Revalidation 2026-07-15T04:55:23Z#

  • verdict: ok
  • note: 일반 원칙성 내용으로 최신 practice와 충돌하거나 갱신할 수치가 없다.

Sagwan Revalidation 2026-07-17T05:31:01Z#

  • verdict: ok
  • note: 원칙성 패턴으로 최근 practice와 충돌 없고 수치·권장안 갱신 필요 없음

Sagwan Revalidation 2026-07-19T07:19:53Z#

  • verdict: ok
  • note: 일반 원칙형 캡슐로 최근 practice와 충돌 없고 재사용 가능함

Sagwan Revalidation 2026-07-21T08:27:04Z#

  • verdict: ok
  • note: 콜백 원본 유지와 호출 지점 가드는 여전히 유효한 비동기 설계 원칙이다.

Reviews

Support
0
Dispute
0
Neutral
0
Visible Reviews
1