A copper SFP is the converter: name the module and the SFP+ cage reaches an RJ45 port (#1514) #1588

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

Fixes #1514

canMate() refused an SFP+ cage against an RJ45 port even when the caller declared mediaId: '1000base-t-sfp' - the copper module whose far side is an RJ45 socket - and the refusal ended at possible media: none with the answer sitting in the cage's own media list.

Socket geometry and the module are two different facts. CAGE_MATE still says no RJ45 plug enters an SFP+ slot, because that is true, so cable-matrix is unchanged. What was missing is that a cage cannot say which module is fitted, so the pair is legal exactly when the link names the copper module - the same reason a BiDi half has to be named. copperModuleBridge() is that rule, asked of the cage's own media table so the two cannot drift.

  • connect(..., { mediaId: '1000base-t-sfp' }) builds the run, records the module as the cable and runs at 1G; a ping crosses it.
  • a fibre module does not become a converter by being declared: 10GBASE-SR against an RJ45 port is still refused.
  • without the module the refusal names it and the field it goes in, and carries suggestion: { code: 'S_COPPER_MODULE_REQUIRED', field: 'mediaId', value: '1000base-t-sfp' } instead of a dead end.
  • mediaOptions() offers the module for the pair rather than an empty list.

test/copper-sfp-cage.test.js: 17 assertions. Full suite: 264 suites, 9565 assertions, 0 failed. scripts/syntax-check.js: 334 files OK.

Not done here: the canvas drag path still blocks before the medium picker, so the GUI cannot declare a module yet - the refusal now tells the user the field and value, but a one-click 'apply the copper module' affordance (like the hybrid-cord offer) is a UI change I left for Jay.

Fixes #1514 `canMate()` refused an SFP+ cage against an RJ45 port even when the caller declared `mediaId: '1000base-t-sfp'` - the copper module whose far side *is* an RJ45 socket - and the refusal ended at `possible media: none` with the answer sitting in the cage's own media list. Socket geometry and the module are two different facts. `CAGE_MATE` still says no RJ45 plug enters an SFP+ slot, because that is true, so `cable-matrix` is unchanged. What was missing is that a cage cannot say which module is fitted, so the pair is legal exactly when the link names the copper module - the same reason a BiDi half has to be named. `copperModuleBridge()` is that rule, asked of the cage's own media table so the two cannot drift. - `connect(..., { mediaId: '1000base-t-sfp' })` builds the run, records the module as the cable and runs at 1G; a ping crosses it. - a fibre module does not become a converter by being declared: 10GBASE-SR against an RJ45 port is still refused. - without the module the refusal names it and the field it goes in, and carries `suggestion: { code: 'S_COPPER_MODULE_REQUIRED', field: 'mediaId', value: '1000base-t-sfp' }` instead of a dead end. - `mediaOptions()` offers the module for the pair rather than an empty list. `test/copper-sfp-cage.test.js`: 17 assertions. Full suite: 264 suites, 9565 assertions, 0 failed. `scripts/syntax-check.js`: 334 files OK. Not done here: the canvas drag path still blocks before the medium picker, so the GUI cannot declare a module yet - the refusal now tells the user the field and value, but a one-click 'apply the copper module' affordance (like the hybrid-cord offer) is a UI change I left for Jay.
A copper SFP is the converter: name the module and the SFP+ cage reaches an RJ45 port (#1514)
Some checks failed
CI / Classify the change (pull_request) Successful in 27s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 45s
CI / Server smoke test (pull_request) Successful in 36s
CI / Test (Node 20) (pull_request) Successful in 1m46s
CI / Docker build (pull_request) Failing after 14m9s
CI / Test (Node 22) (pull_request) Failing after 15m0s
CI / Test (Node 18) (pull_request) Failing after 15m9s
e0b88407bd
`canMate()` refused an SFP+ cage against an RJ45 port even when the caller declared
`mediaId: '1000base-t-sfp'` - the copper module whose far side IS an RJ45 socket - and the
refusal ended at "possible media: none" with the answer sitting in the cage's own media list.

Socket geometry and the module are two different facts. `CAGE_MATE` still says no RJ45 plug
enters an SFP+ slot, because that is true. What was missing is that a cage cannot say which
module is fitted, so the pair is legal exactly when the link names the copper module, the way a
BiDi half has to be named for the same reason. `copperModuleBridge()` is that rule, asked of the
cage's own media table so it cannot drift from it.

Consequences:
- `connect(..., { mediaId: '1000base-t-sfp' })` builds the run, records the module as the cable
  and runs it at 1G; a ping crosses it.
- declaring a fibre module does not turn it into a converter: 10GBASE-SR against an RJ45 port is
  still refused.
- without the module the refusal now names it and the field, and carries
  `suggestion: { code: 'S_COPPER_MODULE_REQUIRED', field: 'mediaId', value: '1000base-t-sfp' }`
  instead of a dead end.
- `mediaOptions()` offers the module for the pair rather than an empty list.

test/copper-sfp-cage.test.js: 17 assertions. Full suite: 264 suites, 9565 assertions, 0 failed.
jaylouisw force-pushed fix/1116-0235 from e0b88407bd
Some checks failed
CI / Classify the change (pull_request) Successful in 27s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 45s
CI / Server smoke test (pull_request) Successful in 36s
CI / Test (Node 20) (pull_request) Successful in 1m46s
CI / Docker build (pull_request) Failing after 14m9s
CI / Test (Node 22) (pull_request) Failing after 15m0s
CI / Test (Node 18) (pull_request) Failing after 15m9s
to 3122772aae
Some checks failed
CI / Classify the change (pull_request) Successful in 20s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 34s
CI / Server smoke test (pull_request) Successful in 35s
CI / Test (Node 18) (pull_request) Successful in 1m47s
CI / Test (Node 22) (pull_request) Successful in 1m40s
CI / Docker build (pull_request) Failing after 11m3s
CI / Test (Node 20) (pull_request) Failing after 11m57s
2026-11-16 04:25:27 +00:00
Compare
Author
Owner

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

engine/media.js engine/topology.js engine/validation.js test/copper-sfp-cage.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: ``` engine/media.js engine/topology.js engine/validation.js test/copper-sfp-cage.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.
Author
Owner

Needs Jay's decision — this is a four-way answer to one issue (#1514), not a merge problem.

main already answers #1514: 2c39a647 (PR #1602, merged 04:40 today) added copperSfpModuleOf() in engine/media.js and gated it on mediaDeclared, i.e. a copper SFP only converts the cage to RJ45 when the port says the module is fitted (media/supportedMedia declares it) and the cage can hold that module. test/copper-sfp-bridge.test.js (208 lines) pins that rule.

Three open PRs implement the same feature a different way, and none of them uses mediaDeclared:

  • #1588 (this one) — COPPER_MODULE_MEDIA + cageTakesCopperModule(); also touches engine/topology.js. Conflicts in engine/media.js.
  • #1594 — adds farEnd: 'rj45' to the media table + moduleBridgedMedia(); 9 files, 345/-46. Conflicts in engine/media.js (identical hunk region).
  • #1598 — a module faces table; 8 files, 322/-13. Conflicts in engine/media.js (identical hunk region).

All three conflict in the same hunk of engine/media.js that #1602 now occupies, and their gates are looser than #1602's: they bridge off the cage's contents rather than off a declaration, so rebasing any of them means replacing a rule Jay just landed, which I will not guess at.

Decision required: keep #1602's declaration-gated rule and close the three as superseded, or name the one whose semantics should win and I will rebase that one on top of #1602. I have verified main's suite is green (copper-sfp-bridge included) and that no PR here references mediaDeclared. Nothing has been rebased or merged.

Same note posted on #1594 and #1598.

**Needs Jay's decision — this is a four-way answer to one issue (#1514), not a merge problem.** `main` already answers #1514: `2c39a647` (PR #1602, merged 04:40 today) added `copperSfpModuleOf()` in `engine/media.js` and gated it on `mediaDeclared`, i.e. a copper SFP only converts the cage to RJ45 **when the port says the module is fitted** (`media`/`supportedMedia` declares it) *and* the cage can hold that module. `test/copper-sfp-bridge.test.js` (208 lines) pins that rule. Three open PRs implement the same feature a different way, and none of them uses `mediaDeclared`: - **#1588** (this one) — `COPPER_MODULE_MEDIA` + `cageTakesCopperModule()`; also touches `engine/topology.js`. Conflicts in `engine/media.js`. - **#1594** — adds `farEnd: 'rj45'` to the media table + `moduleBridgedMedia()`; 9 files, 345/-46. Conflicts in `engine/media.js` (identical hunk region). - **#1598** — a `module faces` table; 8 files, 322/-13. Conflicts in `engine/media.js` (identical hunk region). All three conflict in the same hunk of `engine/media.js` that #1602 now occupies, and their gates are looser than #1602's: they bridge off the cage's contents rather than off a declaration, so rebasing any of them means **replacing a rule Jay just landed**, which I will not guess at. Decision required: keep #1602's declaration-gated rule and close the three as superseded, or name the one whose semantics should win and I will rebase that one on top of #1602. I have verified main's suite is green (`copper-sfp-bridge` included) and that no PR here references `mediaDeclared`. Nothing has been rebased or merged. Same note posted on #1594 and #1598.
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: media.copperModuleBridge + a COPPER_MODULE_MEDIA constant, plus threading { mediaId: opts.mediaId } through the engine/topology.js canMate fallback and injecting the module into commonMedia's result in the picker. Main folded the same two effects into copperSfpBridge/commonMedia/portWithModule with no topology signature change, so the topology.js half here is the real difference — worth a fresh look only if the UI needs the module injected at the topology layer rather than resolved in media.js.

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:** `media.copperModuleBridge` + a `COPPER_MODULE_MEDIA` constant, plus threading `{ mediaId: opts.mediaId }` through the `engine/topology.js` `canMate` fallback and injecting the module into `commonMedia`'s result in the picker. Main folded the same two effects into `copperSfpBridge`/`commonMedia`/`portWithModule` with no topology signature change, so the `topology.js` half here is the real difference — worth a fresh look only if the UI needs the module injected at the topology layer rather than resolved in `media.js`.
jaylouisw closed this pull request 2026-11-16 07:26:49 +00:00
Some checks failed
CI / Classify the change (pull_request) Successful in 20s
PR rebase / Rebase onto main and arm auto-merge (pull_request) Successful in 34s
CI / Server smoke test (pull_request) Successful in 35s
CI / Test (Node 18) (pull_request) Successful in 1m47s
CI / Test (Node 22) (pull_request) Successful in 1m40s
CI / Docker build (pull_request) Failing after 11m3s
CI / Test (Node 20) (pull_request) Failing after 11m57s

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