Skip to content

refactor(browser): open verifier-script CDP sessions through the registered-command owner - #10710

Merged
morluto merged 1 commit into
refactor/typed-cdp-final-commandsfrom
refactor/scripts-registered-cdp-sessions
Nov 15, 2026
Merged

morluto merged 1 commit into
refactor/typed-cdp-final-commandsfrom
refactor/scripts-registered-cdp-sessions

Conversation

@morluto

@morluto morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner

Summary

Extends rea/no-raw-cdp-session to the browser verifier scripts (scripts/lib/browser-*-e2e.mjs, scripts/verify-browser-dom-destinations.mjs) and moves their five raw Playwright CDP sessions to newPlaywrightCdpSession. Stacked on #10666, which adds the owner and the rule for src/.

Problem and expected behavior

#10666 limited src/ to Playwright CDP sessions that send registered commands only. The verifier scripts still opened raw sessions, so their commands and replies bypassed the result schemas the product uses. They now open sessions through the same owner, and the lint rule keeps it that way.

Change and scope

  • .oxlintrc.json: the rea/no-raw-cdp-session scope now covers the two script globs.
  • browser-scenario-service-workers-e2e.mjs (3 sites), browser-viewport-screenshot-e2e.mjs (1), verify-browser-dom-destinations.mjs (1): use newPlaywrightCdpSession(context, page, operation) from dist.
  • CdpCommands.ts: registers Emulation.setPageScaleFactor (acknowledgement). The viewport-screenshot verifier sends it.
  • noRawCdpSessionRule.test.ts: the scope test now proves both script paths are reported.

Not included: the scripts' existing CdpConnection.send calls, which already go through the typed connection.

Contract and boundary impact

No product behaviour change. One acknowledgement schema is added to the command registry.

Evidence and regression coverage

tests/evaluation/noRawCdpSessionRule.test.ts fails with the previous .oxlintrc.json (the scripts are not reported) and passes with this change. npx oxlint reports browser-viewport-screenshot-e2e.mjs:33 on the unmigrated file.

Validation performed

  • npm run test:focused -- tests/evaluation/noRawCdpSessionRule.test.ts src/browser/protocol/CdpCommands.types.test.ts: 10 passed. Rule test alone with the old config: 1 failed, 6 passed.
  • npm run check:fast: passed.
  • npm run build:cached then REA_BROWSER_EXECUTABLE=<Chrome 157> npm run verify:browser:dom: verified: true, 2.8 s.
  • Not run: verify:browser (the full real-browser suite, including the viewport-screenshot and service-worker verifiers).

Compatibility

No user-visible change.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T01:47:31.686173Z dfcbc35 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.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge; no actionable issues were found.

Summary

Routes five verifier-script CDP sessions through newPlaywrightCdpSession.

  • Browser verifier sessions now check replies against registered schemas.

Source review only; no checks were run. GitHub access was unavailable, so whether another PR supersedes this one could not be confirmed. No higher dependent PR is listed in the supplied stack.

Reviews (1) · Last reviewed commit: "refactor(browser): open verifier-script ..." · Reviewed by Greptile

@morluto
morluto force-pushed the refactor/scripts-registered-cdp-sessions branch from 36f477b to 4f2a972 Compare November 15, 2026 01:24
@morluto
morluto force-pushed the refactor/typed-cdp-final-commands branch from d614d04 to 37e5133 Compare November 15, 2026 01:45
@morluto
morluto force-pushed the refactor/scripts-registered-cdp-sessions branch from 4f2a972 to dfcbc35 Compare November 15, 2026 01:46
@morluto
morluto merged commit 487d125 into refactor/typed-cdp-final-commands Nov 15, 2026
@morluto
morluto deleted the refactor/scripts-registered-cdp-sessions branch November 15, 2026 02:18
morluto added a commit that referenced this pull request Nov 15, 2026
morluto added a commit that referenced this pull request Nov 15, 2026
morluto added a commit that referenced this pull request Nov 15, 2026
…mas (#10666)

* refactor(browser): send only CDP commands with registered result schemas

* refactor(browser): open Playwright CDP sessions only through the registered-command owner

* fix(browser): keep the restore obligation for an applied override with a malformed reply

A schema-rejected success reply means the browser applied the Emulation
override, so the attached environment owner records the reset obligation
before reporting the protocol error. Only a rejected or unanswered command
leaves no obligation.

* refactor(browser): open verifier-script CDP sessions through the registered-command owner (#10710)

* fix(browser): register the CDP commands JavaScript verifiers send

The verifier scripts send Browser.close, Page.createIsolatedWorld, Page.navigate, Page.reload, Target.activateTarget, Target.closeTarget and Target.createTarget through CdpConnection, which now admits every reply through its command's result schema. Register those schemas, refuse an unregistered run-time name as a typed malformed reply instead of a TypeError, and check script send literals against the registry.

* fix(browser): keep Target.closeTarget's success member for the verifiers
morluto added a commit that referenced this pull request Nov 15, 2026
…wner (#10703)

* refactor(browser): send only CDP commands with registered result schemas

* refactor(browser): open Playwright CDP sessions only through the registered-command owner

* fix(browser): keep the restore obligation for an applied override with a malformed reply

A schema-rejected success reply means the browser applied the Emulation
override, so the attached environment owner records the reset obligation
before reporting the protocol error. Only a rejected or unanswered command
leaves no obligation.

* refactor(browser): open verifier-script CDP sessions through the registered-command owner (#10710)

* fix(browser): register the CDP commands JavaScript verifiers send

The verifier scripts send Browser.close, Page.createIsolatedWorld, Page.navigate, Page.reload, Target.activateTarget, Target.closeTarget and Target.createTarget through CdpConnection, which now admits every reply through its command's result schema. Register those schemas, refuse an unregistered run-time name as a typed malformed reply instead of a TypeError, and check script send literals against the registry.

* fix(browser): keep Target.closeTarget's success member for the verifiers

* test(browser): characterize target_changed rules per consumer

* refactor(browser): decide target_changed from one document identity owner

* fix(browser): compare the selected document on every authorization read

Final-capture retries and the pre-capture frame-tree read now observe each
reply through the selected document tracker before scope, and a screenshot
command failure after a proven document change reports target_changed with
the failure as its cause.
@morluto morluto added the area: cli CLI adapter and one-shot commands label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant