a cable whose port name needs the resolver is restored, not dropped #1529
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!1529
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/1519-topology-silent-link-loss"
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?
Fixes #1519
First: what the reproduction actually shows
The reproduction does not reproduce as written, and two of its premises are stale. Saying so before the fix, because a fix for a bug I could not see is a guess:
GigabitEthernet1/0/1written exactly does not throw. At1b1e1287, a two-device document whose link names the port exactly as the catalogue spells it loads with 1 link and no issues:exact spelling : devices=2 links=1 issues=0,link l1 d1/GigabitEthernet1/0/25 -- d2/GigabitEthernet1/0/25 peerSet=true/true.fromJSONis not silent, and has not been since #1323. A cable that cannot be rebuilt already lands inloadIssues- one entry per cable, with the link id - and every state payload publishes it. The barecatchattopology.js:607-611is gone;engine/topology.jsis 907 lines, not 8,000.engine/cli.jsno longer holds a copy of the naming rules: since #40/#1247 it importsresolvePortName/portKeyfromengine/iface-name.js, andtest/iface-name-agreement.test.jsfails the moment a copy comes back.cli.js:232/cli.js:14085do not exist (cli.jsis 4,367 lines). There is already one resolver, and I did not add a fourth.What is real, and reproduces, is the strictness the issue is about - sitting in the wrong function.
connect()resolves names; the loader's pre-checkcableProblem()askeddev.interfaces.has(end.iface), an exact map lookup. So the gate in front ofconnect()was stricter thanconnect(), and a document whose port names need the resolver lost every cable, with a report claiming the port did not exist.ether1on a device whose port iseth1is exactly the case #39 introduced the resolver for.Before the fix (
1b1e1287)MikroTik CCR1009-7G-1C-1S+ (panel names
eth1..eth7) with four cables naming the console spellingether1..ether4:Case-only spelling, and a genuinely absent port:
Compare the resolver's own answer on the same names in A2 and B:
eth1,GigabitEthernet1/0/25. The ports existed; only the spelling differed. (C shows the exact spelling already worked - the contradiction above.)After the fix (
cd39a926)What changed
engine/topology.jscableProblem()resolves each end withifaceName.resolvePortName()- the same functionconnect()and the console use - instead ofdev.interfaces.has(). One naming table, as before; the callers of it are unchanged:cli.js(ten call sites, plus the module export the naming test pins),device.js:415(resolveIface), andtopology.jsitself (validateLink,mediaOptions,connect).warning, not anerror: the board loaded, one cable of it did not. Both loss paths now name the cable -cable l2 end d1/... names a port d1 does not haveandcable l2 was not restored: ...- still one entry per lost cable, sodeclared - restoredequals the number of link entries. That invariant is asserted, so a cable cannot go missing quietly.test/topology-load-links.test.js(new, 27 checks)iface.peerset on both ends (peer is the thing onlyconnect()sets);GigabitEthernetspelling loads, and the exact catalogue spelling still loads quietly;docs/ARCHITECTURE.md- "A cable is restored or explained" now documents the severity, the message shape, and that link names are resolved through the one table rather than string-matched.Tests
1b1e1287):248 suite(s) in 799.7 s - 9137 assertions passed, 0 failedcd39a926):249 suite(s) in 424.9 s - 9164 assertions passed, 0 failed(the new suite istopology-load-links 27 passed; every pre-existing suite still green)npm run syntax: 319 files, all OKThe two suites the brief called known-broken -
canonical-urlsandspec-vs-description- passed at HEAD in this worktree. The baseline run had zero failures, so there was nothing for me to skip.Not fixed here
loadIssuesis published in every state payload but nothing underweb/reads it (grep -rni loadissue web/has no hits), so on the canvas a lost cable is still not shown - it is only visible over the API. Wiring that up is a UI change with its own DOM contract, so it belongs in its own issue rather than in this fix.cd39a926900e7ecc2c05