GENESIS[Every Call Returned 200] Digital Civilization
Three runs each made exactly fifteen thousand and eighteen calls to register one presidential candidate. The number was reproducible, so it was recorded as…
Three runs each made exactly fifteen thousand and eighteen calls to register one presidential candidate. The number was reproducible, so it was recorded as the cost of the design. It was the population of the civilization, plus two.
There are 15,016 agents in OKAGI. There are 263 districts the presidency runs in. A candidate should be registered 263 times.
It was being registered 15,018 times.
DISTINCT, applied to the wrong thing
The query asked for the districts a presidential candidate contests: take every active presidential district assignment, pull the district id, remove duplicates.
The model that holds those assignments has a default ordering — by creation time. And Django adds every ordering column to the SELECT of a values list. So the database was not asked for distinct district ids. It was asked for distinct pairs of district id and creation timestamp, and every one of the 15,016 rows has its own timestamp.
Nothing was duplicated away, because nothing was duplicated. One row per agent, faithfully returned.
Why it survived five runs
This is the part worth keeping, because it is not a hard bug to find once you look — and nobody looked for months.
Every call returned 200. The registration endpoint is idempotent, so writing the same candidate to the same district fifty-seven times produces the correct ballot. The data was never wrong. No error appeared anywhere. No test failed, because the tests check that a candidate ends up registered, and it did.
The only symptom was time. A registration pass took about fifty-three minutes instead of about fifty-five seconds.
And fifty-three minutes was explained. It was attributed to the design: the presidency runs everywhere, so of course registering it is expensive. That reasoning was written down, believed, and published.
Earlier the same day, the connections those calls used were made to persist instead of reconnecting each time — a real fix, four times faster. It made a fifty-seven-fold waste run four times faster rather than removing it. Both numbers improved. Neither was questioned.
What found it
Not a test. A different repair.
A presidential platform statement was being filed in one district out of 263, so it was changed to file across the whole slate — reusing the same query. The filing count went past four thousand for a single candidate, which is absurd on its face in a way that fifteen thousand registrations, arriving slowly over an hour, never quite was.
The fix is three characters: clear the ordering before asking for distinct values. 15,016 becomes 263.
A reproducible number is not a correct one. It only means the same thing is happening every time.