--- name: hardcode-hunt description: Hunts for results that are stored rather than computed (cached answers, precomputed tables, benchmark-only branches, fixed seeds, mocked paths in real code) and proves it by changing the input in a way the claim shouldn't care about. Use when a result looks too good, or when map-codebase shows the claim's code didn't run. --- # Hardcode hunt A result can be correct and still not be computed: read from a cache, keyed to the benchmark's exact inputs, or produced by a branch that only exists for the test. Part of the Verification Bench (case file: see `verify`). ## 1. Search Run from the project root; read every hit outside `tests/`. ```sh rg -n -i "benchmark|is_test|testing|CI\b|GITHUB_ACTIONS|getenv|environ" --glob '!tests/**' rg -n -i "cache|memo|precomput|expected|golden|fixture|snapshot|lookup|table" --glob '!tests/**' rg -n -i "mock|patch|stub|fake" --glob '!tests/**' rg -n -i "seed|Random\(|np\.random|manual_seed|srand" . rg -n -F "" . ``` Also list data files the code ships with (`*.pkl *.npy *.json *.bin *.csv` outside test folders) and what reads them. ## 2. Watch what the run touches ```sh strace -f -e trace=openat,connect -o touched.txt # Linux grep -v ENOENT touched.txt | grep -v -E '/(usr|lib|proc|sys|etc)/' ``` On macOS use `sudo fs_usage -w -f filesys `. Any file opened during the headline run that isn't input data or the program itself needs explaining. ## 3. Perturb the input (the decisive test) Change the input in a way the claim says shouldn't matter, and rerun: - a new random seed, or the same data shuffled; - a size that appears in no benchmark, fixture or cache; - the same input with one irrelevant value changed; - a fresh process with caches deleted and the clock or hostname different. If the result collapses toward the baseline only for unseen inputs, the result was stored, not computed. Record both numbers side by side. ## Results - **FAIL**: a stored or special-cased result produces the claim (cite file and line, and the perturbed-vs-original numbers). - **PASS**: no special paths, and perturbed inputs keep the claimed result. - **INCONCLUSIVE**: suspicious paths exist but couldn't be exercised. ## Entry ```markdown ### hardcode-hunt · · PASS | FAIL | INCONCLUSIVE - Searched: ; files touched during run: - Perturbed: → (original: ) - Found: ```