runtime[].counters has two shapes (drops/ports missing on idle devices) and hands out the engine's live record #1329

Closed
opened 2026-11-10 03:36:27 +00:00 by jaylouisw · 0 comments
Owner

The last block of the state payload built by hand on the way out:

counters: counters[d.id] || {
  bytesIn: 0, bytesOut: 0, packetsIn: 0, packetsOut: 0,
  flowsOpened: 0, flowsRefused: 0
}

Two faults in one line, measured on a CX 6000 with two hosts after a ping:

1. shape for a device that has carried traffic:
   keys: bytesIn,bytesOut,packetsIn,packetsOut,flowsOpened,flowsRefused,drops,ports   (8)
2. shape for a device that has carried nothing:
   keys: bytesIn,bytesOut,packetsIn,packetsOut,flowsOpened,flowsRefused              (6)
   a client reading counters.drops.total on an idle device gets undefined
3. busy === t.flowState.counters.h1 : true
   after writing 999999 to the payload record, the engine says 999999
  • one field, two shapes. The engine's record has drops (with byReason and unported) and ports; the
    fallback had neither. So in the same payload, the device that had done something carried its drop reasons and the
    idle device carried undefined — a client summing drops across a lab read NaN on exactly the devices most likely
    to be quiet, and nothing distinguished "no drops" from "not counted".
  • the payload was the engine's live record. Editing what you were handed edited the tally. Third instance of this
    family after #1323 (link endpoints) and #1325 (layout).

What must be true instead

  • one shape, always: bytesIn/Out, packetsIn/Out, flowsOpened/Refused, drops {total, byReason, unported},
    ports { port -> {packetsIn/Out, bytesIn/Out, transport*, drops} }, and counted;
  • counted separates "nothing has ever crossed this device" from a zero it measured;
  • every level copied, so a consumer cannot write through to the engine;
  • the numbers are the record's numbers, not recomputed by a second rule.

Two distinctions the payload cannot express but a reader needs, so they belong in the docs: the device totals count
transport payload while the port tallies count every frame (a switch that only forwards has port tallies and
zero device packets), and a link state change flushes learned entries (#1256).

The last block of the state payload built by hand on the way out: ```js counters: counters[d.id] || { bytesIn: 0, bytesOut: 0, packetsIn: 0, packetsOut: 0, flowsOpened: 0, flowsRefused: 0 } ``` Two faults in one line, measured on a CX 6000 with two hosts after a ping: ``` 1. shape for a device that has carried traffic: keys: bytesIn,bytesOut,packetsIn,packetsOut,flowsOpened,flowsRefused,drops,ports (8) 2. shape for a device that has carried nothing: keys: bytesIn,bytesOut,packetsIn,packetsOut,flowsOpened,flowsRefused (6) a client reading counters.drops.total on an idle device gets undefined 3. busy === t.flowState.counters.h1 : true after writing 999999 to the payload record, the engine says 999999 ``` * **one field, two shapes.** The engine's record has `drops` (with `byReason` and `unported`) and `ports`; the fallback had neither. So in the same payload, the device that had done something carried its drop reasons and the idle device carried `undefined` — a client summing drops across a lab read NaN on exactly the devices most likely to be quiet, and nothing distinguished "no drops" from "not counted". * **the payload was the engine's live record.** Editing what you were handed edited the tally. Third instance of this family after #1323 (link endpoints) and #1325 (layout). ## What must be true instead * one shape, always: `bytesIn/Out`, `packetsIn/Out`, `flowsOpened/Refused`, `drops {total, byReason, unported}`, `ports { port -> {packetsIn/Out, bytesIn/Out, transport*, drops} }`, and `counted`; * `counted` separates "nothing has ever crossed this device" from a zero it measured; * every level copied, so a consumer cannot write through to the engine; * the numbers are the record's numbers, not recomputed by a second rule. Two distinctions the payload cannot express but a reader needs, so they belong in the docs: the device totals count **transport payload** while the port tallies count **every frame** (a switch that only forwards has port tallies and zero device packets), and a link state change flushes learned entries (#1256).
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#1329
No description provided.