A stated range is the range the check applies (#1505) #1549

Merged
jaylouisw merged 1 commit from fix/1115-2105 into main 2026-11-15 23:09:57 +00:00
Owner

Fixes #1505

What was wrong

  • channel-group 4097 mode active was accepted and built a bundle, while the refusal in the same handler says a channel group is 1-4096. The condition was a digits check plus Number(id) < 1 — a lower bound only, left behind by #1495. show etherchannel summary then printed the impossible bundle as fact.
  • spanning-tree priority 61441 was answered by the multiple-of-4096 rule (the range was tested last), which computed its neighbours arithmetically and offered "the nearest valid values are 61440 and 65536". 65536 is refused by the same handler, so the correction led straight into a second refusal.

What changed

  • engine/cli.js: the channel-group id check applies both ends of the range it prints; a refused id leaves no entry in config.lags, no membership on the port and no row in show etherchannel summary.
  • engine/cli.js: the bridge-priority range is checked before the step rule, in the words the neighbouring refusals already use (the range is 0 to 61440), so no suggestion can fall outside the range.
  • test/stated-range-is-the-enforced-range.test.js: eight settings probed at four points (below, low edge, high edge, above) must go refused / accepted / accepted / refused; both refusals must state the range; and any value a refusal offers as valid is probed too.
  • docs/CLI.md section A stated range is the range the check applies.

Verification

  • test/stated-range-is-the-enforced-range.test.js 50 passed / 0 failed; with the previous handlers 45 passed / 5 failed, the five being 4097 accepted, its bundle table entry, its summary row, and the two 61441 message checks.
  • Full suite 255 suites / 9313 assertions / 0 failed; node scripts/syntax-check.js 325 files; stp-priority 41/41; command-answers-the-question 27/27; lag 57/57; help-completeness 8/8; check-doc-citations exit 0.

Measured and left alone

vlan, vrrp (id and priority), ipv6 nd ra lifetime, ip ospf cost and ping <count> already enforce both ends of the range they print, and the test keeps them that way. The other link-aggregation defects in #1510 (a no channel-group <id> that acts on another group, a port joining several bundles) are untouched here and remain open.

Fixes #1505 ## What was wrong - `channel-group 4097 mode active` was accepted and built a bundle, while the refusal in the same handler says a channel group is `1-4096`. The condition was a digits check plus `Number(id) < 1` — a lower bound only, left behind by #1495. `show etherchannel summary` then printed the impossible bundle as fact. - `spanning-tree priority 61441` was answered by the multiple-of-4096 rule (the range was tested last), which computed its neighbours arithmetically and offered "the nearest valid values are 61440 and 65536". 65536 is refused by the same handler, so the correction led straight into a second refusal. ## What changed - `engine/cli.js`: the channel-group id check applies both ends of the range it prints; a refused id leaves no entry in `config.lags`, no membership on the port and no row in `show etherchannel summary`. - `engine/cli.js`: the bridge-priority range is checked before the step rule, in the words the neighbouring refusals already use (`the range is 0 to 61440`), so no suggestion can fall outside the range. - `test/stated-range-is-the-enforced-range.test.js`: eight settings probed at four points (below, low edge, high edge, above) must go refused / accepted / accepted / refused; both refusals must state the range; and any value a refusal offers as valid is probed too. - `docs/CLI.md` section *A stated range is the range the check applies*. ## Verification - `test/stated-range-is-the-enforced-range.test.js` **50 passed / 0 failed**; with the previous handlers **45 passed / 5 failed**, the five being 4097 accepted, its bundle table entry, its summary row, and the two 61441 message checks. - Full suite **255 suites / 9313 assertions / 0 failed**; `node scripts/syntax-check.js` 325 files; `stp-priority` 41/41; `command-answers-the-question` 27/27; `lag` 57/57; `help-completeness` 8/8; `check-doc-citations` exit 0. ## Measured and left alone `vlan`, `vrrp` (id and priority), `ipv6 nd ra lifetime`, `ip ospf cost` and `ping <count>` already enforce both ends of the range they print, and the test keeps them that way. The other link-aggregation defects in #1510 (a `no channel-group <id>` that acts on another group, a port joining several bundles) are untouched here and remain open.
A stated range is the range the check applies (#1505)
All checks were successful
CI / Classify the change (pull_request) Successful in 17s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 22s
CI / Test (Node 18) (pull_request) Successful in 3m28s
CI / Test (Node 20) (pull_request) Successful in 3m8s
CI / Server smoke test (pull_request) Successful in 30s
CI / Test (Node 22) (pull_request) Successful in 3m1s
CI / Docker build (pull_request) Successful in 45s
10798b3480
`channel-group 4097 mode active` built a bundle while the same handler's refusal
says a group is 1-4096: the check was `!/^\d+$/.test(id) || Number(id) < 1`,
a lower bound only, left behind by #1495. The ceiling is now applied, and a
refused id leaves nothing behind - no bundle table entry, no port membership,
no row in `show etherchannel summary`.

`spanning-tree priority 61441` answered with the step rule and offered "the
nearest valid values are 61440 and 65536"; the range was tested last, so the
suggestion was computed arithmetically past the top and 65536 is refused by the
very same handler. The range is asked first and in the words the neighbouring
refusals use.

test/stated-range-is-the-enforced-range.test.js probes eight settings at four
points (below, low edge, high edge, above), requires both refusals to state the
range, and probes any value a refusal offers as valid. 50 checks; with the old
handlers 45 passed / 5 failed. Full suite 255 suites / 9313 assertions / 0
failed; syntax 325 files.
jaylouisw force-pushed fix/1115-2105 from 10798b3480
All checks were successful
CI / Classify the change (pull_request) Successful in 17s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 22s
CI / Test (Node 18) (pull_request) Successful in 3m28s
CI / Test (Node 20) (pull_request) Successful in 3m8s
CI / Server smoke test (pull_request) Successful in 30s
CI / Test (Node 22) (pull_request) Successful in 3m1s
CI / Docker build (pull_request) Successful in 45s
to f3e9118cc1
Some checks failed
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Failing after 14m6s
CI / Test (Node 18) (pull_request) Successful in 3m24s
CI / Test (Node 20) (pull_request) Successful in 3m8s
CI / Docker build (pull_request) Successful in 31s
CI / Test (Node 22) (pull_request) Successful in 3m7s
CI / Server smoke test (pull_request) Failing after 10m48s
2026-11-15 21:25:25 +00:00
Compare
Author
Owner

Rebased onto 00204b30 (was 3 behind). One conflict, engine/cli.js: main's #1543 introduced _channelGroupId(), and it already applies both bounds - Number(s) < 1 || Number(s) > 4096 - so the inline check this PR adds was a duplicate of the fix, not a competitor. Kept main's _channelGroupId call and dropped the duplicated block, leaving a comment that names #1505 and says where the ceiling now lives. The spanning-tree-priority half of the PR is untouched and is the part main does not have.

Head 10798b34 ? f3e9118c. Verified: syntax 325 OK, stated-range-is-the-enforced-range 50/50, lag 57/57, stp 64/64, cli 8/8.

Rebased onto 00204b30 (was 3 behind). One conflict, `engine/cli.js`: main's #1543 introduced `_channelGroupId()`, and it already applies both bounds - `Number(s) < 1 || Number(s) > 4096` - so the inline check this PR adds was a duplicate of the fix, not a competitor. Kept main's `_channelGroupId` call and dropped the duplicated block, leaving a comment that names #1505 and says where the ceiling now lives. The spanning-tree-priority half of the PR is untouched and is the part main does not have. Head `10798b34` ? `f3e9118c`. Verified: syntax 325 OK, `stated-range-is-the-enforced-range` 50/50, `lag` 57/57, `stp` 64/64, `cli` 8/8.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-15 21:51:49 +00:00
Author
Owner

This branch conflicts with main, so it was not rebased:

docs/CLI.md engine/cli.js test/stated-range-is-the-enforced-range.test.js 

A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.

This branch conflicts with `main`, so it was not rebased: ``` docs/CLI.md engine/cli.js test/stated-range-is-the-enforced-range.test.js ``` A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.
jaylouisw force-pushed fix/1115-2105 from f3e9118cc1
Some checks failed
CI / Classify the change (pull_request) Successful in 14s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Failing after 14m6s
CI / Test (Node 18) (pull_request) Successful in 3m24s
CI / Test (Node 20) (pull_request) Successful in 3m8s
CI / Docker build (pull_request) Successful in 31s
CI / Test (Node 22) (pull_request) Successful in 3m7s
CI / Server smoke test (pull_request) Failing after 10m48s
to 7804e43448
All checks were successful
CI / Classify the change (pull_request) Successful in 18s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 19s
CI / Test (Node 18) (pull_request) Successful in 3m31s
CI / Test (Node 20) (pull_request) Successful in 3m17s
CI / Server smoke test (pull_request) Successful in 32s
CI / Docker build (pull_request) Successful in 26s
CI / Test (Node 22) (pull_request) Successful in 3m9s
2026-11-15 22:43:11 +00:00
Compare
Author
Owner

The rebase workflow reported a conflict on this branch at 22:06 naming docs/CLI.md engine/cli.js test/stated-range-is-the-enforced-range.test.js. That report was stale: rebased by hand just now and there was no conflict at all.

git worktree add --detach pr-1549 origin/fix/1115-2105 -> git rebase origin/main -> "Successfully rebased and updated detached HEAD", first try, nothing to resolve. f3e9118c was already the resolved result of the engine/cli.js decision recorded above at 21:25, so there was nothing left for the bot to collide with; the diff against main is unchanged (3 files, +240/-4).

Head f3e9118c ? 7804e434 (base 00204b30 ? 2ce2d029, was 4 behind).

Verified after the rebase: npm test full run - 256 suites, 9,347 assertions, 0 failed (including the port-type audit and the control-bytes check). Targeted: stated-range-is-the-enforced-range 50/50, cli 8/8, stp 64/64.

Content is the spanning-tree-priority half of #1505, unchanged: the range is asked before the multiple-of-4096 rule, so spanning-tree priority 61441 no longer answers with a suggestion of 65536; channel-group keeps using _channelGroupId() so the printed range and the checked range cannot drift.

The rebase workflow reported a conflict on this branch at 22:06 naming `docs/CLI.md engine/cli.js test/stated-range-is-the-enforced-range.test.js`. That report was stale: rebased by hand just now and there was **no conflict at all**. `git worktree add --detach pr-1549 origin/fix/1115-2105` -> `git rebase origin/main` -> "Successfully rebased and updated detached HEAD", first try, nothing to resolve. `f3e9118c` was already the *resolved* result of the `engine/cli.js` decision recorded above at 21:25, so there was nothing left for the bot to collide with; the diff against main is unchanged (3 files, +240/-4). Head `f3e9118c` ? `7804e434` (base `00204b30` ? `2ce2d029`, was 4 behind). Verified after the rebase: `npm test` full run - **256 suites, 9,347 assertions, 0 failed** (including the port-type audit and the control-bytes check). Targeted: `stated-range-is-the-enforced-range` 50/50, `cli` 8/8, `stp` 64/64. Content is the spanning-tree-priority half of #1505, unchanged: the range is asked before the multiple-of-4096 rule, so `spanning-tree priority 61441` no longer answers with a suggestion of 65536; `channel-group` keeps using `_channelGroupId()` so the printed range and the checked range cannot drift.
jaylouisw scheduled this pull request to auto merge when all checks succeed 2026-11-15 23:09:43 +00:00
jaylouisw force-pushed fix/1115-2105 from 7804e43448
All checks were successful
CI / Classify the change (pull_request) Successful in 18s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 19s
CI / Test (Node 18) (pull_request) Successful in 3m31s
CI / Test (Node 20) (pull_request) Successful in 3m17s
CI / Server smoke test (pull_request) Successful in 32s
CI / Docker build (pull_request) Successful in 26s
CI / Test (Node 22) (pull_request) Successful in 3m9s
to 1774306d71
All checks were successful
CI / Classify the change (pull_request) Successful in 17s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 20s
CI / Test (Node 18) (pull_request) Successful in 3m33s
CI / Test (Node 20) (pull_request) Successful in 3m15s
CI / Server smoke test (pull_request) Successful in 37s
CI / Docker build (pull_request) Successful in 24s
CI / Test (Node 22) (pull_request) Successful in 3m15s
2026-11-15 23:09:47 +00:00
Compare
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jaylouisw/packetforge!1549
No description provided.