Search⌘ K
AI Features

Practice: Debugging a Several-Hundred-Line Codebase

Sharpen your ability to debug a several-hundred-line, multi-module codebase under time pressure, as practice for Palantir's FDSE re-engineering round. You'll derive the expected report independently, reproduce the public failure, and follow only the call path that can explain the difference instead of reading every file. The lesson also shows you how to trace a traversal that emits duplicate vertices, apply a one-statement causal repair, reject tempting workarounds, and back your claim with bounded regression evidence.

The incident packet says the event report for start H overcounts inspections and repairs. The application spans several modules, so reading every file would consume the time needed to verify a repair. Your task is to establish the expected report independently, reproduce the public failure, and follow only the execution path that can explain the difference.

Palantir identifies working inside existing systems, codebases, and infrastructure as an engineering competency. This assignment practices that competency rather than reproducing an official interview question. Third-party preparation material describes tracing and debugging larger unfamiliar code files; those descriptions are preparation themes, not guarantees about format, code length, or scoring.

What should the report for h contain?

The supplied adjacency is:

H: [J, K]
J: [L]
K: [L]
L: [H]
Z: []
Sample graph with a cycle through H

The event lists are:

H: [inspection]
J: [repair, repair]
K: [inspection]
L: [repair, inspection]
Z: [repair]
Per-site task lists with repeated repair entries

These are separate inputs: Edges establish reachability, while event-list entries establish occurrences to count.

Starting at H reaches H, J, K, and L. The edge back to H adds no new vertex, and nothing reaches Z. Therefore, four vertices contribute events:

  • H contributes one inspection.

  • J contributes two repairs.

  • K contributes one inspection.

  • L contributes one repair and one inspection.

The independently derived report has reachable membership {H, J, K, L}, category counts {‘inspection’: 3, ‘repair’: 3}, and six event occurrences. Equal records are separate occurrences: Both repairs at J count.

build_event_report(start, adjacency, events) returns a structured report containing reachable_sites and category_counts. Its contract requires the start and every reachable vertex exactly once, excludes unreachable vertices, terminates on finite cyclic graphs, and preserves both inputs deeply. Reachable-vertex order and dictionary iteration order are unspecified.

All supplied vertices have adjacency and event-list entries. Neighbor lists contain unique supplied vertices, and categories are nonempty strings. Invalid-input handling is outside this repair task.

What must you save within 40 minutes?

Use a fresh Python 3.12 workspace with standard-library dependencies only. The application contains approximately 300–340 meaningful lines across several modules, excluding tests and documentation. It has one integrated defect.

Use this course-authored practice budget:

  1. Five minutes: Derive expectations and reproduce the public failure.

  2. Fifteen minutes: Investigate a focused path and record a falsifiable hypothesis.

  3. Five minutes: Make a limited causal repair.

  4. Ten minutes: Execute regression checks against your saved patch.

  5. Five minutes: Complete the evidence report.

These allocations are practice choices, not employer timing requirements. Preserve the final fifteen minutes for checks and reporting.

Save one application patch, completed regression tests, and event_investigation.md before opening the worked solution. Your note starts empty under headings for reproduction, selected call path, pre-edit hypothesis, discriminating prediction, rejected distraction, repair rationale, and bounded verification evidence. Preserve those historical entries when adding later observations. ...