Media and rate must agree: 100BASE-FX exists, and no port is uncablable at its own speed #9

Merged
jaylouisw merged 2 commits from fix/media-rate-consistency into main 2026-11-08 06:56:28 +00:00
Owner

Two holes in the same seam: the media a cage offers versus the rate a port declares.

Supersedes the closed #1474 / #1496 — the FX fix in the first commit never reached main (mediaById('100base-fx') still returned null there), and the second commit's invariant cannot pass without it, so they belong in one change.

Both SC cages offered the id 100base-fx and no MEDIA entry by that name existed. Every PON port in the catalogue (111 devices) advertised a medium the engine could not describe, and the one device that needs it — the Allied Telesis AT-MC102XL's 100M sc-upc port — could not be cabled to anything.

  • 100BASE-FX declared: 100 Mbps, 1310 nm, multimode, 2 km, SC/UPC. Declared as sc-upc rather than both polished SC cages because the ferrule is UPC — an SC/APC PON port cannot mate with it, so that cage no longer offers it. Same reasoning drops 1000BASE-LX from the APC cage.
  • preferredMedia() takes the rate the link will run at. The media list is the connector's whole repertoire, and the old rule preferred the fastest candidate — so two 100M converters were labelled GPON (SC/UPC) while negotiating at 100 Mbps. The rate bound picks 100BASE-FX, falling back to the full list when nothing fits.
  • test/cage-media-resolves.test.js asserts every id any cage offers, at every rate band, resolves — 2 offenders before, 0 after.

2. Twenty-two wired ports could not be cabled at their own rate

Asking the catalogue a question nothing had asked before — for every wired port, is there a medium whose rate it can actually run? — produced 22 failures out of 13,723:

Cisco NCS 2006, 18 ports. Ten-gigabit client ports declared in QSFP+ cages. A QSFP+ cage is a 40G cage (40GBASE-SR4/LR4, 40G DAC), so a 10G port in one has no medium at all. Cisco's NCS 2000 ten-port client cards are SFP+ based; QSFP+ appears on that platform only where 4x10G/40G aggregation is offered. Now SFP+ at 10G, and the test proves one cables to an ordinary SFP+ port at 10 Gbps. The 100G ports keep QSFP28.

Ubiquiti ES-12F, 4 ports. Ports 9–12 declared 100M only. Ubiquiti's figures are (8) 100/1000 Mbps SFP (1–8) and (4) 1000 Mbps SFP (9–12) — the catalogue had it inverted, and 100M-only SFP ports have no 100M medium. Now 1G, keeping 100/1000 behaviour on 1–8.

Why nothing caught it: the port-type audit asks whether a port contradicts its type; this is a port contradicting its own rate. test/wired-port-has-media.test.js now runs that comparison over all 13,723 wired ports and pins both devices so they cannot regress.

85 suites, 4,243 assertions, all passing on this branch. Cable matrix unchanged: 171 pairs, 0 verdict divergences.

Two holes in the same seam: the media a cage offers versus the rate a port declares. Supersedes the closed #1474 / #1496 — the FX fix in the first commit never reached `main` (`mediaById('100base-fx')` still returned `null` there), and the second commit's invariant cannot pass without it, so they belong in one change. ## 1. 100BASE-FX had no medium, and 100M links were called GPON Both SC cages offered the id `100base-fx` and **no `MEDIA` entry by that name existed**. Every PON port in the catalogue (111 devices) advertised a medium the engine could not describe, and the one device that needs it — the Allied Telesis **AT-MC102XL**'s 100M sc-upc port — could not be cabled to anything. - **100BASE-FX declared**: 100 Mbps, 1310 nm, multimode, 2 km, **SC/UPC**. Declared as sc-upc rather than both polished SC cages because the ferrule is UPC — an SC/APC PON port cannot mate with it, so that cage no longer offers it. Same reasoning drops 1000BASE-LX from the APC cage. - **`preferredMedia()` takes the rate the link will run at.** The media list is the connector's whole repertoire, and the old rule preferred the fastest candidate — so two 100M converters were labelled **`GPON (SC/UPC)`** while negotiating at 100 Mbps. The rate bound picks 100BASE-FX, falling back to the full list when nothing fits. - `test/cage-media-resolves.test.js` asserts every id any cage offers, at every rate band, resolves — **2 offenders before, 0 after**. ## 2. Twenty-two wired ports could not be cabled at their own rate Asking the catalogue a question nothing had asked before — for every wired port, is there a medium whose rate it can actually run? — produced **22 failures out of 13,723**: **Cisco NCS 2006, 18 ports.** Ten-gigabit client ports declared in **QSFP+ cages**. A QSFP+ cage is a 40G cage (40GBASE-SR4/LR4, 40G DAC), so a 10G port in one has no medium at all. Cisco's NCS 2000 ten-port client cards are **SFP+** based; QSFP+ appears on that platform only where 4x10G/40G aggregation is offered. Now SFP+ at 10G, and the test proves one cables to an ordinary SFP+ port at 10 Gbps. The 100G ports keep QSFP28. **Ubiquiti ES-12F, 4 ports.** Ports 9–12 declared 100M only. Ubiquiti's figures are **(8) 100/1000 Mbps SFP (1–8)** and **(4) 1000 Mbps SFP (9–12)** — the catalogue had it inverted, and 100M-only SFP ports have no 100M medium. Now 1G, keeping 100/1000 behaviour on 1–8. **Why nothing caught it:** the port-type audit asks whether a port contradicts its *type*; this is a port contradicting its *own rate*. `test/wired-port-has-media.test.js` now runs that comparison over all 13,723 wired ports and pins both devices so they cannot regress. **85 suites, 4,243 assertions, all passing** on this branch. Cable matrix unchanged: 171 pairs, 0 verdict divergences.
Both SC cages offered the id '100base-fx' and there was no MEDIA entry with that name, so mediaById('100base-fx') returned null. Every PON port in the catalogue advertised a medium the engine could not describe, and the one device that needs it - the Allied Telesis AT-MC102XL's sc-upc port at 100M - had no medium to be cabled with at all. A media id was written into a cage list in one place and the media itself was never added in another, and nothing compared the two.

Three parts:

1. 100BASE-FX is declared: 100 Mbps, 1310 nm, multimode, 2 km, SC/UPC. Declared as sc-upc rather than for both polished SC cages because the ferrule is UPC - an SC/APC PON port cannot mate with it, so that cage no longer offers it. The same reasoning removes 1000BASE-LX from the APC cage.

2. preferredMedia() takes the rate the link will run at. The media list is the connector's whole repertoire, and the old rule preferred the fastest candidate - so two 100M media converters facing each other were labelled 'GPON (SC/UPC)' while negotiated at 100 Mbps. The rate bound picks 100BASE-FX instead, and falls back to the full list rather than refusing to name a link when nothing fits.

3. test/cage-media-resolves.test.js asserts the general invariant that was missing: every id any cage offers, at every rate band the catalogue uses, must resolve in MEDIA. It found exactly two offenders before the fix and none after. It also pins the specific hardware (two AT-MC102XLs cable at 100 Mbps over 100BASE-FX, a real OLT's PON port offers no unresolvable media and no 100BASE-FX) and that nothing else about the SC/UPC cage changed.

84 suites, 4228 assertions. Cable matrix unchanged: every cage pair keeps its verdict.
No wired port may be uncablable at its own declared rate
Some checks failed
CI / Test (Node 18) (pull_request) Successful in 1m27s
CI / Test (Node 20) (pull_request) Successful in 1m19s
CI / Test (Node 22) (pull_request) Successful in 1m31s
CI / Server smoke test (pull_request) Successful in 23s
CI / Docker build (pull_request) Failing after 8s
ffcbbb35f6
Asked the catalogue a question nothing had asked before: for every wired port, is there at least one medium whose rate the port can actually run? Twenty-two of 13,723 failed, for two different reasons.

Cisco NCS 2006 - eighteen 10G client ports declared in QSFP+ cages. A QSFP+ cage is a 40G cage; the only media it offers are 40GBASE-SR4/LR4 and 40G DAC, so a 10G port in one could not be cabled to anything, at any distance, with any module. Cisco's NCS 2000 ten-port client cards are SFP+ based, and QSFP+ appears on that platform only where 4x10G or 40G aggregation is offered - which these ports are not. They are now SFP+ at 10G, and a test proves one cables to an ordinary SFP+ port at 10 Gbps. The 100G ports keep QSFP28.

Ubiquiti ES-12F - ports 9-12 declared 100M only. Ubiquiti's own figures are (8) 100/1000 Mbps SFP ports (1-8) and (4) 1000 Mbps SFP ports (9-12) plus (4) 10/100/1000 RJ45, so the catalogue had it inverted; 100M-only SFP ports have no 100M medium available and were dead. Now 1G, with the 100/1000 behaviour kept on 1-8 where it belongs.

Neither was caught because no existing check compared a port's declared rate with the media its cage offers. The port-type audit asks whether a port contradicts its type; the failure here is a port contradicting its own rate. test/wired-port-has-media.test.js now enforces the comparison across all 13,723 wired ports, and pins both devices so the specific defects cannot come back.

85 suites, 4243 assertions.
jaylouisw deleted branch fix/media-rate-consistency 2026-11-08 06:56:29 +00:00
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!9
No description provided.