The per-port counters have no guard, and a drop summary nests its own brackets #1417

Closed
opened 2026-11-11 03:35:13 +00:00 by jaylouisw · 0 comments
Owner

The per-port tally exists in two places: the engine's flow state, which fullState() publishes as runtime[id].counters.ports, and show interfaces, which prints one block per port. Every other pair of surfaces in this codebase that reimplemented one rule has drifted - port state (#1238), PoE (#1293), the routes table (#1301), the switchport sentence (#1291) - and each time the drift was invisible until somebody compared them.

Counters have no guard at all. web/app.js does not read them yet, so an agreement bug here would be found by whoever writes the next table or sparkline, not by us.

While writing that comparison, one rendering defect turned up:

  4 packets input, 200 bytes
  2 packets output, 124 bytes
  2 drops (ACL 101 denied (in) x2)

The reason is prose and it brings its own brackets, printed inside the summary's brackets. The list closes early for a reader treating it as a list, and nests for one who is not.

What should be true

  1. every port the console prints has a payload row whose numbers are the console's numbers (and a port that has counted nothing is either absent from the payload or zero, never absent from the console);
  2. every drop reason the console names appears in drops.byReason with the same count, and no reason is counted that is not printed;
  3. a drop summary is one level deep whatever the reason says, and can be read back into exactly the reasons and counts;
  4. a reason with no brackets is not quoted for nothing.
The per-port tally exists in two places: the engine's flow state, which `fullState()` publishes as `runtime[id].counters.ports`, and `show interfaces`, which prints one block per port. Every other pair of surfaces in this codebase that reimplemented one rule has drifted - port state (#1238), PoE (#1293), the routes table (#1301), the switchport sentence (#1291) - and each time the drift was invisible until somebody compared them. Counters have **no guard at all**. `web/app.js` does not read them yet, so an agreement bug here would be found by whoever writes the next table or sparkline, not by us. While writing that comparison, one rendering defect turned up: ``` 4 packets input, 200 bytes 2 packets output, 124 bytes 2 drops (ACL 101 denied (in) x2) ``` The reason is prose and it brings its own brackets, printed inside the summary's brackets. The list closes early for a reader treating it as a list, and nests for one who is not. ### What should be true 1. every port the console prints has a payload row whose numbers are the console's numbers (and a port that has counted nothing is either absent from the payload or zero, never absent from the console); 2. every drop reason the console names appears in `drops.byReason` with the same count, and no reason is counted that is not printed; 3. a drop summary is one level deep whatever the reason says, and can be read back into exactly the reasons and counts; 4. a reason with no brackets is not quoted for nothing.
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#1417
No description provided.