? is a keypress in two prompts and a syntax error in the other three; exit at # never leaves # #1503

Closed
opened 2026-11-12 08:30:39 +00:00 by jaylouisw · 1 comment
Owner

What happens

The console prints the mode in its prompt — >, #, (config)#, (config-if)#, (config-dhcp)# — and two keys a technician uses to find their way around only work in some of them.

? is a keypress at > and #, and a syntax error everywhere else

Router>?                 -> the whole index
Router#?                 -> the whole index
Router(config)#?         -> % Unrecognized config command: ?
Router(config-if)#?      -> % Unrecognized interface command: ?
Router(config-dhcp)#?    -> the interface-mode error path

The one key that means "I do not know what I can type here" is reported as though the key itself were a typo. The index already labels every row with the mode it belongs in ((config mode), (interface mode), (in a dhcp pool)), so the same list is the right answer in all five prompts.

exit at # does nothing

Router#exit
Router#                  <- and again, and again

Exec and privileged EXEC share one dispatcher, and only exit at > is handled (as a no-op, because there is no login to leave). One level up from # is >, which this console always has underneath.

What changes

  • engine/cli.js: _configMode, _ifaceMode and _dhcpPoolMode answer help / ? with the index before anything else; exit at MODE_ENABLE demotes to MODE_EXEC, so the ladder (config-if)# → (config)# → # → > is continuous and each step is one exit.
  • docs/CLI.md § ? is a keypress in every prompt, and exit walks one level at a time.

Not changed: a word the console does not know is still reported in every mode (% Unrecognized config command: flurbish) — the fix is the two help keys and one level, not a general amnesty.

Verification

test/help-key-works-in-every-prompt.test.js, nine checks: the index from ? and from help at all five prompts, the prompt unchanged afterwards, a command still working after asking for help, the full exit ladder, and the unknown-word reports in three modes. With the old handler: 4 passed / 5 failed. With this change: 9/9.

Full suite 249 suites / 9144 assertions / 0 failed; syntax 319 files; help-completeness 8/8, config-undo 48/48, skip-audit 15/15.

Also verified by hand this iteration

The CI steps that never ran for #1500/#1502 because the queue is wedged — run locally on the same tree: check-dockerfile ✓, examples/build-examples.js ✓ (all four labs, ping OK), missing-devices.js examples --no-issues ✓ (CI gate passed), check-control-bytes ✓, check-node-surface ✓, smoke-http.js ✓ (all API checks clean).

## What happens The console prints the mode in its prompt — `>`, `#`, `(config)#`, `(config-if)#`, `(config-dhcp)#` — and two keys a technician uses to find their way around only work in some of them. ### `?` is a keypress at `>` and `#`, and a syntax error everywhere else ``` Router>? -> the whole index Router#? -> the whole index Router(config)#? -> % Unrecognized config command: ? Router(config-if)#? -> % Unrecognized interface command: ? Router(config-dhcp)#? -> the interface-mode error path ``` The one key that means "I do not know what I can type here" is reported as though the key itself were a typo. The index already labels every row with the mode it belongs in (`(config mode)`, `(interface mode)`, `(in a dhcp pool)`), so the same list is the right answer in all five prompts. ### `exit` at `#` does nothing ``` Router#exit Router# <- and again, and again ``` Exec and privileged EXEC share one dispatcher, and only `exit` at `>` is handled (as a no-op, because there is no login to leave). One level up from `#` is `>`, which this console always has underneath. ## What changes - `engine/cli.js`: `_configMode`, `_ifaceMode` and `_dhcpPoolMode` answer `help` / `?` with the index before anything else; `exit` at `MODE_ENABLE` demotes to `MODE_EXEC`, so the ladder `(config-if)#` → `(config)#` → `#` → `>` is continuous and each step is one `exit`. - `docs/CLI.md` § *`?` is a keypress in every prompt, and `exit` walks one level at a time*. Not changed: a word the console does not know is still reported in every mode (`% Unrecognized config command: flurbish`) — the fix is the two help keys and one level, not a general amnesty. ## Verification `test/help-key-works-in-every-prompt.test.js`, nine checks: the index from `?` and from `help` at all five prompts, the prompt unchanged afterwards, a command still working after asking for help, the full `exit` ladder, and the unknown-word reports in three modes. With the old handler: **4 passed / 5 failed**. With this change: 9/9. Full suite **249 suites / 9144 assertions / 0 failed**; syntax 319 files; `help-completeness` 8/8, `config-undo` 48/48, `skip-audit` 15/15. ## Also verified by hand this iteration The CI steps that never ran for #1500/#1502 because the queue is wedged — run locally on the same tree: `check-dockerfile` ✓, `examples/build-examples.js` ✓ (all four labs, ping OK), `missing-devices.js examples --no-issues` ✓ (CI gate passed), `check-control-bytes` ✓, `check-node-surface` ✓, `smoke-http.js` ✓ (all API checks clean).
Author
Owner

Landed on main as 1b1e1287. Verified on the merge commit: help-key-works-in-every-prompt 9/9, help-completeness 8/8, config-undo 48/48, tree clean (the full suite was 248 suites / 9137 assertions / 0 failed on the branch, and 249 / 9144 / 0 with #1502's suite rebased on top).

The merge went through on the first attempt — mergeable was true, so the volume had a free window. #1502 is still stuck: mergeable reads false and a force-push of its rebased head was rejected with failed to update ref, which is the same disk pressure in a different place.

Landed on `main` as **`1b1e1287`**. Verified on the merge commit: `help-key-works-in-every-prompt` 9/9, `help-completeness` 8/8, `config-undo` 48/48, tree clean (the full suite was **248 suites / 9137 assertions / 0 failed** on the branch, and **249 / 9144 / 0** with #1502's suite rebased on top). The merge went through on the first attempt — `mergeable` was `true`, so the volume had a free window. #1502 is still stuck: `mergeable` reads `false` and a force-push of its rebased head was rejected with `failed to update ref`, which is the same disk pressure in a different place.
Sign in to join this conversation.
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#1503
No description provided.