test(ping-default-count): the 'no example still shows four' guard rejects a worked example that types an explicit count #1845

Closed
opened 2026-11-17 12:58:45 +00:00 by jaylouisw · 0 comments
Owner

What

test/ping-default-count.test.js:122 asserts that the substring Sending 4, appears nowhere in docs/CLI.md:

ok(doc.indexOf('Sending 4,') === -1, 'and no example still shows four', '');

The intent (from #1712) is that no worked example still documents four as the default. The assertion is a bare substring test on the whole file, so it also rejects a transcript where the operator typed the count:

r1> ping 10.0.0.10 4
Sending 4, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds:

That example sits in a section whose whole point is the explicit count ('Four echoes are one statement about the path, not four; the count lives in the sentence'), immediately after a ping 10.0.0.99 1 transcript. The two assertions above it still hold: the default example at docs/CLI.md:442 says Sending 5, ... 10.0.1.10, and the prose still names five.

Reproduced

On docs/1117-1216 (6567effe): node test/ping-default-count.test.js -> 17 passed, 1 failed, the single failure being and no example still shows four.

Separately verified the transcript itself against the engine on a two-router lab (r2 Gi0/0/0 shut, ping 10.0.0.10 4 from r1):

Type escape sequence to abort.
Sending 4, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds:
....
Success rate is 0 percent (0/4)
Request timed out (seq 0)
...
% Echoes lost: 4 drops ("peer port shut (r2 Gi0/0/0)" x4)

So the console does quote the reason (it brings its own brackets) and does print r2 when the topology carries that device id. Note for whoever narrows the guard: engine/simulator.js:3168 formats the reason from peerDev.id, so a lab built through the canvas (ids d1/d2) prints d2 Gi0/0/0; the doc's r1/r2 matches the id convention the rest of docs/ already writes.

Ask

Narrow the guard so it keeps its meaning - no example shows four as the default - without rejecting an explicit count. For example, scope it to the default worked example, or require that any Sending 4, line be preceded by a command line carrying an explicit count. Blocks #1840, which is otherwise green on classification, rebase and merge arming.

The test file belongs to the test/CI loop - filing this rather than editing it.

## What `test/ping-default-count.test.js:122` asserts that the substring `Sending 4,` appears nowhere in `docs/CLI.md`: ```js ok(doc.indexOf('Sending 4,') === -1, 'and no example still shows four', ''); ``` The intent (from #1712) is that no worked example still documents **four as the default**. The assertion is a bare substring test on the whole file, so it also rejects a transcript where the operator **typed** the count: ``` r1> ping 10.0.0.10 4 Sending 4, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds: ``` That example sits in a section whose whole point is the explicit count ('Four echoes are one statement about the path, not four; the count lives in the sentence'), immediately after a `ping 10.0.0.99 1` transcript. The two assertions above it still hold: the default example at `docs/CLI.md:442` says `Sending 5, ... 10.0.1.10`, and the prose still names five. ## Reproduced On `docs/1117-1216` (`6567effe`): `node test/ping-default-count.test.js` -> **17 passed, 1 failed**, the single failure being `and no example still shows four`. Separately verified the transcript itself against the engine on a two-router lab (`r2` Gi0/0/0 shut, `ping 10.0.0.10 4` from `r1`): ``` Type escape sequence to abort. Sending 4, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds: .... Success rate is 0 percent (0/4) Request timed out (seq 0) ... % Echoes lost: 4 drops ("peer port shut (r2 Gi0/0/0)" x4) ``` So the console does quote the reason (it brings its own brackets) and does print `r2` when the topology carries that device id. Note for whoever narrows the guard: `engine/simulator.js:3168` formats the reason from `peerDev.id`, so a lab built through the canvas (ids `d1`/`d2`) prints `d2 Gi0/0/0`; the doc's `r1`/`r2` matches the id convention the rest of `docs/` already writes. ## Ask Narrow the guard so it keeps its meaning - no example shows **four as the default** - without rejecting an explicit count. For example, scope it to the default worked example, or require that any `Sending 4,` line be preceded by a command line carrying an explicit count. Blocks #1840, which is otherwise green on classification, rebase and merge arming. The test file belongs to the test/CI loop - filing this rather than editing it.
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#1845
No description provided.