A short line is not a wrong value #1498

Closed
jaylouisw wants to merge 1 commit from fix/short-line into main
Owner

The question

Fifteen commands were asked what they do with no argument at all. Two answered by doing something, and three answered a question nobody had asked.

1. hostname with no name erased the name

Router(config)#hostname core-router
Router(config)#hostname
Router(config)#

No output, and config.hostname became null — a destructive command with no receipt, on the one command whose whole job is the value it just discarded. The only way to find out was to look at a surface that renders the name, and those surfaces render it from the same field.

It now refuses, and says the name is unchanged:

% Incomplete command: hostname <name> (the name is unchanged)

2. description with no text cleared it and reported success

Router(config-if)#description uplink to the core
Description set
Router(config-if)#description
Description set              <- and the description is now gone

A change the receipt did not name. Clearing is no description, so a bare description is refused now, and both directions name what moved:

% Incomplete command: description <text> (use `no description` to clear it)
Description set: uplink to the core
Description removed: uplink to the core
Gi0/0/0 had no description

3. Three commands called a missing value an invalid one

Same shape as ip route flurbish in #1495: the empty string was validated as a value.

typed used to answer now
ip name-server % Invalid name server "": not an IPv4 address % Incomplete command: ip name-server <address>
ipv6 address % Invalid IPv6 address "" % Incomplete command: ipv6 address <address>/<prefix> (or ipv6 address autoconfig)
vrrp 1 ip % Invalid address: (none) % Incomplete command: vrrp <vrid> ip <address>

A genuinely bad value is still quoted back (Invalid name server "flurbish"), so a short line and a wrong value now read differently — which is the whole point.

Two things measured and deliberately left alone

Whitespace is already robust. Labs are pasted, not typed, so every command in the sweep was also run with double spaces, a tab, a leading space, a trailing space, and a mix: 108 variant runs, 0 differences in the answer or the resulting config. Nothing to fix — but it had never been measured, so it is now pinned by a test instead of assumed.

A global command at an interface prompt is applied in global config — deliberately, so a pasted running-config block works without exit lines between blocks (#1230). Leniency by design; what it costs is that the answer does not say where the configuration landed. The reverse direction is refused by name, and where the console knows better it says so:

Router(config)#vrrp 1 ip 10.0.0.254
% vrrp is configured per interface: enter an interface first, e.g. interface Gi0/0

The test pins the leniency so it stays a decision, and pins the reverse refusal so strictness does not spread by accident.

Evidence

test/missing-argument-is-not-a-value.test.js — 29 checks, 29 passed / 0 failed. With the old handler: 13 passed / 16 failed, naming both silent commands, all three empty-string-as-value messages, and the erased hostname.

Docs: docs/CLI.md, new section "A short line is not a wrong value".

Full suite: 246 suites, 9,120 assertions, 0 failed. Syntax 315 files.

## The question Fifteen commands were asked what they do with **no argument at all**. Two answered by doing something, and three answered a question nobody had asked. ## 1. `hostname` with no name erased the name ``` Router(config)#hostname core-router Router(config)#hostname Router(config)# ``` No output, and `config.hostname` became `null` — a destructive command with no receipt, on the one command whose whole job is the value it just discarded. The only way to find out was to look at a surface that renders the name, and those surfaces render it from the same field. It now refuses, and says the name is unchanged: ``` % Incomplete command: hostname <name> (the name is unchanged) ``` ## 2. `description` with no text cleared it and reported success ``` Router(config-if)#description uplink to the core Description set Router(config-if)#description Description set <- and the description is now gone ``` A change the receipt did not name. Clearing is `no description`, so a bare `description` is refused now, and both directions name what moved: ``` % Incomplete command: description <text> (use `no description` to clear it) Description set: uplink to the core Description removed: uplink to the core Gi0/0/0 had no description ``` ## 3. Three commands called a missing value an invalid one Same shape as `ip route flurbish` in #1495: the *empty string* was validated as a value. | typed | used to answer | now | |---|---|---| | `ip name-server` | `% Invalid name server "": not an IPv4 address` | `% Incomplete command: ip name-server <address>` | | `ipv6 address` | `% Invalid IPv6 address ""` | `% Incomplete command: ipv6 address <address>/<prefix> (or `ipv6 address autoconfig`)` | | `vrrp 1 ip` | `% Invalid address: (none)` | `% Incomplete command: vrrp <vrid> ip <address>` | A genuinely bad value is still quoted back (`Invalid name server "flurbish"`), so a short line and a wrong value now read differently — which is the whole point. ## Two things measured and deliberately left alone **Whitespace is already robust.** Labs are pasted, not typed, so every command in the sweep was also run with double spaces, a tab, a leading space, a trailing space, and a mix: **108 variant runs, 0 differences** in the answer or the resulting config. Nothing to fix — but it had never been measured, so it is now pinned by a test instead of assumed. **A global command at an interface prompt is applied in global config** — deliberately, so a pasted running-config block works without `exit` lines between blocks (#1230). Leniency by design; what it costs is that the answer does not say where the configuration landed. The reverse direction is refused by name, and where the console knows better it says so: ``` Router(config)#vrrp 1 ip 10.0.0.254 % vrrp is configured per interface: enter an interface first, e.g. interface Gi0/0 ``` The test pins the leniency so it stays a decision, and pins the reverse refusal so strictness does not spread by accident. ## Evidence `test/missing-argument-is-not-a-value.test.js` — **29 checks, 29 passed / 0 failed**. With the old handler: **13 passed / 16 failed**, naming both silent commands, all three empty-string-as-value messages, and the erased hostname. Docs: `docs/CLI.md`, new section "A short line is not a wrong value". Full suite: 246 suites, 9,120 assertions, 0 failed. Syntax 315 files.
A short line is not a wrong value
Some checks are pending
CI / Test (Node 18) (pull_request) Blocked by required conditions
CI / Test (Node 20) (pull_request) Blocked by required conditions
CI / Test (Node 22) (pull_request) Blocked by required conditions
CI / Server smoke test (pull_request) Blocked by required conditions
CI / Docker build (pull_request) Blocked by required conditions
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 21s
e5fac5dcc5
Fifteen commands were asked what they do with no argument at all (#1497). Two answered by doing something, and
three answered a question nobody had asked:

  hostname       cleared config.hostname to null and printed nothing. A destructive command with no receipt, on
                 the one command whose whole job is the value it had just discarded;
  description    cleared the port's description and answered "Description set" - a change it did not name;
  ip name-server / ipv6 address / vrrp 1 ip    validated the empty string as a value: `% Invalid name server "":
                 not an IPv4 address`, `% Invalid IPv6 address ""`, `% Invalid address: (none)` - so a half-typed
                 line read as a bad value rather than a short one. Same shape as `ip route flurbish` in #1495.

  * engine/cli.js: `hostname` with no name refuses and says the name is unchanged; a bare `description` is refused
    (clearing is `no description`), and both directions now name what moved - "Description set: <text>",
    "Description removed: <text>", "<port> had no description"; the three empty-value doors say Incomplete and
    name the form, while a genuinely bad value is still quoted back.
  * test/missing-argument-is-not-a-value.test.js: 15 bare commands, the two receipts, the three
    missing-not-invalid messages, the whitespace sweep, and the deliberate leniency. 29 checks; old handler
    13 passed / 16 failed.
  * Two measurements, no change: whitespace is already robust (108 variant runs of double spaces, tabs, leading
    and trailing spaces, 0 differences in answer or config) and is now pinned by a test; and a global command at
    an interface prompt is applied in global config on purpose, so a pasted running-config block works without
    `exit` lines between blocks (#1230) - the test pins that too, so it stays a decision.
  * docs/CLI.md: new section "A short line is not a wrong value".

Suite 246 suites, 9120 assertions, 0 failed. Syntax 315 files.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-12 06:55:44 +00:00
Author
Owner

State: green locally; CI is blocked on infrastructure, not on this change.

The full suite passes on this branch (246 suites / 9120 assertions / 0 failed, syntax 315 files) and missing-argument-is-not-a-value is 29/29 (13/16 against the old engine/cli.js).

CI cannot confirm it right now because the Forgejo host ran out of disk during this session:

remote: error: couldn't set 'refs/heads/fix/short-line'
! [remote rejected] (failed to update ref)
POST /contents/... -> 500
Clone: exit status 128 - could not write config file
/data/gitea/data/tmp/local-repo/upload.git.../config: No space left on device

main's own CI has been failing since ~06:32 for the same reason (Test (Node 18/20/22), audit, Classify the change, and the Rebase open PRs workflow all failing on main, which this change does not touch). The push succeeded on a retry, and a branch create/delete probe returned 201/204, so the volume fluctuates rather than being permanently full.

This PR is armed for squash auto-merge and should land once CI can run.

**State: green locally; CI is blocked on infrastructure, not on this change.** The full suite passes on this branch (246 suites / 9120 assertions / 0 failed, syntax 315 files) and `missing-argument-is-not-a-value` is 29/29 (13/16 against the old `engine/cli.js`). CI cannot confirm it right now because the Forgejo host ran out of disk during this session: ``` remote: error: couldn't set 'refs/heads/fix/short-line' ! [remote rejected] (failed to update ref) ``` ``` POST /contents/... -> 500 Clone: exit status 128 - could not write config file /data/gitea/data/tmp/local-repo/upload.git.../config: No space left on device ``` `main`'s own CI has been failing since ~06:32 for the same reason (`Test (Node 18/20/22)`, `audit`, `Classify the change`, and the `Rebase open PRs` workflow all failing on `main`, which this change does not touch). The push succeeded on a retry, and a branch create/delete probe returned 201/204, so the volume fluctuates rather than being permanently full. This PR is armed for squash auto-merge and should land once CI can run.
jaylouisw canceled auto merging this pull request when all checks succeed 2026-11-12 07:24:06 +00:00
jaylouisw closed this pull request 2026-11-12 07:27:03 +00:00
Some checks are pending
CI / Test (Node 18) (pull_request) Blocked by required conditions
CI / Test (Node 20) (pull_request) Blocked by required conditions
CI / Test (Node 22) (pull_request) Blocked by required conditions
CI / Server smoke test (pull_request) Blocked by required conditions
CI / Docker build (pull_request) Blocked by required conditions
CI / Classify the change (pull_request) Successful in 15s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 21s

Pull request closed

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!1498
No description provided.