The log named a mechanism instead of saying what happened #1476
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1476
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/event-legend"
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?
What was wrong
The packet log is the panel whose job is to explain what happened to a frame. Seventeen of the fifty-four event types the engine emits had no legend line, so they fell through to
default: return e.typeand the row read:Not an error, not a blank — a row that names a mechanism instead of saying what happened, in the one place a learner goes to find out. One of the seventeen was added the day before (the
arp-conflictevent in #1473), which is what made the cause obvious: nothing connected the engine's event vocabulary to the legend, so a new_emit({ type: … })was silently a new bare token.What changed
undefinedin the panel meant to explain things, so the test reads each emit site's field list from the engine source and compares. It caught one immediately:flow-resetreade.proto, which that event does not carry — a reset is TCP by definition.dropcolour class instead of passing as ordinary chatter.tap-inject-refusednow carries areasonon the wire, so the log can say why the frame was not re-injected instead of only that it wasn't.__pf.describeEvent, the same way the rest of the UI is exposed for tests.The test that makes it stop happening
test/event-legend.test.jsenumerates the vocabulary fromengine/rather than from a hand-written list: every_emit({ type: … })andevents.push({ type: … })must have a case, no case may describe an event the engine no longer emits, no type may be described twice, and every real emit-site payload must render as a sentence rather than its bare type.The general rule, worth stating once: a view may not display a token it cannot explain. If the engine can emit it, the panel says what it means — and the connection between the two is a test, not a habit.
Neighbours green:
ui-render38,ui-dom-contract19,ui-action-failures13,arp-conflict26,runtime-agreement10,report-sweep21. Syntax 304 files OK. Full suite: 236 suites, 8827 assertions, 0 failed.Reviewer note: the
describeEventswitch is a closure insideweb/app.js, so the test loads the real file in a stub DOM exactly astest/ui-render.test.jsdoes and reads the legend throughwindow.__pf. Nothing in the test restates the vocabulary — delete a legend case and it names the type.The packet log renders every simulation event through one switch, and a type it did not know fell through to `default: return e.type` - so the row read `flow-refused`, or `vrrp`, or `tap`. Not an error, not a blank: a row that names a mechanism instead of saying what happened, in the one place a learner goes to find out. Seventeen of the fifty-four event types were in that state, including the `arp-conflict` event added the day before, which is what showed the cause: nothing connected the engine's event vocabulary to the legend, so a new `_emit({ type: ... })` was silently a new bare token. * app.js: a sentence for all seventeen, carrying what each event really has - a flow names both ends and its number, a VRRP election names the winner and the priority, a NAT refusal names the translation that failed, LLDP names who was discovered and on which port. A case may only read fields its event carries (the test reads each emit site's field list from the engine source, which caught flow-reset reading e.proto it does not have). Duplicate addresses, NAT drops, refused tap injections and refused flows join the existing drop colour class instead of passing as ordinary chatter. The legend is exposed as __pf.describeEvent, as the rest of the UI already is; * simulator.js: tap-inject-refused carries the reason it was refused, so the log can say why rather than only that it was; * test/event-legend.test.js: the vocabulary is enumerated from engine/, not from a hand-written list - every _emit and events.push must have a case, no case may outlive its event, none described twice, and every real emit-site payload must render as a sentence. 18 checks; reverting app.js fails 10 and names all seventeen. A view may not display a token it cannot explain: if the engine can emit it, the panel says what it means, and the connection between them is a test rather than a habit. Neighbours green: ui-render 38, ui-dom-contract 19, ui-action-failures 13, arp-conflict 26, runtime-agreement 10, report-sweep 21. Syntax 304 files OK. Suite 236 suites, 8827 assertions, 0 failed.