plans: the interface counters can never be zeroed, and the console has no clear counters #1945

Merged
jaylouisw merged 3 commits from plan/1118-0626 into main 2026-11-18 06:34:51 +00:00
Owner

A forward plan, no code. docs/plans/counter-reset.md.

What exists today, with evidence. The per-port tally is portCounters() (engine/flow.js:516), its empty shape emptyPort() (:382), and the copy the API publishes counterSnapshot() (:403 -> server/index.js:404, :1293). The console prints the two lines at engine/cli.js:5914-5915. The only reset that exists is resetFlowState() (engine/flow.js:366), called from server/index.js:1440 when a topology replaces its flow state.

What is missing, ranked. (1) nothing zeroes a tally, so after an ACL fix or a cable move the block mixes both runs - and docs/CLI.md:647 promises counters behave "like real interface counters", the one property they lack; (2) the block that prints the number never says how to zero it, and EXEC_WORDS (engine/cli.js:76-89) has no clear word; (3) no client can zero them.

Steps, each one PR. 1. engine clearPortCounters() that deletes the port row rather than writing emptyPort() (the payload rule at docs/CLI.md:681 is that a port which has counted nothing is absent). 2. clear counters [<port>] in EXEC, port resolved by resolvePortName, plus _help() and docs. 3. the show interfaces block signposts how to zero what it printed. 4. an API route, needs Jay's approval.

Risks. The clear belongs to the topology, not the session (server/index.js:1083), so it is visible to every reader of that lab - documented and pinned. Device totals and port rows will disagree after a clear by design (countDrop() increments both, :538); step 1 documents that instead of recomputing. A real box asks [confirm], and this console has no prompt machinery, so the ack says what it did.

Left out deliberately. Rates and an epoch (the only clock is runAtMs, Infinity unless a run pinned an instant), the MTU/bandwidth header lines (engine/device.js:90 holds mtu and nothing prints or sets it), the [confirm] interaction, and the sibling clear families.

Closes no open issue - the queue is five blocked device requests (#130, #803, #807, #808, #810), none about the console.

A forward plan, no code. `docs/plans/counter-reset.md`. **What exists today, with evidence.** The per-port tally is `portCounters()` (`engine/flow.js:516`), its empty shape `emptyPort()` (`:382`), and the copy the API publishes `counterSnapshot()` (`:403` -> `server/index.js:404`, `:1293`). The console prints the two lines at `engine/cli.js:5914-5915`. The only reset that exists is `resetFlowState()` (`engine/flow.js:366`), called from `server/index.js:1440` when a topology replaces its flow state. **What is missing, ranked.** (1) nothing zeroes a tally, so after an ACL fix or a cable move the block mixes both runs - and `docs/CLI.md:647` promises counters behave "like real interface counters", the one property they lack; (2) the block that prints the number never says how to zero it, and `EXEC_WORDS` (`engine/cli.js:76-89`) has no `clear` word; (3) no client can zero them. **Steps, each one PR.** 1. engine `clearPortCounters()` that *deletes* the port row rather than writing `emptyPort()` (the payload rule at `docs/CLI.md:681` is that a port which has counted nothing is absent). 2. `clear counters [<port>]` in EXEC, port resolved by `resolvePortName`, plus `_help()` and docs. 3. the `show interfaces` block signposts how to zero what it printed. 4. an API route, **needs Jay's approval**. **Risks.** The clear belongs to the topology, not the session (`server/index.js:1083`), so it is visible to every reader of that lab - documented and pinned. Device totals and port rows will disagree after a clear by design (`countDrop()` increments both, `:538`); step 1 documents that instead of recomputing. A real box asks `[confirm]`, and this console has no prompt machinery, so the ack says what it did. **Left out deliberately.** Rates and an epoch (the only clock is `runAtMs`, `Infinity` unless a run pinned an instant), the MTU/bandwidth header lines (`engine/device.js:90` holds `mtu` and nothing prints or sets it), the `[confirm]` interaction, and the sibling clear families. **Closes no open issue** - the queue is five blocked device requests (#130, #803, #807, #808, #810), none about the console.
plans: interface counters can never be zeroed, and the console has no clear counters
All checks were successful
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 3s
CI / Classify the change (pull_request) Successful in 7s
CI / Server smoke test (pull_request) Successful in 7s
CI / Docker build (pull_request) Successful in 19s
CI / Test (Node 20) (pull_request) Successful in 54s
CI / Test (Node 22) (pull_request) Successful in 57s
CI / Test (Node 18) (pull_request) Successful in 1m5s
CI / Arm auto-merge (pull_request) Successful in 17s
a83e0e5e43
A forward plan, no code. Records that the only reset of the per-port tally is
resetFlowState() when a topology is replaced (engine/flow.js:366 via
server/index.js:1440), that EXEC_WORDS (engine/cli.js:76-89) has no `clear`
word, and that docs/CLI.md:647 promises counters behave "like real interface
counters" - the one property they lack. Four steps, each one PR: the engine
delete, the console command, the signpost, and an API route (needs Jay).
Closes no open issue: the queue is five blocked device requests.
jaylouisw force-pushed plan/1118-0626 from a83e0e5e43
All checks were successful
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 3s
CI / Classify the change (pull_request) Successful in 7s
CI / Server smoke test (pull_request) Successful in 7s
CI / Docker build (pull_request) Successful in 19s
CI / Test (Node 20) (pull_request) Successful in 54s
CI / Test (Node 22) (pull_request) Successful in 57s
CI / Test (Node 18) (pull_request) Successful in 1m5s
CI / Arm auto-merge (pull_request) Successful in 17s
to 125743be11
All checks were successful
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 4s
CI / Classify the change (pull_request) Successful in 6s
CI / Test (Node 18) (pull_request) Has been skipped
CI / Test (Node 20) (pull_request) Has been skipped
CI / Test (Node 22) (pull_request) Has been skipped
CI / Server smoke test (pull_request) Has been skipped
CI / Docker build (pull_request) Has been skipped
CI / Arm auto-merge (pull_request) Has been skipped
2026-11-18 06:34:48 +00:00
Compare
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!1945
No description provided.