test: pin command dispatch to C's command.c switch (closes #31)
Audits every case label in C's command.c against this port's dispatch and leaves the audit behind as a standing test, so the two lists cannot drift again. A missing dispatch entry is the one porting error that leaves no trace at build time: the port is function-by-function, so every C function has a Go counterpart and a dropped key dangles nothing, fails to compile nowhere, and simply answers "illegal command" the first time a player presses it. That is how '+' (#11) survived until PR #30 found it by accident. Result: no further missing keys. '+' was the only one. Recording that as a negative result — the class of bug is real, it has now been searched for exhaustively rather than stumbled upon, and the search came back empty. Eighty labels: sixty-five in the main switch, fifteen in the wizard sub-switch. commandHandlers is pinned by set equality in both directions. A missing key is the '+' bug; an extra key is the same bug mirrored, since the likeliest way to acquire one is promoting a key out of the wizard sub-switch, which would expose a MASTER debug command in ordinary play. The main-switch keys that commandHandlers cannot hold - the goto-over re-dispatches, F-to-f, 'a' and 'm' - are covered separately through dispatchKey, because dropping one of those is just as silent as dropping a map entry. Two traps are documented in the file. rogue.h 52-53 defines when as break;case, so a grep for 'case ' finds ten of the eighty labels. And the main/wizard split is load-bearing: '+' was a divergence in ordinary play, not just wizard mode, precisely because it is a main-switch key. Confirms this port targets the MASTER build: all four #ifdef MASTER sites in command.c are ported unconditionally, as is sticks.c 237.
This commit is contained in:
21
TODO.md
21
TODO.md
@@ -34,6 +34,27 @@ wizard commands).
|
||||
|
||||
# Completed Steps
|
||||
|
||||
- 2026-08-09 Command dispatch audit (`audit/command-switch-coverage`, closes
|
||||
#31): checked every case label in C's `command.c` against this port's
|
||||
dispatch, and left the audit behind as a standing test
|
||||
(`game/dispatch_test.go`) so the two cannot silently drift again. **No further
|
||||
missing keys were found** — `'+'` (#11) was the only one. That is the result,
|
||||
and it is worth recording as a negative: the class of bug exists, it has now
|
||||
been searched for exhaustively rather than stumbled upon, and the search came
|
||||
back empty. Three tables transcribe C's labels with their line numbers:
|
||||
main-switch keys answered from `commandHandlers`, main-switch keys whose arms
|
||||
need `dispatchKey`'s own switch (the `goto over` re-dispatches, `F`-to-`f`,
|
||||
`a`, `m`), and the `if (wizard)` sub-switch. `commandHandlers` is pinned by
|
||||
set equality in **both** directions: a missing key is the `'+'` bug, and an
|
||||
extra key is the same bug mirrored — a MASTER debug command leaking into
|
||||
ordinary play. Two traps make this audit harder than it sounds and are
|
||||
documented in the file: `rogue.h` 52-53 defines `when` as `break;case`, so a
|
||||
grep for `case ` finds ten of the eighty labels; and the main/wizard split is
|
||||
load-bearing, since `'+'` was a divergence in ordinary play precisely because
|
||||
it is a main-switch key. Confirms the port targets the MASTER build — all four
|
||||
`#ifdef MASTER` sites in `command.c` are ported unconditionally, as is
|
||||
`sticks.c` 237.
|
||||
|
||||
- 2026-08-09 Three small lost C behaviors (`fix/lost-c-behaviors`, closes #13):
|
||||
grouped because each is a few lines and all are "restore something the port
|
||||
dropped silently". (1) **"what a bizarre schtick!"**, `sticks.c` 237 — the
|
||||
|
||||
Reference in New Issue
Block a user