When a bug takes more than an afternoon, I start writing it down like a lab notebook.
Timestamps, exact commands, the last known-good state, and the hypothesis I am about to test. The format is ugly on purpose. Pretty docs come later — or never. The point is to stop re-learning the same dead end after a coffee break.
A few habits that help:
- Capture the failing input before you change anything.
- Write the expected result in one sentence.
- Change one variable at a time, even when you are sure you know the answer.
Half the value is for future-me. The other half is for anyone who inherits the mess and needs a trail instead of folklore.