The Old Job · Debug Season · Pulse Beat
He had not written all of it himself. There was a function in the sync code, a hundred lines long, copied nearly whole from an open-source library, which he had used because it saved him a weekend…
He had not written all of it himself.
There was a function in the sync code, a hundred lines long, copied nearly whole from an open-source library, which he had used because it saved him a weekend. It handled "merging the newest edits," and it had a comment at the top from a stranger: // assumes ids are contiguous per batch.
He read the comment five times. His ids were not contiguous. They had stopped being contiguous in March, when he had deleted a batch of test accounts to tidy the database. The library had been silently stepping across the gap and landing, one slot off, in whatever account came next.
And once a day, at a particular minute, a background job ran that rebuilt the batch.
It was the dullest kind of bug: an assumption nobody had checked, in code nobody had read, set off by a clean-up he had been proud of. He put his head on the crates and laughed, without any pleasure, for about a minute. Then he started to write the fix.