관계를 Production Code처럼 디버깅한 밤
Source: Dev.to
버그
오전 2시 17분이었습니다.
무엇이 이상했나요? 나는 한 메시지를 바라보고 있었습니다:
“우리는 얘기할 필요가 있어.”
모든 버그는 재현부터 시작됩니다.
const lastConversation = {
tone: "cold",
replies: "delayed",
misunderstanding: true
};
function reproduce(issue) {
return issue.misunderstanding && issue.tone === "cold";
}
console.log(reproduce(lastConversation)); // true
맞아요. 버그가 확인되었습니다. 이유 없이 깨지는 일은 없습니다.
git log --oneline
Output
feat: worked late all week
fix: ignored messages
refactor: stopped communicating feelings
아, 여기 있군요. 증상이 아니라 원인입니다.
근본 원인 찾기
function findRootCause() {
const ego = true;
const communication = false;
if (ego && !communication) {
return "relationship_failure";
}
}
잔인하지만 정확합니다. 핫픽스는 여기서 통하지 않아요. 제대로 된 패치가 필요했습니다.
수정 적용
async function fixRelationship() {
await apologize("I should have communicated better");
await listen();
await validateFeelings();
return "patch_applied";
}
배포 위험도? 높음. 나는 메시지를 보냈고, 기다렸습니다… 로그도, 응답도 없었습니다. 그저 침묵뿐.
setTimeout(() => {
checkResponse();
}, 5000);
5초가 5시간처럼 느껴졌습니다. 그리고 마침내:
“그렇게 말해줘서 고마워.”
시스템이 안정되고 있습니다.
배운 교훈
그날 밤 나는 어떤 문서에도 적혀 있지 않은 것을 배웠습니다:
while (relationship) {
communicate();
listen();
improve();
}
코드와 달리… 사람에게는 무한 재시도가 주어지지 않으니까요.
그리고… 그것이 내가 지금까지 고친 가장 중요한 버그였습니다.