cli: the help key is not a name - hostname ?, dns zone ? and vlan <id> name ? refuse it (#1685) #1686

Merged
jaylouisw merged 1 commit from fix/1116-1606 into main 2026-11-16 16:14:22 +00:00
Owner

Fixes #1685.

Three commands take free text, and in all three the console's own help key was stored as the text:

typed answered state change
hostname ? (nothing) the box renamed to ?
dns zone ? DNS zone ? ready a zone named ? created
vlan 42 name ? VLAN 42 created (name: ?) VLAN 42 created and named ?

Every typed position already refuses the key by quoting it (% Invalid VLAN id "?"); a name takes any string, so the key became the name. The fix is one helper, _helpKeyRefusal(), at three call sites: the value is refused by name, with the syntax that wanted one, before anything is created.

Unchanged and pinned: a bare hostname is still % Incomplete command (#1497), and a question mark inside a longer name (hostname edge?1) is still part of the name - only the whole value is the key.

Evidence

node test/help-key-is-not-a-value.test.js   23 passed, 0 failed
node scripts/run-tests.js                   283 suite(s) - 10108 assertions passed, 0 failed
node scripts/syntax-check.js                Syntax-checked 354 files: all OK
node scripts/audit-port-types.js            No port contradicts its declared type.
node scripts/check-control-bytes.js         No control bytes in source.

test/help-key-is-not-a-value.test.js is the reproduction: 17 of its assertions failed before the change (the three mutations and the receipts that announced them), and it keeps all 23 after it.

Fixes #1685. Three commands take free text, and in all three the console's own help key was stored as the text: | typed | answered | state change | |---|---|---| | `hostname ?` | *(nothing)* | the box renamed to `?` | | `dns zone ?` | `DNS zone ? ready` | a zone named `?` created | | `vlan 42 name ?` | `VLAN 42 created (name: ?)` | VLAN 42 created and named `?` | Every typed position already refuses the key by quoting it (`% Invalid VLAN id "?"`); a name takes any string, so the key became the name. The fix is one helper, `_helpKeyRefusal()`, at three call sites: the value is refused by name, with the syntax that wanted one, before anything is created. Unchanged and pinned: a bare `hostname` is still `% Incomplete command` (#1497), and a question mark inside a longer name (`hostname edge?1`) is still part of the name - only the whole value is the key. ## Evidence ``` node test/help-key-is-not-a-value.test.js 23 passed, 0 failed node scripts/run-tests.js 283 suite(s) - 10108 assertions passed, 0 failed node scripts/syntax-check.js Syntax-checked 354 files: all OK node scripts/audit-port-types.js No port contradicts its declared type. node scripts/check-control-bytes.js No control bytes in source. ``` `test/help-key-is-not-a-value.test.js` is the reproduction: 17 of its assertions failed before the change (the three mutations and the receipts that announced them), and it keeps all 23 after it.
cli: the help key is not a name - hostname ?, dns zone ? and vlan <id> name ? refuse it (#1685)
All checks were successful
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 20s
CI / Server smoke test (pull_request) Successful in 24s
CI / Docker build (pull_request) Successful in 33s
CI / Test (Node 18) (pull_request) Successful in 1m12s
CI / Test (Node 20) (pull_request) Successful in 1m19s
CI / Test (Node 22) (pull_request) Successful in 1m28s
6141938a68
In the three positions that take free text, `?` - the key an operator presses to ask what goes here - was stored as the text: `hostname ?` renamed the box to "?" and printed nothing, `dns zone ?` answered "DNS zone ? ready" and wrote `dns zone ?` into the running-config, and `vlan 42 name ?` created VLAN 42 named "?". Every typed position already refuses the key by quoting it; a name takes any string, so the key became the name.

One helper, three call sites: the value is refused by name, with the syntax that wanted one, before anything is created. A bare `hostname` is still an incomplete command (#1497) and a `?` inside a longer name (`edge?1`) is still part of the name.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-16 16:14:09 +00:00
jaylouisw force-pushed fix/1116-1606 from 6141938a68
All checks were successful
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 20s
CI / Server smoke test (pull_request) Successful in 24s
CI / Docker build (pull_request) Successful in 33s
CI / Test (Node 18) (pull_request) Successful in 1m12s
CI / Test (Node 20) (pull_request) Successful in 1m19s
CI / Test (Node 22) (pull_request) Successful in 1m28s
to ec62046824
All checks were successful
CI / Classify the change (pull_request) Successful in 13s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 13s
CI / Test (Node 18) (pull_request) Has been skipped
CI / Test (Node 20) (pull_request) Has been skipped
CI / Test (Node 22) (pull_request) Has been skipped
CI / Server smoke test (pull_request) Has been skipped
CI / Docker build (pull_request) Has been skipped
2026-11-16 16:14:12 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1686
No description provided.