Skip to content

♻️ split Assembly into MainAssembly and RendererPipeline#133

Merged
bcaudan merged 8 commits into
mainfrom
bcaudan/renderer-assembly
Jun 19, 2026
Merged

♻️ split Assembly into MainAssembly and RendererPipeline#133
bcaudan merged 8 commits into
mainfrom
bcaudan/renderer-assembly

Conversation

@bcaudan

@bcaudan bcaudan commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Assembly handled two unrelated things: renderer events (pre-assembled by the browser SDK, needing a few native attributes injected) and main-process events (assembled from scratch via the full hook chain).
All renderer tracks share the same origin (the bridge) and the same minimal enrichment need.

Splitting into MainAssembly and RendererPipeline makes the bridge the single entry point for all renderer events, keeps enrichment logic colocated, and makes adding future renderer tracks (logs, telemetry) straightforward.

Changes

  • Introduced MainAssembly, handling main-process RawEvents via the existing triggerRum/triggerTelemetry hook chain.
  • Introduced RendererPipeline, owning the bridge IPC channel and assembling renderer events. Emits END_USER_ACTIVITY for click actions before the session check, so a click after session inactivity expiry renews the session even when its timestamp falls outside the closed session window.
  • Added triggerRenderer hook registered by SessionContext, ViewContext, and commonContext for timestamp-based context injection on renderer events.
  • Removed source from RawEvent types; all raw events are now invariably main-process originated.

Test instructions

yarn typecheck && yarn test

Checklist

  • Tested locally (playground)
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated related documentation.

bcaudan added 3 commits June 9, 2026 17:57
- RendererAssembly owns BRIDGE_CHANNEL/CONFIG_CHANNEL IPC, calls triggerRenderer hook, emits ServerRumEvent{source:RENDERER} directly
- UserActivityTracker now subscribes to ServerRumEvent{source:RENDERER} instead of RawRumEvent
- Remove renderer assembly logic from Assembly
- `Assembly` → `MainAssembly`
- `source` field removed from `RawRumEvent` / `RawTelemetryEvent` (always main-process)
- `BridgeHandler` deleted
@bcaudan bcaudan force-pushed the bcaudan/renderer-assembly branch from 95ec394 to 9757676 Compare June 9, 2026 16:16
@bcaudan

bcaudan commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 97576760c3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/domain/UserActivityTracker.ts Outdated
@bcaudan bcaudan changed the title ♻️ split Assembly into MainAssembly and RendererAssembly ♻️ split Assembly into MainAssembly and RendererPipeline Jun 11, 2026
bcaudan added 3 commits June 11, 2026 15:33
Use generateTelemetryErrors (IPC, no button click) so no browser SDK action is buffered before session close.
Otherwise, a delayed delivery of the pre-expiry click would accidentally renew the session
…ivity tracking

- rename RendererAssembly → RendererPipeline (broader responsibilities)
- emit END_USER_ACTIVITY for clicks before the DISCARDED check, so a click
  after session expiry renews the session even when its timestamp falls
  outside the closed session window
- delete UserActivityTracker (now superseded by RendererPipeline)
@bcaudan bcaudan force-pushed the bcaudan/renderer-assembly branch from 9757676 to 9af1dc2 Compare June 11, 2026 13:33
@bcaudan

bcaudan commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@bcaudan bcaudan marked this pull request as ready for review June 11, 2026 13:39
@bcaudan bcaudan requested a review from a team as a code owner June 11, 2026 13:39
* after session inactivity expiry can create a new session even though the event itself
* would be discarded (its timestamp falls outside the closed session window).
*/
export class RendererPipeline {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure merging BridgeHandler into RendererPipeline is the right call here. We're merging together two classes with very distinct responsibilities, IPC transport and event enrichment. It would be better to keep the concerns separate, with a RendererAssembly to enrich renderer events.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had also in mind the coming changes with replay records being handled separately.

So we have:

  • IPC message handling
  • Some messages being enriched and sent through the event manager
  • Some messages being handled by a dedicated class

That is why I have introduced a RendererPipeline instead of just a RendererAssembly, I felt that we needed an orchestrator for all that.
IMO, we could let it grow with the other event types and see which parts we'd want to extract then.

Comment thread src/assembly/RendererPipeline.ts Outdated
Comment thread src/assembly/commonContext.ts Outdated
- add `source: EventSource` to RumAssembleParams, TelemetryAssembleParams, SpanAssembleParams
- remove triggerRenderer, registerRenderer, RendererHookResult, RendererAssembleParams
- switch on source in commonContext.registerRum and ViewContext.registerRum
- RendererPipeline calls triggerRum(source: RENDERER) instead of triggerRenderer
- update all call sites, specs, and architecture doc
@bcaudan bcaudan requested a review from cdn34dd June 16, 2026 15:23

@cdn34dd cdn34dd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, with the current changes integrating the SR PR will be much simpler now.

@bcaudan bcaudan merged commit d53b615 into main Jun 19, 2026
15 checks passed
@bcaudan bcaudan deleted the bcaudan/renderer-assembly branch June 19, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants