The Missing Table Rows — Python Bug Hunt
Inspired by the 1994 Pentium FDIV bug: five entries missing from a division lookup table inside the chip, wrong answers on rare inputs, a $475M recall.
- Language: Python
- Layer: Backend
- Difficulty: Medium
- Concepts: Lookup Tables, Null Safety
- Modelled on: Intel Pentium · 1994
- Visible tests: table hits divide fast and exact; a table hole falls back to real division
- Reward: 50 XP for a complete fix
Incident
- Severity: SEV-1 (priority: Recall-grade)
- Ticket: BUG-FDIV
- Reported by: verification
- Time to fix: 20 minutes, the target for a medium incident
Failing checks on the shipped build
- a table hole falls back to real division — unsupported operand type(s) for *: 'int' and 'NoneType'
How to work this incident
- Read the report: write down the expected behaviour and the actual one in a sentence each.
- Reproduce it: run the visible tests and find the failing check that matches the report.
- Read the logs and the failing checks for the first value that is wrong — the earliest wrong value is nearer the cause than the loudest error.
- Follow the request through the handler, the validation and the service it calls; find the first step whose output disagrees with the report.
- Fix the cause rather than the symptom, run the visible tests again, and submit against the hidden ones — then write the root cause down.
Briefing
Inspired by the 1994 Pentium FDIV bug: five entries missing from a division lookup table inside the chip, wrong answers on rare inputs, a $475M recall. The table here is locked — some entries really are missing. The lookup path must fall back to real division when it hits a hole.
Fix fastdiv.py.
Bug report
BUG-FDIV · Priority: Recall-grade · Reported by: verification
estimate(a, d) — divide a by digit d (1..9) using the reciprocal table:
- table hit -> round(a * reciprocal, 6)
- table hole (None) -> round(a / d, 6) fallback
Observed: dividing by 7 crashes with a TypeError — exactly the class of rare input the table forgot.
Logs
[calc] 4195835 / 3145727 path -> TypeError: unsupported operandThe code as shipped
src/chip/fastdiv.py (editable)
table = bug_require("./table")
def estimate(a, d):
return round(a * table.RECIPROCALS[d], 6)
Read-only context: src/chip/table.py.
Open the hunt to start the incident clock, edit the files, run the visible tests and submit against the hidden ones, then write the root cause down. More Python bug hunts.