Practice: Fixing a Tally Bug and a Graph Traversal Bug
Trace and repair two independent bugs end-to-end, a tally that loses repeated counts and a dependency ordering that emits jobs too early, as practice for Palantir's FDSE re-engineering round. Reproduce each failure, trace only the relevant state, form a falsifiable hypothesis, and apply a minimal causal fix. Write regression tests that check exact counts, conservation, prerequisite ordering, and cycle rejection, and write a repair report that separates predictions from executed evidence.
We'll cover the following...
Repair two independent Python modules and submit two minimal patches, regression tests, and one investigation report before opening the reference solution. One report concerns category counts; the other concerns dependency execution order. Your evidence must connect each edit to a reproduced failure and preserve expectations derived from the contracts.
Palantir identifies working inside existing systems as an engineering competency. These tally and dependency defects are course-authored practice, not verified interview questions.
What must you deliver before opening the solution?
Use a fresh Python 3.12 workspace containing category_tally.py, dependency_execution.py, test_repair_packet.py, and repair_report.md. No files from earlier exercises are needed.
Submit:
Two limited implementation patches, keeping unrelated cleanup separate.
Tests retaining both reported fixtures and adding independently derived neighboring cases.
A report containing a reproduction, a focused trace, a pre-edit hypothesis with a potentially contradicting prediction, the causal edit, and verification evidence for each module.
Try this course-authored 35-minute budget: Five minutes for contracts and reproduction, fifteen for investigation and edits, ten for regression checks, and five for reporting. Your hypotheses and report sections start empty.
Which tally behavior must survive the repair?
tally_categories(categories) accepts a list of category strings. It must count every input occurrence, return the exact category-to-count dictionary, and leave the input unchanged. Dictionary iteration order has no significance.
The reported input is [‘amber’, ‘teal’, ‘amber’, ‘amber’, ‘teal’]. Independently counting its occurrences gives {‘amber’: 3, ‘teal’: 2}.
Run the starting tests and record the command and actual result before editing. Trace only the tally path, then write a mechanism-based hypothesis and a prediction that could contradict it. Compare a singleton category with three identical categories as part of that investigation.
What must the dependency output establish?
execution_order(vertices, edges) receives unique string vertices and unique directed edges whose endpoints are supplied. Invalid-input handling is outside this contract. Neither input may be mutated.
Each edge (prerequisite, dependent) requires the prerequisite to appear earlier in the ...