ping knew why the echo was lost and printed "Request timed out" #1485

Closed
opened 2026-11-12 04:58:52 +00:00 by jaylouisw · 1 comment
Owner

The symptom

ping is the first command anyone types in a lab, and the one that most often fails. On a lab where the router's port is shut:

r1> ping 10.0.0.10 1
Type escape sequence to abort.
Sending 1, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds:
.
Success rate is 0 percent (0/1)
Request timed out (seq 0)

That is everything the console says. This is everything the engine knew, and returned:

replies: [{ seq: 0, success: false, reason: "peer port shut (R1 Gi0/0/0)" }]

Simulator.ping() has recorded a reason for every lost echo since #1431 ranked the causes by earliness — no route to 10.0.0.99, no ARP reply from 10.91.0.10, peer port shut (R1 Gi0/0/0), ACL 101 denied (in). _pingReplyLines() printed the timeout and threw the reason away.

So the most-used command in the simulator answered something went wrong to the question what went wrong — for exactly the beginner mistakes a simulator exists to teach: no address, no route, cable down, VLAN not allowed.

What was actually wrong

Not a missing fact. A missing sentence. The engine computed the reason, carried it in the answer, and the surface that a person reads dropped it. Same species as #1475 (the packet log printing flow-close instead of which flow ended) and #1473 (one ARP row where two boxes had answered): the model was right and the translation layer was silent, which is the hardest kind to notice because a plausible-looking line hides a missing one.

What changed

pingLossSentence() in engine/simulator.js counts the lost echoes by the reason already recorded, and hands them to dropsSentence() — the N drops (reasons) phrasing show interfaces has used since #1417, lifted out of cli.js into the engine so the two callers reach one function instead of two copies:

% Echoes lost: 4 drops (peer port shut (R1 Gi0/0/0) x4)
% Echoes lost: 1 drop (no ARP reply from 10.91.0.10)

Longest reason first, xN for a repeat, reasons past the third counted rather than hidden, and a reason carrying its own brackets (ACL 101 denied (in)) quoted — a reason printed inside the summary's brackets nests for a reader and closes the list early for a parser, which is what #1417 fixed one layer up.

The browser's Simulate dialog draws the same sentence from a mirror of the rule, next to the success rate.

Three deliberate silences, each a rule rather than an omission:

  • converging is not loss — a settling path keeps its own % Still converging: stp on s1 (ready at 30000 ms) and gets no loss line, no 0%;
  • no reason, no sentence — a failure the engine cannot attribute prints nothing beyond the timeout line; inventing a cause to look complete is the defect;
  • one line per command, not per echo — four lost echoes are one statement about the path, so the count lives in the sentence.

Evidence

test/ping-loss-reason.test.js, 32 checks:

with the fix:    32 passed, 0 failed
fix stashed:      7 passed, 25 failed   (naming the bare-timeout console output)

It covers: the reason appears verbatim and after the per-echo lines in the console's % voice; a four-echo failure produces one line and still four timeout lines; a shut port is named with its brackets quoted; a device with no address at all explains itself; a converged path gets no loss line; a reasonless failure and a blank reason invent nothing; show interfaces still reaches the phrasing through one function (asserted against the source, so a copy would fail); and the console and browser agree on ten cases including bracketed reasons, five distinct reasons, mixed success/loss, converging and empty.

Docs: docs/CLI.md new ### Why an echo never came back (before/after transcripts, the phrasing rules, the three silences); docs/ARCHITECTURE.md new ### The command that knew why and said "timed out".

Adding the helpers moved three citations in the docs by 41 lines — ethFrame(), openFlow(), _deliver() — so the numbers were moved with the code and now land exactly on the definitions their sentences name; npm run check:citations is back to its single documented false positive.

Full suite: 239 suites, 8880 assertions, 0 failed. Syntax 308 files OK.

## The symptom `ping` is the first command anyone types in a lab, and the one that most often fails. On a lab where the router's port is shut: ``` r1> ping 10.0.0.10 1 Type escape sequence to abort. Sending 1, 100-byte ICMP Echos to 10.0.0.10, timeout is 2 seconds: . Success rate is 0 percent (0/1) Request timed out (seq 0) ``` That is everything the console says. This is everything the engine knew, and returned: ``` replies: [{ seq: 0, success: false, reason: "peer port shut (R1 Gi0/0/0)" }] ``` `Simulator.ping()` has recorded a reason for every lost echo since #1431 ranked the causes by earliness — `no route to 10.0.0.99`, `no ARP reply from 10.91.0.10`, `peer port shut (R1 Gi0/0/0)`, `ACL 101 denied (in)`. `_pingReplyLines()` printed the timeout and threw the reason away. So the most-used command in the simulator answered *something went wrong* to the question *what went wrong* — for exactly the beginner mistakes a simulator exists to teach: no address, no route, cable down, VLAN not allowed. ## What was actually wrong Not a missing fact. A missing **sentence**. The engine computed the reason, carried it in the answer, and the surface that a person reads dropped it. Same species as #1475 (the packet log printing `flow-close` instead of which flow ended) and #1473 (one ARP row where two boxes had answered): the model was right and the translation layer was silent, which is the hardest kind to notice because a plausible-looking line hides a missing one. ## What changed `pingLossSentence()` in `engine/simulator.js` counts the lost echoes by the reason already recorded, and hands them to `dropsSentence()` — the `N drops (reasons)` phrasing `show interfaces` has used since #1417, lifted out of `cli.js` into the engine so the two callers reach **one function instead of two copies**: ``` % Echoes lost: 4 drops (peer port shut (R1 Gi0/0/0) x4) % Echoes lost: 1 drop (no ARP reply from 10.91.0.10) ``` Longest reason first, `xN` for a repeat, reasons past the third counted rather than hidden, and a reason carrying its own brackets (`ACL 101 denied (in)`) quoted — a reason printed inside the summary's brackets nests for a reader and closes the list early for a parser, which is what #1417 fixed one layer up. The browser's Simulate dialog draws the same sentence from a mirror of the rule, next to the success rate. Three deliberate silences, each a rule rather than an omission: * **converging is not loss** — a settling path keeps its own `% Still converging: stp on s1 (ready at 30000 ms)` and gets no loss line, no `0%`; * **no reason, no sentence** — a failure the engine cannot attribute prints nothing beyond the timeout line; inventing a cause to look complete is the defect; * **one line per command, not per echo** — four lost echoes are one statement about the path, so the count lives in the sentence. ## Evidence `test/ping-loss-reason.test.js`, 32 checks: ``` with the fix: 32 passed, 0 failed fix stashed: 7 passed, 25 failed (naming the bare-timeout console output) ``` It covers: the reason appears verbatim and after the per-echo lines in the console's `%` voice; a four-echo failure produces one line and still four timeout lines; a shut port is named with its brackets quoted; a device with no address at all explains itself; a converged path gets no loss line; a reasonless failure and a blank reason invent nothing; `show interfaces` still reaches the phrasing through one function (asserted against the source, so a copy would fail); and the console and browser agree on ten cases including bracketed reasons, five distinct reasons, mixed success/loss, converging and empty. Docs: `docs/CLI.md` new `### Why an echo never came back` (before/after transcripts, the phrasing rules, the three silences); `docs/ARCHITECTURE.md` new `### The command that knew why and said "timed out"`. Adding the helpers moved three citations in the docs by 41 lines — `ethFrame()`, `openFlow()`, `_deliver()` — so the numbers were moved with the code and now land exactly on the definitions their sentences name; `npm run check:citations` is back to its single documented false positive. Full suite: 239 suites, 8880 assertions, 0 failed. Syntax 308 files OK.
Author
Owner

Landed as #1486 (c28b1d4c). Post-merge on main: ping-loss-reason 32, ping-reason-first-cause still green (the reason ranking this builds on), ping-convergence still green (convergence and loss stay separate sentences), show-interfaces still green (the shared dropsSentence() phrasing did not change), tree clean.

One correction made while landing: the code comments first cited #1483, which turned out to be an unrelated open request for serial WAN links. They now cite this issue (#1485), and the branch was force-pushed before the merge rather than leaving five comments pointing at someone else's feature.

Landed as #1486 (`c28b1d4c`). Post-merge on `main`: `ping-loss-reason` 32, `ping-reason-first-cause` still green (the reason ranking this builds on), `ping-convergence` still green (convergence and loss stay separate sentences), `show-interfaces` still green (the shared `dropsSentence()` phrasing did not change), tree clean. One correction made while landing: the code comments first cited `#1483`, which turned out to be an unrelated open request for serial WAN links. They now cite this issue (#1485), and the branch was force-pushed before the merge rather than leaving five comments pointing at someone else's feature.
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#1485
No description provided.