Repository navigation
refactor(browser): open verifier-script CDP sessions through the registered-command owner - #10710
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Low impact] This PR appears safe to merge; no actionable issues were found. SummaryRoutes five verifier-script CDP sessions through
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 |
36f477b to
4f2a972
Compare
…stered-command owner
d614d04 to
37e5133
Compare
4f2a972 to
dfcbc35
Compare
…stered-command owner (#10710)
…stered-command owner (#10710)
…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
…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.
Summary
Extends
rea/no-raw-cdp-sessionto the browser verifier scripts (scripts/lib/browser-*-e2e.mjs,scripts/verify-browser-dom-destinations.mjs) and moves their five raw Playwright CDP sessions tonewPlaywrightCdpSession. Stacked on #10666, which adds the owner and the rule forsrc/.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: therea/no-raw-cdp-sessionscope 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): usenewPlaywrightCdpSession(context, page, operation)fromdist.CdpCommands.ts: registersEmulation.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.sendcalls, 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.tsfails with the previous.oxlintrc.json(the scripts are not reported) and passes with this change.npx oxlintreportsbrowser-viewport-screenshot-e2e.mjs:33on 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:cachedthenREA_BROWSER_EXECUTABLE=<Chrome 157> npm run verify:browser:dom:verified: true, 2.8 s.verify:browser(the full real-browser suite, including the viewport-screenshot and service-worker verifiers).Compatibility
No user-visible change.
Author readiness
Human owner:
Before merge
type(scope): outcome.