Repository navigation
Conversation
|
|
Hi @ghazy2001, thanks for your interest in contributing! This project requires that pull request authors are vouched, and you are not in the list of vouched users. This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details. |
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
| const propSessionId = | ||
| typeof props?.session === "string" && props.session.length > 0 ? props.session : undefined; | ||
| const propIo = props?.io === "out" || props?.io === "in" ? props.io : undefined; | ||
| const propChannel = | ||
| typeof props?.channel === "string" && props.channel.length > 0 ? props.channel : undefined; | ||
|
|
||
| let sessionId = propSessionId; | ||
| let io: string | undefined = propIo; | ||
| let channel = propChannel; | ||
|
|
||
| if (!sessionId || !io) { |
There was a problem hiding this comment.
🟡 Redacted spans break stream playback
When a span processor masks a session key, extractSessionStreamEntity uses the masked key for playback. UserSpanProcessorWrapper preserves the original entity ID, which previously supplied the key. The dashboard requests a session that does not exist.
Learn more
A session-stream span carries its address both in an internal entity ID and in public telemetry attributes, as shown in the output stream emitter. Projects can install a span processor that masks emails before those attributes reach the dashboard. UserSpanProcessorWrapper restores the internal ID but leaves the public attributes redacted. SpanEntity uses the extracted address to open the stream, so refreshing does not help.
Example: A task writes to the default output stream for alex@example.com. The documented email scrubber changes the public session attribute to [email] but leaves the entity ID as alex@example.com::out. The previous viewer opened the existing stream; the new viewer requests [email] and gets a 404 unless a session exists under that placeholder.
Recommended fix: Make the protected entity ID authoritative for current-format stream addresses, parsing the direction and channel from the right and removing the input run prefix. Use public attributes only for formats where they are needed to disambiguate the protected ID, or where the ID is absent. Add a regression case with a scrubbed public session attribute and an intact entity ID.
Was this helpful? React with 👍 or 👎 to provide feedback.
| it("resolves session stream fields from properties when entityId is absent", () => { | ||
| expect( | ||
| extractSessionStreamEntity({ | ||
| entityId: undefined, | ||
| properties: { | ||
| session: "user:abc:def", | ||
| io: "in", | ||
| }, | ||
| }) | ||
| ).toEqual({ | ||
| sessionId: "user:abc:def", | ||
| channel: undefined, | ||
| io: "in", | ||
| metadata: undefined, | ||
| }); | ||
| }); |
There was a problem hiding this comment.
🔍 Properties-only test bypasses storage gate
getSpan requires an entity ID before it emits a ClickHouse span entity. The helper test does not cover what the dashboard receives when that ID is missing.
Was this helpful? React with 👍 or 👎 to provide feedback.
| const sessionStream = extractSessionStreamEntity({ | ||
| entityId: span.entity.id, | ||
| entityMetadata: span.entity.metadata, | ||
| properties: span.properties, | ||
| }); |
There was a problem hiding this comment.
🔍 Missing dashboard fix release note
The dashboard fix is user-facing and server-only, but the PR omits the required server release note.
Was this helpful? React with 👍 or 👎 to provide feedback.
Closes #5160
✅ Checklist
Testing
unId is never merged into sessionId
un_ when resolved from span properties
ull
Verified locally from �pps/webapp:
ode ../../node_modules/vitest/vitest.mjs run test/sessionStreamEntity.test.ts (7 passed)
Changelog
Previously, SpanPresenter parsed session-stream entities by splitting span.entity.id on : and indexing parts.at(-3) as sessionId, truncating session keys that contain : (such as clerk:user_XXXX:v2) and causing dashboard session-stream requests to 404.
Additionally, in stream spans include a leading ${runId}: prefix in entityId (${runId}:::in), whereas out spans use ${sessionId}::out.
extractSessionStreamEntity in �pps/webapp/app/presenters/v3/sessionStreamEntity.ts now prefers the unsplit session, channel, and io attributes on span.properties (emitted by both in and out session-stream spans), and falls back to entityId parsing that handles both out and ${runId}:-prefixed in formats.
Screenshots
N/A