A verb eaten by a join, and the token nobody typed #1456
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!1456
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/trunk-allowed-add-remove"
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?
Closes #1455
The branch joined the tokens after
switchport trunk allowed vlanwith no separator — deliberate, so10, 20and40 - 42typed with spaces still parsed — and that join ate the verbs IOS puts in front of a list to edit the one already there. The refusal quotes a token nobody typed, and the only way to add a VLAN is to retype the whole list from memory, which is exactly the mistakeadd/removeexist to prevent.The change
The verb is read from the token list before anything is glued; only the list is joined.
Four decisions worth keeping:
add 10when 10 is already allowed:already allows VLANs 10: the list is unchanged (10,20).remove 99when 99 was never allowed: refused, with the list it left alone. A silent success on a no-op teaches an operator that something moved when nothing did.remove 10on a trunk allowing all would have to store 4,093 ids — a line no operator would type and no diff would survive — so it points atswitchport trunk allowed vlan <list>.add 30on an all-trunk is already true and says so.except 20gives% Unrecognized "except": this console takes a list (10,20), a range (10-20), "all", "add <list>" or "remove <list>"— never the gluedexcept20. A genuinely malformed numeric list keeps the library's own message.all,no switchport trunk allowed vlan, and the bare command's% Incomplete command.Evidence
test/trunk-allowed-add-remove.test.js, 42 checks: add is the union and remove the difference, each naming what it did; running-config, the port's switchport line,show vlan briefmembership and the engine state are compared after every edit; the printed config line is typed back and proven a no-op; both no-ops and both footguns are checked; the unknown word is quoted as typed; and every pre-existing form is re-asserted word for word.Reverting
engine/cli.jsfails 19/42.Neighbours green:
vlan59,voice-vlan30,show-vlan29,show-argument-refusal77,switchport-mismatch26,interface-door-atomicity12,config-roundtrip46.Docs:
docs/ARCHITECTURE.md§ "A verb eaten by a join, and the token nobody typed".s1(config-if)# switchport trunk allowed vlan add 30 % cannot parse VLAN token "add30" The branch glued the tokens after 'switchport trunk allowed vlan' together with no separator - deliberate, so '10, 20' and '40 - 42' typed with spaces still parsed - and the join also ate the verbs IOS puts in front of a list to edit the one already there. The refusal quoted a token nobody had typed, and the only way to add a VLAN was to retype the whole list from memory: exactly the mistake add/remove exist to prevent. The verb is now read from the token list before anything is glued, and only the list is joined: add 30 -> Trunk on Fa0/1 allows VLANs 10,20,30 (added 30) remove 10 -> Trunk on Fa0/1 allows VLANs 20,30 (removed 10) Four decisions worth keeping: * an edit that changes nothing says so: 'already allows VLANs 10: the list is unchanged (10,20)', and removing a VLAN that was never allowed is refused with the list it left alone; * two footguns are refused, not committed: removing the last VLAN (a trunk carrying nothing), and removing from a trunk that allows all - which would have to store 4,093 ids, a line no operator would type and no diff would survive - so it points at the explicit list instead. Adding to an all-trunk is already true and says so; * a word is named as a word: 'except 20' prints % Unrecognized "except" with the accepted forms, never the glued 'except20'; * everything that worked is untouched: spaced lists and ranges, all, no switchport trunk allowed vlan, the bare command's % Incomplete command. Evidence: test/trunk-allowed-add-remove.test.js, 42 checks; reverting engine/cli.js fails 19. Suite 228 suites, 8565 assertions, 0 failed.