cli: converge at <ms> answers the question it prints (#1726) #1728
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!1728
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/1116-2035"
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 #1726
helphas advertisedconverge [at <ms>]since the command existed, and_converge()readNumber(tokens[0])and nothing else. The advertised form was not refused — it was answered as if no instant hadbeen named:
Number('at')isNaN, aNaNinstant fails the per-rowe.readyAtMs > atMstest, so every(pending)mark vanished and the console reported a converged lab at an instant before it converged.What changed
engine/cli.js—_converge()parsesat <ms>the waylink <up|down> <id> at <ms>has since #1049, so bothspellings are one command with one answer. The leftover argument is refused by name rather than dropped, which
is the rule
pingfollows since #1379:converge 1000 wibble→% Unrecognized "wibble" (converge [<ms> | at <ms>]), andconverge at,converge wibble,converge at wibbleand
converge -5are each% Invalid instant: …instead of silently meaning "converged" (or, for-5, aninstant no row can have reached).
engine/cli.js— thehelpline now readsconverge [<ms> | at <ms>], the syntax both paths accept, alignedwith the
linkline beside it.docs/CLI.md— the paragraph that admitted the discrepancy ("the fix belongs in the parser; until it lands,this line names the spelling that works") now describes the parser that exists, and the usage block matches.
test/converge-instant.test.js— new, 17 assertions: both spellings produce the identical table, past the lastprocess neither marks a row pending, every malformed instant is refused with a message that names the mistake,
the stray word is named with the syntax that works, and whatever the index advertises is typed straight back
into the session that printed it (the pasteability rule).
Gates
node scripts/syntax-check.jsnpm testtest/converge-instant.test.jsmain)test/help-completeness.test.jsconverge at <ms>includedtest/convergence-timing.test.js,test/link-instant.test.js,test/control-plane-instant.test.js,test/configure-abbreviation.test.js,test/command-word-abbreviation.test.jsnode scripts/check-doc-citations.jsCLI.md:1824suspect is gone with the paragraph)converge at <ms>answers the question it prints (#1726)`help` has advertised `converge [at <ms>]` since the command existed and `_converge()` read `Number(tokens[0])` and nothing else. The advertised form was therefore not refused - it was answered as if no instant had been named, because `Number('at')` is `NaN` and a `NaN` instant fails the per-row `e.readyAtMs > atMs` test. Every `(pending)` mark vanished and the console reported a converged lab at an instant before it converged, which is the whole output of the command. `at` is now parsed the way `link <up|down> <id> at <ms>` has parsed it since #1049, so the spelling the box prints and the bare `converge 10000` are one command with one answer. What is left over is refused by name rather than dropped, the rule `ping` follows since #1379: `converge 1000 wibble` is `% Unrecognized "wibble" (converge [<ms> | at <ms>])`, and `converge at`, `converge wibble`, `converge at wibble`, `converge -5` are each `% Invalid instant: ...` instead of silently meaning "converged" (or, for -5, an instant no row can have reached). test/converge-instant.test.js: 17 assertions over both spellings being identical, every malformed instant, the stray word, and the pasteability of whatever the index advertises.ae2ff4b9c7e31103720b