Skip to content

feat(browser): hold route policy through page retirement - #14518

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-webcontents-bindingfrom
sta-4150-browser-page-release-barrier
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-webcontents-bindingfrom
sta-4150-browser-page-release-barrier

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​161 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​160
Prod 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​164 $\color{#cf222e}{\Huge{\mathbf{−}}}$​47 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​117

Summary

Adds the next inert STA-4150 lifecycle layer on top of #14517:

  • gives each prepared logical page an opaque main-owned authority token
  • synchronously revokes navigation and closes the exact registered guest when that authority is released
  • keeps the partition outside attachment admission and retains route policy while close is delayed, fails, or cannot be inspected
  • blocks same-tuple reuse and accounts retiring pages against the existing bounded page capacity
  • clears shared partition policy only after every exact guest emits destroyed
  • fences duplicate, wrong-authority, stale, and cross-page retirement callbacks

Causal evidence

The parent had no release handshake: logical authority could disappear while the loaded guest, requests, and route-policy teardown proceeded independently. The first release candidate also treated an exception from Electron destroyed inspection as destroyed, which fresh security review proved could clear policy under an unknown/live guest. The final deterministic oracle holds cleanup until the explicit destroyed event, including delayed close, retirement-start failure, inspection failure, two pages sharing one partition, stale acknowledgement replay, and capacity pressure.

Validation

  • 3 focused files / 119 tests
  • 56 main-browser files / 760 tests
  • full typecheck
  • native and type-aware code-quality audits
  • changed-code, reliability-manifest, max-lines, formatting, and diff checks
  • fresh correctness and security/performance rereviews: no publication blockers
  • parent feat(browser): quarantine client-hosted WebContents before navigation #14517 CI fully green after one diagnosed Linux watchdog timeout rerun

Compatibility and rollout

No exchanged field, RPC, capability advertisement, persisted schema, renderer IPC, or production page-preparation/registration/grant caller changes in this PR. Existing local/server/offscreen browsers, old clients, SSH/WSL routes, folder workspaces, git worktrees, and headed/headless/browserless placement retain current behavior.

This barrier is deliberately fail-closed but not activation-ready. A close that never reaches destroyed or a retirement that cannot start reserves policy and capacity indefinitely. WebContents destruction also does not prove service workers, downloads, active requests, connections, storage, or network-service state have settled. Process/document crash fencing, bounded recovery, real Electron ordering/traffic capture, and physical macOS/Linux/Windows coverage remain required.

Linear: https://linear.app/stably/issue/STA-4150/refactor-remote-browser-to-client-hosted-electron-webviews

Stack: #14471
Parent: #14517

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch from 7e8d547 to 3eb76b2 Compare August 14, 2026 20:02
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch from 3eb76b2 to 2ac237f Compare August 14, 2026 20:14
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch from 2ac237f to 6536b1a Compare August 14, 2026 21:01
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch from 6536b1a to 40b79ec Compare August 14, 2026 23:17
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch 2 times, most recently from 0bcd5b4 to 974b150 Compare August 15, 2026 00:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch from 974b150 to faddf1e Compare August 15, 2026 02:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch from faddf1e to 5e6ff39 Compare August 15, 2026 03:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch 2 times, most recently from bd06fe4 to c225947 Compare August 15, 2026 10:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch 2 times, most recently from bd77c69 to 8f92fb7 Compare August 15, 2026 12:30
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-page-release-barrier branch from 8f92fb7 to fea8290 Compare August 16, 2026 09:09
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing because this exact-page retirement barrier stage is already implemented on main (a93e31a9339). I reviewed the proposed production patch, body, discussion, and added regression intent against the current modules.

BrowserRoutePreparedPageLedger keeps active and retiring pages distinct and charged against the same capacity. Session retirement revokes active authority immediately, denies new attachment, and retains policy until the exact guest destruction callback. The WebContents registry matches the opaque page authority, closes only that guest, and does not treat failed destroyed-state inspection as proof of destruction. All eight introduced test cases remain.

Shared-partition retirement, delayed/failed closure, failed retirement startup, wrong authority, duplicate/stale acknowledgment, and tuple reuse are retained; newer lifecycle modules compose these checks rather than reintroducing an independent cleanup path.

Validation: the six current partition/session/WebContents/main-window suites passed 106 tests with ORCA_BACKGROUND_LAUNCH=1 and two workers. This establishes supersession of this stage; it does not assert all of STA-4150’s original cross-platform activation criteria are complete.

@OrcaWin OrcaWin closed this Oct 26, 2026
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