Three commands answered a question nobody asked #1494
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1494
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/answer-the-question"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The symptom
I set out to check that configuration survives save and reopen, and it does: 73 config keys across four devices, 0 lost, 0 changed, and twelve
showviews byte-identical before and after. The five persistence fixes (#1405, #1459, #1465, #1467, #1487) hold.Building that probe is what found these. Three commands replied in the voice of a neighbouring command — and each answer looked plausible enough to believe.
spanning-tree portfastwas answered asspanning-tree priorityThe handler took
tokens[2]as a bridge priority without readingtokens[1]:portfastis the most-typed command in a switching lab, and the console answered a question about priorities.cost 19is worse: 19 is a number, so the refusal reads like a verdict on the number rather than on the word, and a reader has no reason to doubt it.vlan 20 name labcreated a VLAN called "name lab"nameis a keyword in IOS's vlan sub-mode, not part of the name. The engine joined every word after the id and stored the result — soshow vlan, and every other screen that lists names, printed the keyword as data:Silently wrong data is worse than a refusal, because nothing about it looks like an error.
do show vlanrejected the command it was givendopassedtokens.slice(1)— still starting withshow— into theshowdispatcher, which expects the words aftershow:Every
do show …in every configuration session failed that way, echoing the command it had just failed to run.do show runis a reflex for anyone who has configured a switch, and it had never worked.What changed
spanning-treereads its verb before its value. A sub-command this device does not model says so, by name:% spanning-tree portfast is not modelled: this device runs one spanning tree, and its only tunable isspanning-tree priority <0-61440 in 4096 steps>``. A misspelling is unknown, and quoted back with the form that does exist.prioritybehaves exactly as before, including the 4096-ladder message with the nearest valid values, the per-VLAN refusal, and a new one: a word where a number belongs (spanning-tree priority high) is now quoted rather than coerced.vlanreads thenamekeyword as a keyword.vlan 20 name lab→lab;vlan 20 lab→lab(the documented form, unchanged);vlan 20→VLAN0020; a two-word name survives whole;vlan 40 name-labis not eaten because the word only counts in front;vlan 20 namewith no text is refused as incomplete and writes nothing. IOS's two-line form now meets a hint instead of a bare refusal:do show …runs the command it was given, anddoon anything else says what it does here rather than failing obscurely.Evidence
test/command-answers-the-question.test.js— 27 checks, 27 passed / 0 failed. With the old handler: 11 passed / 16 failed, each naming the neighbour's answer it used to give (portfast -> Usage: spanning-tree priority,vlan 20 name lab -> name lab,do show vlan -> Invalid show command: show vlan).The test keeps the distinction that matters: a real IOS sub-command this model does not implement is refused as not modelled, while a misspelling is refused as unknown — so the two no longer read identically. It also pins what must not regress:
priority 4096applies and stores,priority 5000names 4096 and 8192, nothing is written when refused, andvlan 20 labstill means what the docs say.Docs:
docs/CLI.md, new section "Three commands that answered a question nobody asked", with before/after transcripts; the two VLAN table rows now readvlan <id> [name] <text>.Full suite: 244 suites, 9,070 assertions, 0 failed. Syntax 313 files.
spanning-tree portfast,vlan 20 name labanddo show vlaneach answered a different question #1493