The inspector's Routes table reads the same annotated rows as show ip route (#1301) #1302

Merged
jaylouisw merged 1 commit from fix/routes-agreement into main 2026-11-10 00:05:20 +00:00
Owner

The inspector's Routes table reads the same annotated rows as show ip route.

Fixes #1301.

The defect

The console was taught (#1234, #1271) to print four things about a route that the panel did not: the code the
table actually installs (S* for the gateway of last resort), the administrative distance that decides which
route wins, is directly connected, Gi0/0 instead of via -, and — the one that mattered — the sentence saying
a row cannot carry a packet.

The panel printed code | dest/len | gw straight out of runtime state. On a router whose only uplink was down:

R1#show ip route
C   10.1.2.0       /24  is directly connected, Gi0/0  (down: link down)
S  0.0.0.0        /0  [1/0] via 10.1.2.1  (down: link down)
S  192.168.5.0    /24  [1/0] via 10.1.2.1  (down: link down)

…and the panel drew three healthy-looking rows — on the one screen an operator has open while the link is
broken. The drop that follows says "no ARP reply from X", which sends them looking for a host instead of at the
wire.

After

The verdict is computed once, in Device.routesTable(topo), which annotates every row with displayCode,
distance, note and unusable; show ip route and the panel read the same fields rather than keeping two
opinions. Device.routeDistance() moves the distance table into the engine, where the console's "Gateway of last
resort" sort and the panel's column both read it.

  • the panel shows the same code (S*), the same distance ([254/0]), is directly connected, Gi0/0, and the
    same sentence, with the row dimmed and the reason in red (.route-dead / .route-note);
  • the interface-only-static caveat stays a caveat — no next hop: ARP for the destination on that segment — and
    the row stays usable, because it does carry a packet where the far side proxies ARP;
  • routesTable() called without a topology returns checked: false, claims neither health nor fault, and the
    panel prints (not checked) — #1299's lesson: a surface must not report "fine" because nobody looked;
  • server/index.js passes the topology, so the verdict is computed against live cable state.

Evidence

test/routes-agreement.test.js — 19 checks over nine situations: no routes, connected only, static default, a
configured gateway competing with a static default, interface-only static, OSPF/BGP-learned, link down, peer shut,
local port shut.

  • rows compared as a multiset of code|prefix|distance|note — two rows can legitimately share 0.0.0.0/0 — so a
    dropped, duplicated or re-worded row fails;
  • every interface the console names must appear on the matching panel row;
  • every dead row must be marked and no healthy row may be (no crying wolf);
  • the reported case in its own words; S* vs S with distances 254 and 1; an unannotated payload saying
    (not checked); and the distance table asserted through its exported function.

With engine/device.js reverted, 11 of the 19 fail — the reported case among them, reporting all three routes
as usable with no note.

docs/CLI.md: the inspector's table described as the same table. docs/LINK-STATE.md: the panel added to the
callers of the route-liveness rule.

Suite: 166 suites, 6,796 assertions, 0 failed.

The inspector's Routes table reads the same annotated rows as `show ip route`. Fixes #1301. ## The defect The console was taught (#1234, #1271) to print four things about a route that the panel did not: the code the table actually installs (`S*` for the gateway of last resort), the administrative distance that decides which route wins, `is directly connected, Gi0/0` instead of `via -`, and — the one that mattered — the sentence saying a row cannot carry a packet. The panel printed `code | dest/len | gw` straight out of runtime state. On a router whose only uplink was down: ``` R1#show ip route C 10.1.2.0 /24 is directly connected, Gi0/0 (down: link down) S 0.0.0.0 /0 [1/0] via 10.1.2.1 (down: link down) S 192.168.5.0 /24 [1/0] via 10.1.2.1 (down: link down) ``` …and the panel drew three healthy-looking rows — on the one screen an operator has open while the link is broken. The drop that follows says "no ARP reply from X", which sends them looking for a host instead of at the wire. ## After The verdict is computed **once**, in `Device.routesTable(topo)`, which annotates every row with `displayCode`, `distance`, `note` and `unusable`; `show ip route` and the panel read the same fields rather than keeping two opinions. `Device.routeDistance()` moves the distance table into the engine, where the console's "Gateway of last resort" sort and the panel's column both read it. * the panel shows the same code (`S*`), the same distance (`[254/0]`), `is directly connected, Gi0/0`, and the same sentence, with the row dimmed and the reason in red (`.route-dead` / `.route-note`); * the interface-only-static caveat stays a caveat — `no next hop: ARP for the destination on that segment` — and the row stays usable, because it does carry a packet where the far side proxies ARP; * `routesTable()` called **without** a topology returns `checked: false`, claims neither health nor fault, and the panel prints `(not checked)` — #1299's lesson: a surface must not report "fine" because nobody looked; * `server/index.js` passes the topology, so the verdict is computed against live cable state. ## Evidence `test/routes-agreement.test.js` — 19 checks over nine situations: no routes, connected only, static default, a configured gateway competing with a static default, interface-only static, OSPF/BGP-learned, link down, peer shut, local port shut. * rows compared as a multiset of `code|prefix|distance|note` — two rows can legitimately share `0.0.0.0/0` — so a dropped, duplicated or re-worded row fails; * every interface the console names must appear on the matching panel row; * every dead row must be marked and **no healthy row may be** (no crying wolf); * the reported case in its own words; `S*` vs `S` with distances 254 and 1; an unannotated payload saying `(not checked)`; and the distance table asserted through its exported function. With `engine/device.js` reverted, **11 of the 19 fail** — the reported case among them, reporting all three routes as usable with no note. `docs/CLI.md`: the inspector's table described as the same table. `docs/LINK-STATE.md`: the panel added to the callers of the route-liveness rule. Suite: 166 suites, 6,796 assertions, 0 failed.
The Routes table in the inspector reads the same annotated rows as show ip route (#1301)
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 16s
CI / Test (Node 20) (pull_request) Successful in 2m20s
CI / Test (Node 18) (pull_request) Successful in 2m26s
CI / Server smoke test (pull_request) Successful in 36s
CI / Docker build (pull_request) Successful in 44s
CI / Test (Node 22) (pull_request) Successful in 2m3s
767f6d147b
The console was taught (#1234, #1271) to print four things about a route that the panel did not: the code the
table actually installs (S* for the gateway of last resort), the administrative distance that decides which route
wins, `is directly connected, Gi0/0` instead of `via -`, and - the one that mattered - the sentence saying a row
cannot carry a packet.

The panel printed `code | dest/len | gw` straight out of runtime state. On a router whose only uplink was down:

  R1#show ip route
  C   10.1.2.0       /24  is directly connected, Gi0/0  (down: link down)
  S  0.0.0.0        /0  [1/0] via 10.1.2.1  (down: link down)
  S  192.168.5.0    /24  [1/0] via 10.1.2.1  (down: link down)

...the panel drew three healthy-looking rows - on the one screen an operator has open while the link is broken.
The drop that follows says "no ARP reply from X", which sends them looking for a host instead of at the wire.

Now the verdict is computed once, in Device.routesTable(topo), which annotates every row with displayCode,
distance, note and unusable; `show ip route` and the panel read the same fields rather than keeping two opinions.
Device.routeDistance() moves the distance table into the engine, where the console's "Gateway of last resort" sort
and the panel's column both read it.

  * the panel shows the same code (S*), the same distance ([254/0]), `is directly connected, Gi0/0`, and the same
    sentence, with the row dimmed and the reason in red (.route-dead / .route-note);
  * the interface-only-static caveat stays a caveat - `no next hop: ARP for the destination on that segment` -
    and the row stays usable, because it does carry a packet where the far side proxies ARP;
  * routesTable() called without a topology returns checked:false, claims neither health nor fault, and the panel
    prints `(not checked)`: a surface must not report "fine" because nobody looked (#1299's lesson).
  * server/index.js passes the topology, so the verdict is computed against the live cable state.

test/routes-agreement.test.js: 19 checks over nine situations - no routes, connected only, static default,
a configured gateway competing with a static default, interface-only static, OSPF/BGP-learned, link down, peer
shut, local port shut. Rows are compared as a multiset of code|prefix|distance|note (two rows can legitimately
share 0.0.0.0/0), plus: every interface the console names appears on the panel row, every dead row is marked and
no healthy row is, the reported case in its own words, S* vs S with distances 254 and 1, an unannotated payload
saying "not checked", and the distance table asserted through its exported function.

With engine/device.js reverted, 11 of the 19 fail - the reported case among them, reporting all three routes as
usable with no note.

docs/CLI.md: the inspector's table is described as the same table. docs/LINK-STATE.md: the panel added to the
callers of the route-liveness rule.

Suite: 166 suites, 6,796 assertions, 0 failed.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-10 00:05:17 +00:00
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!1302
No description provided.