A cable says when it was pulled, and both doors say the same thing (#1385) #1386
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!1386
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/link-instant"
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?
A cable says when it was pulled, and both doors say the same thing. Fixes #1385.
setLinkState()readNumber(o.atMs) || 0, so a change with no instant named was stamped t=0 — always. Typedinto a console standing at t=60000:
The same board asked the same question through the API with
atMs: 60000answered 90000. The two doorsdisagreed, and one of them was nonsense.
markTopologyChange()— two methods up, written for exactly this reason in #1331 — already had the right rule: theoperator's instant, else 0.
setLinkState()now uses it.The rule, at both doors
where a board's clock starts — unchanged behaviour there);
atMsthat is not a time at or after 0 is refused asE_BAD_INSTANTinstead of quietly becoming zero.That last one mattered:
atMs: "abc"used to move the cable and stamp it at 0. The server'sNumber(body.atMs) || 0coerced it before the engine could see it, and mapped every failure to404 no such link.The server now passes the value through and answers a bad instant with
400 E_BAD_INSTANT.Found on the way
link statetestedl.stateSinceMsfor truth, so a cable pulled at t=0 — the first change in a run's life —printed its state with no instant at all, while every later change printed one.
Evidence
test/link-instant.test.js— 37 checks:atMs 60000,reconvergeAtMs 90000) and both thecable and the board remember it; a named instant wins; a settled board still starts at 0;
"abc",-1,{}andNaNare refused withE_BAD_INSTANTand the cable is not touched;converges again at 90000 ms, andlink statereadschanged at 60000 ms (0 ms ago);changed at 0 msinstead of printing nothing;getConvergence().convergedAtMsequals the reconvergeinstant the console promised, the schedule says which change it is reacting to, a ping at the cut reports
converginguntil exactly that instant, and after it the engine stops blaming a process that has finished andnames the cable instead;
"abc"and-1are400 E_BAD_INSTANTwith codes, and the refused requests never moved the cable.
Reverting
engine/simulator.jsfails 6 of 37,engine/cli.js5,server/index.js3 — and the printoutsshow the old answers verbatim (
converges again at 30000 ms;atMs: "abc"→200with the cable moved).docs/CONVERGENCE.mdstates the rule for all three cases;docs/CLI.mdsays that noatmeans now.Suite: 196 suites, 7,538 assertions, 0 failed. Syntax: 264 files, OK.