Skip to content

feat(native): docs, gate wiring, CodeQL triage, and fixes the gates found (phase 6) - #13

Merged
unohee merged 1 commit into
masterfrom
feat/native-rollout-docs
Oct 25, 2026
Merged

unohee merged 1 commit into
masterfrom
feat/native-rollout-docs

Conversation

@unohee

@unohee unohee commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Stacked on #12. This is phase 6 of the plan. The native driver is not at parity yet: the repo's own gates, run on it, found gaps (table below). The default driver does not change in this PR.

What

  • Docs
    • README gets a "Drivers" section: what native is, what it does differently, and its measured status.
    • docs/VEGA_INTEGRATION.md describes the path without Playwright.
    • Measured: the native real-browser runs pass with playwright and patchright blocked from importing, and no Playwright module gets loaded.
  • Gates can run on native
    • build_tools reads LYRA_BROWSER_DRIVER, and the gates that take --driver now accept native.
    • The downloads gate's temp-dir scan now also looks in native's parking dir. Without that, its "nothing left behind" checks passed on native without checking anything.
    • New: scripts/verify_native_parity_e2e.py.
  • Fixes the gates found
    • IIFE evaluation: function vs. expression is now decided in the browser.
    • Focus emulation is set per page, so a key press reaches a page with nothing focused.
    • New: Page.aria_snapshot.
    • The download parking dir now follows TMPDIR.

CodeQL (python-security-and-quality)

[real defects in native code: 0 / noise: 41 under src/]

  • Noise
    • 20 cyclic imports. Every reverse import is under TYPE_CHECKING; each module was imported on its own first to confirm.
    • A function import flagged as a mutable attribute.
    • A guarded raise and Protocol stub bodies, both in existing code.
    • Results from copies under worktrees/ and testing/.
    • Dev scripts that run loopback test servers.
  • Tidied: two intentional empty except blocks now carry a comment, and one needless lambda is gone.
  • Outside this change: uat/procs.py reads /proc files and leaves closing them to refcounting (minor).

Gates: native vs. playwright, both with the cdp guard (2026-10-23, Chrome 155, macOS)

gate playwright native
forms, wait, scriptredirect* pass forms and wait pass; scriptredirect stops at context.set_default_timeout
click pass stops at page.input_value (called by the gate itself)
downloads pass 71 checks pass, then a download started by a popup is not seen
dialogs pass navigating away from a beforeunload page answers needs_approval
snapshot* — stops at page.content
click_refusal* fails at check 3 (timeout) 67 checks pass, then the internal:control=enter-frame selector is unsupported
redirect_hop* fails at POST 307 stops at context.set_default_timeout
browser, cdp_guard* fail at "declared submission executes" (timeout) fail earlier: a key press does not reach the page's keydown listener
tabs fails (headful relaunch) an unapproved popup leaves a tab open
motion fails at "every batch loaded: 40" the same check fails

* run with --driver native; the rest with LYRA_BROWSER_DRIVER=native. The Playwright failures in the table also happen without native: they are this machine's baseline.

…ound (phase 6)

Docs: README "Drivers" says what native is, what it does differently (no
Runtime.enable, sandbox on, cdp guard, Playwright's switches) and, measured,
that it is not at parity yet; VEGA_INTEGRATION.md describes the no-Playwright
path. Measured: the native real-browser runs pass with playwright and
patchright blocked from importing, and no Playwright module loads.

Gates: build_tools takes LYRA_BROWSER_DRIVER and the gates with their own
--driver flag accept "native", so the repo's gates run on it; the downloads
gate's temp-dir scan also looks in the native driver's parking dir, without
which its "nothing left behind" checks passed vacuously on native.
scripts/verify_native_parity_e2e.py compares the tree view with Playwright's.

Fixes from running the gates on native:
- evaluate decides function vs expression in the browser, as Playwright
  does: an IIFE "(() => {...})()" was called as a function and failed;
- Emulation.setFocusEmulationEnabled per page, as Playwright does: a key
  press with nothing focused never reached the page;
- Page.aria_snapshot for the whole document;
- the download parking dir follows TMPDIR as it is at launch.

CodeQL (python-security-and-quality, SARIF in /tmp/lyra-codeql/lyra.sarif):
165 results, 41 under src/. Real defects in the native code: 0; two
intentionally empty excepts now say why, one needless lambda removed.
Noise: 20 cyclic imports (every reverse import is under TYPE_CHECKING;
measured, each module imports first on its own), a function import flagged
as a mutable attribute, results from worktrees/ and testing/ copies, and
dev-script findings on loopback test servers. Outside this change: the
/proc reads in uat/procs.py leave closing to the refcount (minor).

Verified: pytest 1755 passed (2 pre-existing macOS sha256sum failures
deselected); the phase 1-5 real-browser runs and the parity script pass.
Gates on native vs playwright (both cdp guard) are in the PR.
@unohee
unohee force-pushed the feat/native-rollout-docs branch from b2bbf85 to 1af6429 Compare October 25, 2026 04:03
@unohee
unohee changed the base branch from feat/native-wait-observe to master October 25, 2026 04:03
@unohee
unohee marked this pull request as ready for review October 25, 2026 04:03
@unohee
unohee merged commit cffec41 into master Oct 25, 2026
4 checks passed
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