The cable inspector prints the engine's verdict instead of asserting one (#1303) #1304
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!1304
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/cable-verdict"
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?
The cable inspector prints the engine's verdict instead of asserting one.
Fixes #1303.
The lie
For every cable, unconditionally, the inspector said:
Nothing computed that. It was a sentence in the renderer.
And there is a path that produces a cable nobody ever checked:
POST /topologies/:id/loadswaps a whole documentin with no validation at all (
Topology.fromJSON(body), straight into the map). A hand-edited file, or onewritten before a physical-layer rule existed, carried an impossible cable through the UI wearing the same confident
sentence as a good one — while
validateTopology()had the exact answer available and, by its own comment,"nothing but tests ever called it".
Measured: a document whose only cable claims
10gbase-srbetween two Aruba CX 6000 RJ45 ports loads silently. Theengine's verdict it never showed anyone:
A 5 km copper run (
1000BASE-Treaches 100 m) loads the same way.After
server/index.jsrunsvalidateTopology(topo)when it builds a state payload, sostate.verdictscarries{ok, errorCount, warningCount, byLink, issues}— one verdict per cable, filed under the cable that causedit, so a panel with one cable selected does not filter the whole lab on every render;
.verdict.badbox; a good cable says"checked by the engine, not assumed by this panel";
carries the verdict and the UI says
Imported, but 1 cable cannot be usedinstead ofTopology imported;This cable has not been checked, never the reassuring sentence;linkId(a lab-level problem) is not hidden by the per-cable filter, or the panel wouldreport a clean cable inside a broken lab.
Evidence
test/cable-verdict.test.js— 20 checks.Server half, over real HTTP against a spawned server on a scratch data directory (probing readiness with a real
request, not a log line): an empty board still carries a checked verdict object; a good document loads with zero
errors; an impossible one loads with
errorCount 1andE_MEDIA_NOT_SUPPORTED; the state anyone reads afterwardsagrees and files the issue against the cable; and an over-length run is flagged at load time.
Panel half, loading
faceplate.jsthenapp.jsthe wayindex.htmldoes: the old sentence is gone; a goodcable names who checked it; an impossible one is painted as a fault with the engine's message; an over-length run
is reported; an unannotated payload says
not checked; and a lab-level issue reaches a selected cable.With
web/app.jsreverted, 8 of the 20 fail (the old sentence comes back verbatim). Withserver/index.jsreverted, 11 of the 20 fail (no verdicts anywhere).
test/ui-render.test.jsasserted the old sentence — it now asserts the new contract.docs/CONNECTORS.mdexplains that
validateTopology()is called at runtime, and why.Suite: 167 suites, 6,817 assertions, 0 failed.
For every cable, unconditionally, the cable inspector said: "Cages mate and the media is supported at both ends - this cable passed the physical-layer check when it was created. An impossible combination is refused at that moment, not silently accepted." Nothing computed that; it was a sentence in the renderer. And there is a path that produces a cable nobody ever checked: POST /topologies/:id/load swaps a whole document in with no validation at all (Topology.fromJSON(body), straight into the map). A hand-edited file, or one written before a physical-layer rule existed, carried an impossible cable through the UI wearing the same confident sentence as a good one - while validateTopology() had the exact answer available and, by its own comment, "nothing but tests ever called it". Measured: a document whose only cable claims 10gbase-sr between two Aruba CX 6000 RJ45 ports loads silently, and the engine's verdict for it is E_MEDIA_NOT_SUPPORTED, naming both ends and the media that would work. A 5 km copper run (1000BASE-T reaches 100 m) loads the same way. * server/index.js runs validateTopology(topo) when it builds a state payload, so state.verdicts carries {ok, errorCount, warningCount, byLink, issues} - one verdict per cable, filed under the cable that caused it, so a panel with one cable selected does not filter the whole lab on every render; * the inspector prints the engine's message for the selected cable in a red .verdict.bad box, and a good cable says "checked by the engine, not assumed by this panel"; * loading still takes the document as written - an imported lab has to be fixable in place - but the response carries the verdict and the UI says "Imported, but 1 cable cannot be used" instead of "Topology imported"; * a payload with no verdict at all reads "This cable has not been checked", never the reassuring sentence; * an issue with no linkId (a lab-level problem) is not hidden by the per-cable filter, or the panel would report a clean cable inside a broken lab. test/cable-verdict.test.js: 20 checks. The server half runs over real HTTP against a scratch data directory (spawned, probed, killed): an empty board still carries a checked verdict object; a good document loads with zero errors; an impossible one loads with errorCount 1 and E_MEDIA_NOT_SUPPORTED; the state anyone reads afterwards agrees; the issue is filed against the cable; and an over-length run is flagged at load time. The panel half loads faceplate.js then app.js the way index.html does and asserts the old sentence is gone, a good cable names who checked it, an impossible one is painted as a fault with the engine's message, an over-length run is reported, an unannotated payload says "not checked", and a lab-level issue reaches a selected cable. With web/app.js reverted, 8 of the 20 fail (the old sentence comes back verbatim). With server/index.js reverted, 11 of the 20 fail (no verdicts anywhere). test/ui-render.test.js asserted the old sentence; it now asserts the new contract - not checked, and never an assumption. docs/CONNECTORS.md explains that validateTopology() is called at runtime, and why. Suite: 167 suites, 6,817 assertions, 0 failed.