The Labs / Foundations
FoundationsApplied~3h
Turn a mystery bug into an exact line and a reason
You're handed a program that runs without crashing but produces wrong output on some inputs. You add logging/breakpoints to narrow the failure to one function, then one line, then the specific value that breaks the assumption — and write down the causal chain, not just the symptom. You fix the line and add a regression test that fails on the old code and passes on the new. This is the core Sage mental model: don't debug the vibe, make the failure a location.
它证明了什么
你可以在面试中捍卫的一句话。
简历亮点
Diagnosed a silent logic defect in an unfamiliar codebase to the exact failing line using systematic instrumentation (bisection, targeted logging), documented root cause, and shipped a fix with a regression test proven to fail on the original code.
- Can debug methodically under ambiguity instead of guessing and re-running
- Narrows a failure to a location and a mechanism, not a vague description
- Writes the regression test that proves the bug is understood, not just silenced
- Communicates a root-cause chain another engineer could follow
简介
你逐步构建的内容。
- 01Start from a provided program (20-80 lines) that passes some inputs and silently produces wrong output on others — no exception, no crash.
- 02Reproduce the failure with a minimal input and record the observed-vs-expected output.
- 03Bisect the call path with targeted logging or a debugger to narrow the defect from 'somewhere in this file' to one function.
- 04Narrow further to the exact line and the specific runtime value that violates an assumption the code silently relies on.
- 05Write a one-paragraph root-cause explanation: what the code assumed, what actually happened, and why the mismatch produced that specific wrong output.
- 06Fix the line and add a regression test that fails against the original buggy code and passes against the fix.
证明
当这些通过时,即完成。
The regression test fails when run against the original buggy source
automated test
The regression test passes against the fixed source
automated test
The root-cause writeup names the exact file, line number, and the specific value that triggers the defect
artifact
Full existing test suite still passes after the fix (no new regressions introduced)
automated test
技术栈
Python or JavaScripta debugger or print/log instrumentationa test framework (pytest/vitest)
Sage Method
frame → route → decide → prove
你将保留
The fixed program + a regression test + a root-cause writeup naming the exact line and mechanism