A show describes an instant, not a cache (#1360) #1361
No reviewers
Labels
No labels
blocked-on-build
bug
device
device-request
enhancement
from-github
needs-datasheet
needs-info
needs-triage
ready-for-agent
ready-for-human
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1361
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/show-instant"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A show describes an instant, not a cache.
Fixes #1360.
show ip routeprinted whatever the lastcomputeOspf()happened to leave on the device. The control planes areresults —
computeStp(),computeVrrp(),computeOspf(),computeBgp()each write conclusions onto the devicesand each honours
runAtMs— but the console never asked them.Measured on two ISR 4331s with a segment behind each, OSPF on all four interfaces:
(no O routes)on a fully converged lab — the routesonly appear if a
pingor a load ran the OSPF computation first.11000 ms. The same question, asked twice, answers differently.
Same family as
dev.stpin #1336 — the console reading a cache instead of the model.Fixes
CliSession._refreshControlPlane()runs the control planes at the instant the session is standing at, before_show()produces output — the same four computations the packet path already runs before it sends anything. It is
config-guarded: only processes the device is configured to run are recomputed, because recomputing an unconfigured
process does not give the same answer twice — it erases the device's learned routes. A
showmay compute; it mustnot destroy. That guard is not theoretical: the first version recomputed unconditionally and
test/routes-agreement.test.jscaught it, a fixture-installedospfRoutescoming back as one prefix instead of four.Evidence
test/control-plane-instant.test.js— 12 checks. A settled lab'sshow ip routelists the OSPF route to the farsegment; at 5000 ms it does not; at 20000 ms it is back and identical. Five questions asked in the order
settled/early/settled/early/late give the same answers as asked alone, in both directions.
show vrrpsays theelection is pending at 1000 ms and not at 20000, and asking again gives the same answer. Asking does not rewrite the
configuration, and every row still carries its distance or says it is directly connected.
With
engine/cli.jsreverted, 3 of the 12 fail:(none)on a settled lab, andshow vrrpreporting an electionresult before the election could have settled.
(The spanning-tree case from #1336 is guarded in
test/console-over-http.test.js, on a switch — a router runs no STP.)docs/ARCHITECTURE.md: "A show describes an instant, not a cache".Suite: 184 suites, 7,127 assertions, 0 failed.
`show ip route` printed whatever the last computeOspf() happened to leave on the device. The control planes are results - computeStp(), computeVrrp(), computeOspf() and computeBgp() each write conclusions onto the devices and each honours runAtMs - but the console never asked them, so: * a console with no run behind it reported "(no O routes)" on a lab that was fully converged. The routes only appear if something (a ping, a load) ran the OSPF computation first; * the answer to the same question depended on which run happened BEFORE it: show ip route at instant 5000 could print routes installed by a settled run 20000 ms later. Measured on two ISR 4331s with a segment behind each, OSPF configured on all four interfaces: fresh console, show ip route, no run behind it, settled lab -> (none) same, after computeOspf() at Infinity -> O 192.168.2.0/24 via 10.0.0.2 computeOspf() at 5000 (OSPF converges at 16000) -> (none) So the computation was right and the command never ran it. Fixes: CliSession._refreshControlPlane() runs the control planes at the instant the session is standing at, before _show() produces any output - the same four computations the packet path already runs before it sends anything. It is config-guarded: only the processes the device is configured to run are recomputed, because recomputing an unconfigured process does not give the same answer twice - it ERASES the device's learned routes. A show may compute; it must not destroy. That guard is not theoretical: the first version recomputed unconditionally and test/ routes-agreement.test.js caught it, with a device whose ospfRoutes had been installed by its fixture coming back with one prefix instead of four. test/control-plane-instant.test.js: 12 checks. A settled lab's show ip route lists the OSPF route to the far segment, at 5000 ms it does not, at 20000 ms it is back and identical; five questions asked in the order settled/early/settled/ early/late give the same answers as asked alone, in both directions; show vrrp says the election is pending at 1000 ms and not at 20000, and asking again gives the same answer; asking does not rewrite the configuration and every row still carries its distance or says it is directly connected. With engine/cli.js reverted, 3 of the 12 fail: "(none)" on a settled lab, and show vrrp reporting an election result before the election could have settled. (The spanning-tree case from #1336 is guarded in test/console-over-http.test.js, on a switch; a router runs no STP.) docs/ARCHITECTURE.md: "A show describes an instant, not a cache". Suite: 184 suites, 7,127 assertions, 0 failed.jaylouisw referenced this pull request2026-11-10 12:04:19 +00:00
ecaf28d39477585356d5