Medium stripe companies

How do you approach a bug squash round in an unfamiliar codebase?

The 30 second answer

First I make sure the project builds and the tests run before the call. Then I reproduce the bug and restate expected versus actual behaviour. I follow the code path from the entry point to where the value first goes wrong, using breakpoints or logging, and test one hypothesis at a time out loud. I make the smallest fix for the root cause, rerun the tests, and add a regression test.

A bug squash round rewards a calm, visible method more than speed-reading the whole repository. A practical sequence:

  1. Before the call. The IDE is installed, the project builds, tests run with one command and breakpoints actually stop. The reported candidate named debugger setup as the thing that would have saved time.
  2. Reproduce first. Read the README and the bug report or failing test, reproduce the failure, and say the expected and actual behaviour out loud so the interviewer can correct a misunderstanding early.
  3. Follow one path. Start from the entry point (an endpoint, a CLI command or the failing test) and follow the call chain to the first place where state becomes wrong. Ignore unrelated modules.
  4. Narrow with evidence. Put a breakpoint or a log line at the boundary between correct and incorrect state and test one hypothesis at a time. If the history is available and the bug is a regression, git bisect finds the commit that introduced it by binary search over the history.
  5. Fix the cause, minimally. Change the smallest thing that addresses the root cause rather than the symptom, in the existing code style.
  6. Prove it. Rerun the failing case and the whole suite, and add a regression test if coverage is missing.
  7. Manage time. With about ten minutes left, state the root cause and the planned fix before implementing, so a clear diagnosis is on record even if the code isn't finished. The reported candidate found the cause but did not finish the fix in time.

To practise, take a small open-source repository, revert a merged bug-fix commit, and give yourself 45 minutes to find and fix the bug again without looking at the original fix.

Sources (2)
  1. Candidate report of a Stripe Software Engineer loop (r/leetcode)reddit.com
  2. Git documentation: git bisectgit-scm.com