fix(core): route replay events in multiplexed transport#20408
fix(core): route replay events in multiplexed transport#20408
Conversation
Co-Authored-By: GPT-5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds support for routing Replay envelope events through the multiplexed transport’s default matcher so replay events can be multiplexed based on routing info in event.extra.
Changes:
- Update the default multiplexed transport matcher to consider
replay_eventenvelope items when extracting an event. - Add a core transport test ensuring
replay_eventenvelopes are routed to DSNs provided viaevent.extra[MULTIPLEXED_TRANSPORT_EXTRA_KEY].
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/core/src/transports/multiplexed.ts | Extends default matcher to extract events from replay_event items (in addition to event). |
| packages/core/test/lib/transports/multiplexed.test.ts | Adds coverage verifying default-matcher routing works for replay events using the extra routing key. |
Comments suppressed due to low confidence (1)
packages/core/src/transports/multiplexed.ts:109
- The default matcher now explicitly fetches only
['event', 'replay_event']. This means routing viaextra[MULTIPLEXED_TRANSPORT_EXTRA_KEY]still won’t apply totransactionorprofileenvelope items. If the intent is to support routing for all event-like envelope types (similar tomakeOverrideReleaseTransport, which includestransaction/profile/replay_event), consider expanding this list; otherwise it may be worth clarifying in docs/tests that the default matcher intentionally excludes them.
(args => {
const event = args.getEvent(['event', 'replay_event']);
if (
event?.extra?.[MULTIPLEXED_TRANSPORT_EXTRA_KEY] &&
Array.isArray(event.extra[MULTIPLEXED_TRANSPORT_EXTRA_KEY])
) {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const envelope = createEnvelope<EventEnvelope>({ event_id: 'aa3ff046696b4bc6b609ce6d28fde9e2', sent_at: '123' }, [ | ||
| [ | ||
| { type: 'replay_event' }, | ||
| { | ||
| ...REPLAY_EVENT, | ||
| extra: { | ||
| [MULTIPLEXED_TRANSPORT_EXTRA_KEY]: [DSN1, DSN2], | ||
| }, | ||
| }, | ||
| ] as EventItem, | ||
| ]); |
There was a problem hiding this comment.
This test creates a replay_event envelope item but asserts it as EventEnvelope / EventItem. Using the wrong envelope/item types in tests can hide real shape differences for replay envelopes. Consider typing the envelope/item as a generic Envelope/EnvelopeItem (or ReplayEnvelope if you include the full replay envelope structure) instead of asserting EventItem.
size-limit report 📦
|
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This PR adds
replay_eventto the multiplex router matcher events so it can match against replay events, previously it used the plaingetEvent()which defaulted to justeventenvelopes.Closes #20346