Skip to content

feat(browser): require placement retirement before replacement - #14536

Closed
Jinwoo-H wants to merge 1 commit into
sta-4150-browser-capability-placementfrom
sta-4150-browser-placement-replacement-barrier
Closed

Jinwoo-H wants to merge 1 commit into
sta-4150-browser-capability-placementfrom
sta-4150-browser-placement-replacement-barrier

Conversation

@Jinwoo-H

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

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 4 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​97 $\color{#cf222e}{\Huge{\mathbf{−}}}$​7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​90
Prod 3 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​24 $\color{#cf222e}{\Huge{\mathbf{−}}}$​13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​11

ELI5

A logical browser page can live either on the server or in a client Electron webview. This change prevents Orca from swapping that engine underneath the same page ID: the exact old placement must be retired before any new one can be created.

What Changed

  • Reject client-to-client, client-to-server, server-to-server, and server-to-client overwrites.
  • Check occupied-page authority before resolving a replacement client host.
  • Keep placement capacity occupied until exact-token retirement.
  • Preserve monotonic page generations and reject stale cleanup against replacements.
  • Record the replacement barrier in the existing browser-route reliability gate.

Why

STA-4150 requires explicit runtime-owned placement and forbids silent migration between client and server engines. Without this barrier, a retry or reconnect could overwrite the placement record while the prior Electron WebContents or server page remained alive, creating split authority and unsafe cleanup.

This remains inert scaffolding. It adds no production caller, RPC/event, exchanged field, capability advertisement, Electron/renderer path, or server-placement behavior. The future lifecycle coordinator must fence commands and network, settle exact close/destroy or reclaim, and only then retire the placement.

Linked Issue

STA-4150

Visual Proof

N/A — no rendered UI or production behavior is activated.

Testing

  • Parent behavior: 3/3 initial causal tests failed because occupied placements were overwritten.

  • Focused candidate: 26/26 placement, lease, capability-downgrade, and replacement tests passed.

  • Full src/main/runtime + src/main/browser: 4,946 passed, 5 existing skips.

  • Adjacent RPC/protocol/mixed-version wire: 26/26 passed.

  • Full typecheck, native/type-aware audits, changed-code audit, formatting, reliability manifest, max-lines ratchet, and diff checks passed.

  • Three fresh correctness, security/performance, and Electron-lifecycle reviews found no publication blocker.

  • I manually validated the deterministic runtime behavior locally

  • Automated tests added

Review

Please review replacement error precedence, exact-token retirement, capacity retention, generation monotonicity, and the intentionally inactive production surface.

Checklist

  • This PR is small and focused
  • I explained what changed and why, including ELI5
  • Visual proof is N/A because no UI path is active
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, mobile, and backward-compatibility impact considered
  • Relevant local tests, typecheck, audits, and quality gates pass; package builds are covered by CI

@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch from 32c0c7f to f9a670a Compare August 14, 2026 20:03
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch from f9a670a to 1bd6512 Compare August 14, 2026 20:14
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch 2 times, most recently from 690c6ff to 76b611f Compare August 14, 2026 23:17
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch 2 times, most recently from 97b4433 to ac8a864 Compare August 15, 2026 00:57
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch 2 times, most recently from 380458e to 4b059e5 Compare August 15, 2026 03:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch 2 times, most recently from 4c1a8af to 8193e24 Compare August 15, 2026 10:24
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch 2 times, most recently from c4ef356 to f5f1966 Compare August 15, 2026 12:30
@Jinwoo-H
Jinwoo-H force-pushed the sta-4150-browser-placement-replacement-barrier branch from f5f1966 to a297b67 Compare August 16, 2026 09:09
@OrcaWin

OrcaWin commented Oct 26, 2026

Copy link
Copy Markdown
Collaborator

Closing because this stage is already implemented on current main (a93e31a93395953b795e9f5098a6b93c8ee331af) under src/main/runtime/browser-host/.

browser-host-page-placement.ts rejects an occupied or reserved page before replacement and retains its capacity until retirement. browser-host-client-page-placement.ts checks admission before selecting a host. The replacement-barrier suite already covers all client/server overwrite directions, admission precedence, capacity, monotonic generations and stale cleanup; retirement has since advanced to an explicit begin/complete protocol. The reliability gate records these same invariants.

I reviewed the complete patch and discussion against the current implementation and tests. This is a redundant stage closure, not a claim that every broader STA-4150 activation or live-topology requirement is 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