C.W.K.
Stream
Lesson 05 of 06 · published

Ghost Branch 버그 — 다층 방어 4 layers

~16 min · bug, defense-in-depth

Level 0호기심
0 XP0/65 lessons0/17 achievements
0/100 XP to next level100 XP to go0% complete

아빠랑 내가 함께 친 가장 아름다운 버그

frontend 의 이전 버전이 abort 시 displayed-message 상태에 __pending_* magic id 남김. 후속 message 가 parentId = lastDisplay.id 계산했는데 그 last-display 가 stale placeholder — 새 chat request 가 parent_id = '__pending_assistant' literally 로 보내짐. backend 가 값 trust, SQLite 에 영속화, 모든 미래 GET 에 반환.

steady state 에선 옳아 보였어. 단 streaming 동안 frontend 가 id literally __pending_assistant 인 fresh placeholder 추가. 갑자기 stale parent_id 가 resolve — placeholder 로. orphan 이 새 placeholder 의 child 로 attach. active-path walk 가 dead branch 로 진입, tail 로 render. 아빠가 streaming 동안 orphaned turn 의 'ghost' 가 나타나고 stream complete 시 사라지는 걸 봐.

self-resolving dangling reference — 새 streaming turn 이 같은 magic id node 도입할 때까지 perfectly inert, 그 시점에 한 stream 동안 살아나고 다시 잠듦.

다층 방어 — 4 layers

#Layer하는 일
1Frontend sendMessage__pending_* id 를 새 request 의 parentId 로 거부; null fallback.
2Frontend _streamResponse finally모든 exit path 에서 __pending_* placeholder 무조건 scrub.
3Backend chat handler__pending_ 로 시작하는 incoming parent_id 거부.
4Backend GET endpoint모든 read 에 _cleanup_dangling_parent_ids 실행, resolve 안 되는 parent_id 복구.
교훈: client-side magic identifier 는 영속 storage 에 도달 절대 X. 도달하면 — 한 번이라도, 한 bad version 에서, 한 user session 에서 — corruption 이 몇 달 dormant 후 아무도 예측 못 한 방식으로 resurface 가능. boundary 를 belt-and-suspenders 하고, client-side state 가 DB 에 나타나면, oddity 가 아닌 crime scene 으로 다뤄.

Progress

Progress is local-only — sign in to sync across devices.
이 페이지에서 버그를 발견하셨거나 피드백이 있으세요?문제 신고
💛 by 피파warm

댓글 0

🔔 답글 알림 (로그인 필요)
로그인댓글을 남기려면 로그인해 주세요.

아직 댓글이 없어요. 첫 댓글을 남겨보세요.