fix(core): forward to-device onward to a relay-data frame's receiver - #175
Merged
Merged
Conversation
relay-hub's own relay-data handling read a sender's explicit to-device field to pick the right pairing among several a connection can hold at once, then discarded it before relaying the frame onward -- the receiving connection got only from-device, never to-device. A connection fronting more than one locally-addressable device behind a single hub connection (a gateway advertising several local peers, wire-mesh#170) has no other way to tell which of its own devices a frame was actually meant for, since every relay-data frame arrives multiplexed over that one connection regardless of target. IncomingManageRequest.toDevice already promised exactly this disambiguation, read from the frame's own field, but the hub never populated it because relay-hub.ts dropped the field on the way through. Splits relay-hub.unit.test.ts's multiplexed-pairing coverage into its own file (relay-hub-multiplexing.unit.test.ts) with shared fixtures in relay-hub-test-helpers.ts, under this repo's max-lines cap once the new to-device assertions pushed the combined file over it.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wire-mesh#170/#174 added
IncomingManageRequest.toDevice, read from arelay-dataframe's ownto-devicefield, specifically so a connection fronting more than one locally-addressable device behind a single hub connection (a gateway advertising several local peers, exactly agent-comms#184's use case) can tell which of its own devices an inbound relayed request was actually addressed to.Tracing it end to end against the installed package,
relay-hub.ts's ownrelay-datahandling reads a sender's explicitto-deviceto pick the right pairing among several a connection can hold at once, but then drops the field entirely before relaying the frame onward to the peer -- the receiver getsfrom-deviceonly, neverto-device.IncomingManageRequest.toDevicecan therefore never actually populate for the gateway-fronting-multiple-devices case #170 introduced it for.Fixes it by echoing the original
to-devicevalue through to the peer's own received frame, conditionally (omitted when the sender left it unaddressed, matching the existing single-pairing convention). Updated the four existing multi-pairing tests whose assertions implicitly relied on the old drop-it behaviour, and added a new test proving the echo-through directly.Also splits
relay-hub.unit.test.ts's multiplexed-pairing coverage into its ownrelay-hub-multiplexing.unit.test.tswith shared fixtures inrelay-hub-test-helpers.ts, since the new assertions pushed the combined file over this repo's max-lines cap.Test plan
pnpm exec vitest run test/relay-hub.unit.test.ts test/relay-hub-multiplexing.unit.test.ts-- 22 passingpnpm exec vitest run(full core package) -- 535 passing (6 pre-existing, unrelatedwasm-distbuild-artifact failures)pnpm exec tsc --noEmit-- clean (same pre-existingwasm-disterror only)pnpm exec eslinton all changed files -- clean