media: a copper SFP mates an RJ45 peer, at the module's rate #1594

Closed
jaylouisw wants to merge 1 commit from fix/1116-0305 into main
Owner

Fixes #1514

connect() refused an SFP+ cage cabled to an RJ45 port even when told the cage held 1000base-t-sfp, and named no way to build it:

Cannot mate SFP+ to RJ45 (incompatible connectors).
1000BASE-T SFP (1000base-t-sfp) is not supported by both ...; possible media: none.

The media table and the mating rule disagreed: CAGE_MEDIA['sfp+'] offers the copper module, CAGE_MATE says an SFP+ cage and an RJ45 port never join. Both are true of different things - the cages do not mate, the module does. A 1000BASE-T SFP is an SFP-family part whose far side is an RJ45 socket, so a 10G cage with one in it cables to a 1G copper appliance. The only way to draw it was force: true, which records a cable the validator calls impossible.

What changed

  • MEDIA entries may state farEnd, the cage a module presents to its peer. Only 1000base-t-sfp does; a DAC ends in another cage and an optic in a ferrule, so neither bridges.
  • moduleBridgedMedia() answers what a port offers through a fitted module; commonMedia() and canMate() consult it only where the cages do not mate on their own, so no pair that mated before changes verdict.
  • The module is the physical layer: the link runs at its rate and no other. Negotiating the cages produced "1000BASE-T SFP at 100 Mbps" against a 100M copper port and 10G against a 10GBASE-T port; both are now E_NO_COMMON_SPEED, saying the module is a single-rate part.

Tests

New test/copper-sfp-mating.test.js (34 assertions): the mating both ways, the link named after the module and running at 1G, validateLink/connect() with and without a chosen medium, the refusals for a cage of optics, a DAC and a 100M peer, and two copper SFPs unchanged.

Four existing suites asserted the old refusal and now name the module they mean: bidi-media census (a newly accepted pair may be a BX run or a copper module), cable-matrix, link-options (both copper runs offered, patch lead first), sfp28-legacy and validation (an optic-only cage is still refused).

docs/CONNECTORS.md 6.1 was a worked example of the refusal this fixes, advising "put a 1000BASE-T SFP in the uplink" - advice it then refused. It is now the accepted transcript plus the two refusals that remain, and 4.1 plus docs/PHYSICAL_LAYER.md describe the farEnd rule.

Full suite: 264 suites / 9585 assertions / 0 failed. Syntax check: 334 files, all OK.

Fixes #1514 `connect()` refused an SFP+ cage cabled to an RJ45 port even when told the cage held `1000base-t-sfp`, and named no way to build it: ``` Cannot mate SFP+ to RJ45 (incompatible connectors). 1000BASE-T SFP (1000base-t-sfp) is not supported by both ...; possible media: none. ``` The media table and the mating rule disagreed: `CAGE_MEDIA['sfp+']` offers the copper module, `CAGE_MATE` says an SFP+ cage and an RJ45 port never join. Both are true of different things - the **cages** do not mate, the **module** does. A 1000BASE-T SFP is an SFP-family part whose far side is an RJ45 socket, so a 10G cage with one in it cables to a 1G copper appliance. The only way to draw it was `force: true`, which records a cable the validator calls impossible. ## What changed - `MEDIA` entries may state `farEnd`, the cage a module presents to its peer. Only `1000base-t-sfp` does; a DAC ends in another cage and an optic in a ferrule, so neither bridges. - `moduleBridgedMedia()` answers what a port offers through a fitted module; `commonMedia()` and `canMate()` consult it **only** where the cages do not mate on their own, so no pair that mated before changes verdict. - The module is the physical layer: the link runs at its rate and no other. Negotiating the cages produced "1000BASE-T SFP at 100 Mbps" against a 100M copper port and 10G against a 10GBASE-T port; both are now `E_NO_COMMON_SPEED`, saying the module is a single-rate part. ## Tests New `test/copper-sfp-mating.test.js` (34 assertions): the mating both ways, the link named after the module and running at 1G, `validateLink`/`connect()` with and without a chosen medium, the refusals for a cage of optics, a DAC and a 100M peer, and two copper SFPs unchanged. Four existing suites asserted the old refusal and now name the module they mean: `bidi-media` census (a newly accepted pair may be a BX run or a copper module), `cable-matrix`, `link-options` (both copper runs offered, patch lead first), `sfp28-legacy` and `validation` (an optic-only cage is still refused). `docs/CONNECTORS.md` 6.1 was a worked example of the refusal this fixes, advising "put a 1000BASE-T SFP in the uplink" - advice it then refused. It is now the accepted transcript plus the two refusals that remain, and 4.1 plus `docs/PHYSICAL_LAYER.md` describe the `farEnd` rule. **Full suite: 264 suites / 9585 assertions / 0 failed.** Syntax check: 334 files, all OK.
media: a copper SFP mates an RJ45 peer, at the module's rate (#1514)
Some checks failed
PR rebase / Rebase onto main and arm auto-merge (pull_request) Failing after 11m0s
CI / Classify the change (pull_request) Failing after 11m5s
CI / Test (Node 18) (pull_request) Has been cancelled
CI / Test (Node 20) (pull_request) Has been cancelled
CI / Test (Node 22) (pull_request) Has been cancelled
CI / Server smoke test (pull_request) Has been cancelled
CI / Docker build (pull_request) Has been cancelled
081e8ee2f0
`connect()` refused an SFP+ cage cabled to an RJ45 port even when told the
cage held `1000base-t-sfp`, and named no way to build it:

  Cannot mate SFP+ to RJ45 (incompatible connectors).
  1000BASE-T SFP (1000base-t-sfp) is not supported by both ...;
  possible media: none.

The two halves of the engine disagreed: CAGE_MEDIA['sfp+'] offered the
copper module, CAGE_MATE said an SFP+ cage and an RJ45 port never join. Both
are true of different things - the cages do not mate, the module does. A
1000BASE-T SFP is an SFP-family part whose far side is an RJ45 socket, so a
10G cage with one in it cables to a 1G copper appliance, which is an ordinary
install. The only way to draw it was `force: true`, recording a cable the
validator calls impossible.

- MEDIA entries may state `farEnd`, the cage a module presents to its peer.
  Only `1000base-t-sfp` does; a DAC ends in another cage and an optic in a
  ferrule, so neither bridges.
- `moduleBridgedMedia()` answers what a port offers through a fitted module,
  and `commonMedia()` / `canMate()` consult it only where the cages do not
  mate themselves, so no pair that mated before changes.
- The module is the physical layer: the link runs at its rate and no other.
  Negotiating the cages instead produced "1000BASE-T SFP at 100 Mbps" against
  a 100M copper port, and 10G against a 10GBASE-T port; both are now
  E_NO_COMMON_SPEED, naming the module as a single-rate part.

test/copper-sfp-mating.test.js pins it: the mating in both directions, the
link named and running at 1G, connect() with and without a chosen medium,
the refusals for a cage of optics, a DAC and a 100M peer, and two copper SFPs
unchanged. Four suites asserted the old refusal and now name the module they
mean: bidi-media's census (a newly accepted pair may be a BX run or a copper
module), cable-matrix, link-options (both copper runs are offered, the patch
lead first), sfp28-legacy and validation (an optic-only cage is still refused).

docs/CONNECTORS.md 6.1 was a worked example of the refusal this fixes, with
"put a 1000BASE-T SFP in the uplink" as advice it did not follow; it is now
the accepted transcript plus the two refusals that remain.

Full suite: 264 suites / 9585 assertions / 0 failed. Syntax: 334 files.
Author
Owner

Same four-way collision as #1588 — see the analysis there. main already carries a mediaDeclared-gated copper-SFP rule from 2c39a647 (PR #1602), and this branch's farEnd/moduleBridgedMedia() approach replaces it rather than building on it. Not rebased: choosing between the two semantics is a behaviour decision, not a conflict resolution. Needs Jay's decision.

Same four-way collision as #1588 — see the analysis there. `main` already carries a `mediaDeclared`-gated copper-SFP rule from `2c39a647` (PR #1602), and this branch's `farEnd`/`moduleBridgedMedia()` approach replaces it rather than building on it. Not rebased: choosing between the two semantics is a behaviour decision, not a conflict resolution. Needs Jay's decision.
Author
Owner

Closing as superseded: #1514 is already fixed on main by commit 2c39a647 — A copper SFP in an SFP+ cage mates an RJ45 port (#1514) (#1602), merged 2026-11-16 04:40.

Main now has, in engine/media.js:

  • copperSfpBridge(pa, pb) — when one cage is rj45/combo and the other is a module slot, it returns 1000base-t-sfp instead of nothing;
  • commonMedia() calls it in the !cagesMate() branch, so the picker is offered the module again (the "possible media: none" gap is gone);
  • portWithModule() + mediaDeclared — a caller-named copper module narrows the port's media, so mediaId is honoured without letting an optic into a socket with no room for it;
  • engine/validation.js and test/copper-sfp-bridge.test.js (208 lines) cover the mating rule and the rate.

Because main now carries a bridging rule in the same functions, every retry of #1514 conflicts in engine/media.js and nowhere else — that is why all three of these sat blocked. Closing rather than picking a winner: the issue is answered, and keeping three conflicting duplicates of one behaviour in the queue means nobody's CI tells them apart.

The branch is left intact, not deleted. If this shape is preferred over main's, reopen or re-push it against current main as a replacement change and it can be judged on its own merits.
This branch's distinct shape: a farEnd: 'rj45' field on the 1000base-t-sfp catalogue entry and a generic moduleBridgedMedia() that bridges on that metadata rather than on a hardcoded copper special case. Arguably the cleaner model — a module states the cage it presents to its peer. Main instead special-cases copper via copperSfpBridge(). That is a design preference, not a bug; it is a decision for Jay, not something this loop should switch by hand.

Closing as **superseded**: #1514 is already fixed on main by commit `2c39a647` — *A copper SFP in an SFP+ cage mates an RJ45 port (#1514) (#1602)*, merged 2026-11-16 04:40. Main now has, in `engine/media.js`: - `copperSfpBridge(pa, pb)` — when one cage is `rj45`/`combo` and the other is a module slot, it returns `1000base-t-sfp` instead of nothing; - `commonMedia()` calls it in the `!cagesMate()` branch, so the picker is offered the module again (the "possible media: none" gap is gone); - `portWithModule()` + `mediaDeclared` — a caller-named copper module narrows the port's media, so `mediaId` is honoured without letting an optic into a socket with no room for it; - `engine/validation.js` and `test/copper-sfp-bridge.test.js` (208 lines) cover the mating rule and the rate. Because main now carries a bridging rule in the same functions, every retry of #1514 conflicts in `engine/media.js` and nowhere else — that is why all three of these sat blocked. Closing rather than picking a winner: the issue is answered, and keeping three conflicting duplicates of one behaviour in the queue means nobody's CI tells them apart. The branch is left intact, not deleted. If this shape is preferred over main's, reopen or re-push it against current main as a replacement change and it can be judged on its own merits. **This branch's distinct shape:** a `farEnd: 'rj45'` field on the `1000base-t-sfp` catalogue entry and a generic `moduleBridgedMedia()` that bridges on that metadata rather than on a hardcoded copper special case. Arguably the cleaner model — a module states the cage it presents to its peer. Main instead special-cases copper via `copperSfpBridge()`. That is a design preference, not a bug; it is a decision for Jay, not something this loop should switch by hand.
jaylouisw closed this pull request 2026-11-16 07:26:51 +00:00
Some checks failed
PR rebase / Rebase onto main and arm auto-merge (pull_request) Failing after 11m0s
CI / Classify the change (pull_request) Failing after 11m5s
CI / Test (Node 18) (pull_request) Has been cancelled
CI / Test (Node 20) (pull_request) Has been cancelled
CI / Test (Node 22) (pull_request) Has been cancelled
CI / Server smoke test (pull_request) Has been cancelled
CI / Docker build (pull_request) Has been cancelled

Pull request closed

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!1594
No description provided.