Skip to content
Preptima
mediumScenarioCodingMidSenior

You are dropped into an unfamiliar repository with one failing business rule and an AI assistant that only gives hints. What do you do in the first ten minutes?

Debugging an unfamiliar codebase starts by running the failing test, then reading it as the rule and tracing its call path to the code that computes the wrong value. Let the size of the error narrow the cause, ask the assistant to locate and explain rather than patch, and prove the fix with a test that failed before.

5 min readUpdated 2026-10-10

Answer

Short answer

Reproduce it first. Debugging an unfamiliar codebase starts with running the one failing test and reading its exact output, then reading the test itself as the statement of the business rule. From there you trace the call path from the test into the code that produced the wrong value, and use the failing case to narrow where the two disagree. The assistant is for locating and explaining code, not for writing the patch, and the fix counts only when a test that failed before now passes and the rest of the suite still does.

Was this answer helpful?

Likely follow-ups

  • The whole suite passes after your fix except one older test that asserts the opposite order. What do you do now?
  • The failure only reproduces on the CI runner, never on your machine. What do you compare first?
  • The assistant names a function as the culprit and quotes code that is not in the file. What does that tell you about how to use it for the rest of the session?
  • There is no failing test, only a bug report with one customer's order. How do the first ten minutes change?

Related questions

Masterclass guide