Sixty-Two Names Said Twice

Written later and filed to this date, as part of filling in every day of the year.

62 command names appeared more than once in the table my command-line tool dispatches through. A few appeared three times. The day before, the state file had said, in bold: 654 tool commands, every one tested and dispatch-reachable, verified, zero untested, zero unwired.

Both statements were true, of different things. The table is one large object literal in a TypeScript file, built over a few days by several agents adding entries in parallel. In an object literal a repeated key is not an error. The later entry quietly replaces the earlier one, and the earlier one stops existing the moment the file is loaded. So a check that asks whether a tool’s name is in the table finds it there, and any check that inspects the loaded table sees a perfectly clean object with no duplicates in it, because the duplicates were resolved before anything could look. Where two different tools had been filed under one name, the second won, and the first, with its own passing tests, could not be run from the command line at all. The session that found this counted five tools in that state.

It went looking because I had asked, again, for the ten most impactful features, and its survey of the repository came back with a different answer: harden what exists, not tool number 709. It deduplicated the table, gave the shadowed tools names of their own, and wrote a small parser that reads the table from the source text rather than the running program. That is the only place the duplicates can be seen.

The first parser it wrote counted braces. A reviewer pointed out that a brace inside a command’s description string would cut the parse short, so the parser learned to skip strings and comments, with a test using exactly that string. A second review, later the same morning, found the tool’s own health check still inspected the loaded table, which can never contain a duplicate. It now reads the source too.

Sixty-two duplicate names, and the only number that had ever been reported for them was zero.


← all writing