Skip to content

✨ Apply consent to renderer execution contexts - #235

Open
rgaignault wants to merge 6 commits into
romanG/rum-15526-context-lifecyclefrom
romanG/rum-15526-renderer-consent
Open

rgaignault wants to merge 6 commits into
romanG/rum-15526-context-lifecyclefrom
romanG/rum-15526-renderer-consent

Conversation

@rgaignault

@rgaignault rgaignault commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Keep renderer execution-context durations and identities consistent with consent while an Electron window remains open. Builds on the session and main-process lifecycle changes in #234.

Changes

  • Split execution contexts at consent boundaries and preserve terminal updates from granted periods.
  • Stop context events and periodic updates while consent is refused, while retaining window lifecycle listeners.
  • Resume live windows without reviving crashed or destroyed renderers; retain navigation readiness across consent and session changes.

These are Electron window execution contexts. Browser SDK event admission and replay collection are unchanged.

Test instructions

  • yarn exec vitest run --maxWorkers=2 — 1,374 tests passed across the complete stack.
  • Source TypeScript checks, changed-file lint and SDK build passed.
  • Coverage includes session renewal, terminal-event authorization, windows opened between sessions, destruction, and renderer crash/reload.

Checklist

  • Tested locally (playground)
  • Added unit tests for this change.
  • Added e2e/integration tests for this change.
  • Updated related documentation.
  • Agentic code review findings addressed or explicitly dismissed.

@rgaignault
rgaignault added this pull request to stack #236 October 2, 2026 12:17
@rgaignault

Copy link
Copy Markdown
Collaborator Author

@codex review

@rgaignault
rgaignault marked this pull request as ready for review October 2, 2026 12:22
@rgaignault
rgaignault requested a review from a team as a code owner October 2, 2026 12:22
@rgaignault

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T09:44:37.254406Z f5d4cd7 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: d20fbb094a

ℹ️ 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".

@cursor cursor 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.

Stale comment

PR Review — Quality: 3.5 / 5 · Review load: Focused (~30–45min)

The consent handling for renderer execution contexts is in good shape and needs one round before merge. Open windows split on granted/pending, stop while refused, and resume without reviving a crashed or destroyed renderer, matching MainProcessContext. A renderer that becomes active during the sessionless gap still loses the granted period's terminal update when consent changes. This stays dormant until something calls TrackingConsentManager.update — this branch does not export that — so the rollout risk is that invariant, not a change to today's default.

Customer impact: High — With consent left at its initial granted value, renderer contexts behave as they do today. Once consent is updated on this manager, refusing it stops renderer execution-context reporting while the window stays open, and the last granted update is meant to stay in authorized storage.

Concern
Renderer execution-context lifetime across consent, session expiry, and crash reload Risky

Quality — 3.5: The split, refusal, and resume paths are correct for a window already tracked in an active session, including crash reload and a synchronous renew after expiry. The tests match those paths and the architecture note matches the diff. One manager subscription, closePeriod, and the same early return MainProcessContext uses is a sound shape. What holds this below 5.0 is the sessionless gap: that early return assumes the previous period was already closed, and nothing covers a renderer that starts while the session is expired.

Review load — Focused (~30–45min): One risky boundary, the renderer execution-context lifetime, together with the consent and session ordering it depends on. The docs and unit tests sit on that same boundary.

Findings

  • [Minor] Gap-window consent change drops the granted terminal update — RendererProcessContexts.ts:295 returns once SESSION_RENEW has replaced a still-active gap context, and register() closes that context without emitting it. Emit the terminal update from register() before starting the replacement.
Open in Web View Automation 

Sent by Cursor Automation: electron-sdk reviews

Comment thread src/domain/rum/executionContext/RendererProcessContexts.ts

@cursor cursor 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.

Stale comment

PR Review — Quality: 5.0 / 5 · Review load: Focused (~15–45min)

Renderer execution contexts now follow consent the same way the main process already does: a granted or pending change splits the open period, refusal stops context events and heartbeats, and a crashed or destroyed window stays closed when tracking resumes. Session renewal runs before the consent handler and the early return keeps that from rotating the window twice; the reload name stays unresolved until dom-ready even when consent or the session changes mid-reload. Approve. GitLab integration was still running when this was posted.

Customer impact: High — Execution contexts stay off unless enableExecutionContext is set, and consent still starts as granted. When both are in use, an open renderer window splits at each consent boundary and stops reporting while consent is refused.

Concern
Renderer execution contexts follow consent, including resume and reload naming Risky

Quality — 5.0: The split, the refusal pause, and the crash or destroy veto are correct, including when session renewal has already started the new period. Tests cover delayed init, refusal, reload naming, and crash-after-expiry in proportion to that lifecycle. The architecture note matches the pause and the naming rule. The shape matches MainProcessContext and ViewCollection, so the next consent change has the same boundary to follow.

Review load — Focused (~15–45min): One risky boundary: renderer window lifetime against consent and session renewal, including the reload name guard. The doc and test updates sit on that same path.

Open in Web View Automation 

Sent by Cursor Automation: electron-sdk reviews

@cursor cursor 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.

Stale comment

PR Review — Quality: 3.5 / 5 · Review load: Focused (~30–45min)

The consent handling for renderer execution contexts is in good shape and needs one round before merge. Open windows split on granted/pending, stop while refused, and resume without reviving a crashed or destroyed renderer, matching MainProcessContext. A renderer that becomes active during the sessionless gap still loses the granted period's terminal update when consent changes. This stays dormant until something calls TrackingConsentManager.update — this branch does not export that — so the rollout risk is that invariant, not a change to today's default.

Customer impact: High — With consent left at its initial granted value, renderer contexts behave as they do today. Once consent is updated on this manager, refusing it stops renderer execution-context reporting while the window stays open, and the last granted update is meant to stay in authorized storage.

Concern
Renderer execution-context lifetime across consent, session expiry, and crash reload Risky

Quality — 3.5: The split, refusal, and resume paths are correct for a window already tracked in an active session, including crash reload and a synchronous renew after expiry. The tests match those paths and the architecture note matches the diff. One manager subscription, closePeriod, and the same early return MainProcessContext uses is a sound shape. What holds this below 5.0 is the sessionless gap: that early return assumes the previous period was already closed, and nothing covers a renderer that starts while the session is expired.

Review load — Focused (~30–45min): One risky boundary, the renderer execution-context lifetime, together with the consent and session ordering it depends on. The docs and unit tests sit on that same boundary.

Findings

  • [Minor] Gap-window consent change drops the granted terminal update — RendererProcessContexts.ts:295 returns once SESSION_RENEW has replaced a still-active gap context, and register() closes that context without emitting it. Emit the terminal update from register() before starting the replacement.
Open in Web View Automation 

Sent by Cursor Automation: electron-sdk reviews

Comment thread src/domain/rum/executionContext/RendererProcessContexts.ts

@cursor cursor 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.

PR Review — Quality: 5.0 / 5 · Review load: Focused (~30min–45min)

Quality is 5.0. I would approve and merge this. Renderer execution contexts follow the same consent rules as the main process: a consent change closes the current period and, when the window is still alive and consent is granted or pending, starts the next period at that same timestamp. Listeners stay installed while consent is refused, so a later grant resumes a live page and leaves a crashed renderer stopped until its own reload. Navigation readiness sits on the window manager, so a consent or session change during a reload cannot freeze the pre-crash URL. enableExecutionContext still defaults off and consent still starts granted, so this reporting change applies only after both are turned on.

Customer impact: High — With execution contexts left disabled, or with consent left at its initial granted state, renderer reporting is unchanged. Enabling execution contexts and then refusing consent stops context events and heartbeats for windows that stay open; a granted period's final update stays authorized, and a crash is not revived by the grant alone.

Concern
Renderer execution-context consent lifecycle Risky

Quality — 5.0: The consent, session, crash, and reload paths agree, including renew-before-consent so a period is not opened twice. The unit tests cover refusal, pending and granted splits, windows created while denied, and a reload whose name stays unresolved across those boundaries. The architecture notes match that behavior. The shape is sound: it matches MainProcessContext, where a session renewal may already have opened the new period and the consent handler leaves that period in place.

Review load — Focused (~30min–45min): One risky boundary: renderer context lifetime at consent changes, read together with session expiry and crash revival. The tests and architecture note are that same boundary.

Open in Web View Automation 

Sent by Cursor Automation: electron-sdk reviews

cursor[bot]

This comment was marked as spam.

@maciejburda
maciejburda requested a review from bcaudan October 5, 2026 07:11
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.

1 participant