diff --git a/config/flaky-test-pattern-baseline.txt b/config/flaky-test-pattern-baseline.txt index 6504f1f4da9..05e9370d936 100644 --- a/config/flaky-test-pattern-baseline.txt +++ b/config/flaky-test-pattern-baseline.txt @@ -4,9 +4,15 @@ 1 test-no-in-test-import-actual:src/cli/runtime/launch-serve-replaced-app-restart.test.ts 1 test-no-in-test-import-actual:src/main/agent-hooks/server-status-persist-nonblocking.test.ts 1 test-no-in-test-import-actual:src/main/bitbucket/credential-connection.test.ts +4 test-no-in-test-import-actual:src/main/bitbucket/credential-store.test.ts 1 test-no-in-test-import-actual:src/main/bitbucket/status-no-decrypt.test.ts +7 test-no-in-test-import-actual:src/main/browser/cookies/browser-cookie-import.comet.test.ts +10 test-no-in-test-import-actual:src/main/claude-usage/scanner-scan.test.ts 1 test-no-in-test-import-actual:src/main/claude/claude-agent-sdk-process-spawn.test.ts +3 test-no-in-test-import-actual:src/main/codex-accounts/runtime-home-read-only-launch-resolution.test.ts 1 test-no-in-test-import-actual:src/main/codex-accounts/runtime-home-wsl-system-default.test.ts +8 test-no-in-test-import-actual:src/main/daemon/endpoint/publication/testing/daemon-endpoint-publish.test.ts +2 test-no-in-test-import-actual:src/main/daemon/history/storage/testing/terminal-history-permissions.test.ts 1 test-no-in-test-import-actual:src/main/git/command-runner/spawned-command-tree-kill.test.ts 1 test-no-in-test-import-actual:src/main/ipc/filesystem/access/filesystem-auth.test.ts 1 test-no-in-test-import-actual:src/main/ipc/filesystem/filesystem-content-search-cancellation.test.ts @@ -14,33 +20,40 @@ 1 test-no-in-test-import-actual:src/main/linear/client.test.ts 1 test-no-in-test-import-actual:src/main/linear/linear-description-images.test.ts 1 test-no-in-test-import-actual:src/main/linear/linear-workspace-registry.test.ts +2 test-no-in-test-import-actual:src/main/managed-server/activation/orcad-activation-crash-recovery.test.ts 1 test-no-in-test-import-actual:src/main/managed-server/host-state/orcad-state-mutation-timeout.test.ts 1 test-no-in-test-import-actual:src/main/node-runtime/pinned-runtime-materializer.test.ts 1 test-no-in-test-import-actual:src/main/omp/omp-session-cwd-lookup.test.ts +6 test-no-in-test-import-actual:src/main/opencode/hook-service-legacy-acl.test.ts 1 test-no-in-test-import-actual:src/main/orcad/electron-serve-browser-process.test.ts 1 test-no-in-test-import-actual:src/main/orcad/electron-serve-provider-selection.test.ts 1 test-no-in-test-import-actual:src/main/providers/local-pty/local-pty-provider-foreground-process.test.ts 1 test-no-in-test-import-actual:src/main/pty/scrollback/overlay-mirror.test.ts 1 test-no-in-test-import-actual:src/main/pty/shell-startup/legacy-terminal-shim-dir.test.ts 1 test-no-in-test-import-actual:src/main/rate-limits/claude-profile-usage.test.ts -1 test-no-in-test-import-actual:src/main/runtime/rpc/server/pairing/mobile-pairing-userdata-path.test.ts 1 test-no-in-test-import-actual:src/main/runtime/orca-runtime-files-mobile-explorer-reads.test.ts 1 test-no-in-test-import-actual:src/main/runtime/orca-runtime-files-terminal-artifact-swap-detection.test.ts +1 test-no-in-test-import-actual:src/main/runtime/rpc/server/pairing/mobile-pairing-userdata-path.test.ts 1 test-no-in-test-import-actual:src/main/speech/openai-api-key-store.test.ts +5 test-no-in-test-import-actual:src/main/ssh/config/ssh-config-loader-regression.test.ts +2 test-no-in-test-import-actual:src/main/ssh/connection/ssh-connection-auth-fallback.test.ts 1 test-no-in-test-import-actual:src/main/ssh/orcad-snapshot-room.test.ts 1 test-no-in-test-import-actual:src/main/window/dropped-path-preparation.test.ts +2 test-no-in-test-import-actual:src/main/workspace-hooks/hooks-runner.test.ts 1 test-no-in-test-import-actual:src/main/workspaces/removal/local-worktree-removal-recovery.test.ts 1 test-no-in-test-import-actual:src/renderer/src/components/terminal-pane/pty-connection-hook-idle-arbitration.test.ts +3 test-no-in-test-import-actual:src/renderer/src/components/terminal-pane/remote-snapshot-alt-screen-host-chain.test.ts 1 test-no-in-test-import-actual:src/renderer/src/hooks/useAutomationDispatchEvents.test.ts 1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-agent-status-pane-teardown.test.ts 1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-agent-status-snapshot-hydration.test.ts +2 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-cli-worktree-activation.test.ts +3 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.ts 1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-rate-limit-hydration.test.ts 1 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-ssh-disconnect-cleanup.test.ts 1 test-no-in-test-import-actual:src/renderer/src/lib/agent-launch-caller-routing.test.ts 1 test-no-in-test-import-actual:tests/e2e/structured-agent-session-launch-admission.unit.test.ts 1 test-no-polling-loop:config/scripts/test-runtime/dom/happy-dom-mutation-observer-retention.test.ts 1 test-no-polling-loop:mobile/src/transport/rpc-client-live-recovery.test.ts -1 test-no-polling-loop:src/main/browser/cdp/transport/cdp-ws-proxy.test.ts 1 test-no-polling-loop:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts 1 test-no-polling-loop:src/main/claude/claude-stop-ack-race.test.ts 1 test-no-polling-loop:src/main/claude/claude-stream-json-connection.test.ts @@ -49,22 +62,27 @@ 1 test-no-polling-loop:src/main/claude/claude-supervised-stop.integration.test.ts 1 test-no-polling-loop:src/main/claude/structured/claude-structured-real-cli-fold.test.ts 1 test-no-polling-loop:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts +6 test-no-polling-loop:src/main/claude/structured/claude-structured-real-cli.test.ts 1 test-no-polling-loop:src/main/claude/structured/launch/claude-structured-real-cli-options.test.ts +3 test-no-polling-loop:src/main/cli/packaged-cli-assets.test.ts 1 test-no-polling-loop:src/main/codex/hooks/reconciliation/codex-hook-toggle-off-wins.test.ts 1 test-no-polling-loop:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts -1 test-no-polling-loop:src/main/daemon/transport/client/testing/client.test.ts -1 test-no-polling-loop:src/main/daemon/server/testing/daemon-idle-shutdown.test.ts 1 test-no-polling-loop:src/main/daemon/providers/adapter/testing/daemon-self-retirement-respawn.test.ts -1 test-no-polling-loop:src/main/daemon/server/testing/daemon-server.test.ts 1 test-no-polling-loop:src/main/daemon/pty-subprocess/testing/node-pty-conout-worker-errors.test.ts +1 test-no-polling-loop:src/main/daemon/server/testing/daemon-idle-shutdown.test.ts +1 test-no-polling-loop:src/main/daemon/server/testing/daemon-server.test.ts 1 test-no-polling-loop:src/main/daemon/sessions/testing/repro-12101-mouse-tracking-survives-agent-death.test.ts +1 test-no-polling-loop:src/main/daemon/transport/client/testing/client.test.ts +2 test-no-polling-loop:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts 1 test-no-polling-loop:src/main/ipc/folder-repo-git-upgrade.test.ts 1 test-no-polling-loop:src/main/ipc/native-chat.test.ts 1 test-no-polling-loop:src/main/ipc/runtime-environments/runtime-environment-request-connections.test.ts 1 test-no-polling-loop:src/main/ipc/worktrees/creation/worktree-base-directory-poller-marker-fanout.test.ts +2 test-no-polling-loop:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts 1 test-no-polling-loop:src/main/managed-server/install/orcad-remote-launch-file-modes.test.ts 1 test-no-polling-loop:src/main/managed-server/install/orcad-remote-launch.test.ts 1 test-no-polling-loop:src/main/managed-server/install/remote-node-runtime-store-lock-host-release.test.ts +2 test-no-polling-loop:src/main/native-chat/transcript-watch-liveness.test.ts 1 test-no-polling-loop:src/main/native-chat/transcript-watch.test.ts 1 test-no-polling-loop:src/main/provider-process/provider-group-orphan-guard.integration.test.ts 1 test-no-polling-loop:src/main/provider-process/provider-process-supervisor.integration.test.ts @@ -73,15 +91,23 @@ 1 test-no-polling-loop:src/main/pty/history/terminal-history-tombstone-scan-cost.test.ts 1 test-no-polling-loop:src/main/pty/process-retirement/posix-pty-process-groups.integration.test.ts 1 test-no-polling-loop:src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts +1 test-no-polling-loop:src/main/runtime/agent-session/environment/structured-agent-shell-environment.test.ts 1 test-no-polling-loop:src/main/runtime/orchestration-codex-real-pty.integration.test.ts 1 test-no-polling-loop:src/main/runtime/remote-runtime-request-connection.integration.test.ts -1 test-no-polling-loop:src/main/runtime/agent-session/environment/structured-agent-shell-environment.test.ts +2 test-no-polling-loop:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts +4 test-no-polling-loop:src/main/runtime/rpc/ws-transport.test.ts +3 test-no-polling-loop:src/main/skills/skill-bundle-process-termination.integration.test.ts 1 test-no-polling-loop:src/main/skills/skill-process-contention-child.test.ts 1 test-no-polling-loop:src/main/skills/skill-process-contention.integration.test.ts +2 test-no-polling-loop:src/main/skills/skill-process-termination.integration.test.ts +2 test-no-polling-loop:src/main/skills/skill-upload-process-restart.integration.test.ts 1 test-no-polling-loop:src/main/ssh/connection/ssh-connection-host-key-store-wiring.test.ts 1 test-no-polling-loop:src/main/ssh/legacy-relay/ssh-relay-endpoint-incumbent-shell.integration.test.ts +2 test-no-polling-loop:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts 1 test-no-polling-loop:src/main/startup/run-electron-vite-dev-web.test.ts 1 test-no-polling-loop:src/main/startup/run-electron-vite-dev.test.ts +2 test-no-polling-loop:src/main/windows/windows-host-job.win32.test.ts +1 test-no-polling-loop:src/main/windows/windows-pty-job.win32.test.ts 1 test-no-polling-loop:src/main/worker-thread-child-process/worker-thread-child-process.test.ts 1 test-no-polling-loop:src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts 1 test-no-polling-loop:src/main/wsl/orcad/wsl-orcad-connection.test.ts @@ -89,11 +115,12 @@ 1 test-no-polling-loop:src/main/wsl/orcad/wsl-orcad-stdio-bridge.test.ts 1 test-no-polling-loop:src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts 1 test-no-polling-loop:src/renderer/src/components/terminal-pane/issue-12112-agent-pane-startup-color-reply-leak.repro.test.ts +2 test-no-polling-loop:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts 1 test-no-polling-loop:src/shared/darwin-terminal-names-real-ps.test.ts 1 test-no-polling-loop:src/shared/fish-query-reply-child-stdin.node-pty.test.ts -1 test-no-polling-loop:src/shared/terminal/pty/ingress/pty-reply-echo-shapes.node-pty.test.ts 1 test-no-polling-loop:src/shared/remote-runtime/control/remote-runtime-shared-control-standing-intent.test.ts 1 test-no-polling-loop:src/shared/startup-command-staging.node-pty.test.ts +1 test-no-polling-loop:src/shared/terminal/pty/ingress/pty-reply-echo-shapes.node-pty.test.ts 1 test-no-polling-loop:tests/e2e/agent-session-live-force-exit-resume.spec.ts 1 test-no-polling-loop:tests/e2e/agent-session-log-tail-stability.spec.ts 1 test-no-polling-loop:tests/e2e/artificial-opencode-pane-interactions.ts @@ -102,19 +129,24 @@ 1 test-no-polling-loop:tests/e2e/browser-guest-crash-recovery.spec.ts 1 test-no-polling-loop:tests/e2e/browser-tab.spec.ts 1 test-no-polling-loop:tests/e2e/chinese-ime-chat-input-repro.spec.ts +3 test-no-polling-loop:tests/e2e/combined-diff-scroll-restore.spec.ts 1 test-no-polling-loop:tests/e2e/computer-windows.e2e.ts 1 test-no-polling-loop:tests/e2e/cross-version-wire/released-relay-daemon.ts 1 test-no-polling-loop:tests/e2e/cross-version-wire/released-relay-transport.ts 1 test-no-polling-loop:tests/e2e/daemon-lifecycle-retirement.spec.ts 1 test-no-polling-loop:tests/e2e/fixtures/daemon-generation-legacy-close-client.ts 1 test-no-polling-loop:tests/e2e/fixtures/daemon-generation-reconnect-client.ts +2 test-no-polling-loop:tests/e2e/floating-workspace-reopen-webgl-recovery.spec.ts 1 test-no-polling-loop:tests/e2e/floating-workspace-shared-glyph-atlas.spec.ts 1 test-no-polling-loop:tests/e2e/golden-core-flows.spec.ts 1 test-no-polling-loop:tests/e2e/helpers/computer-cli-driver.ts +2 test-no-polling-loop:tests/e2e/helpers/computer-driver.ts 1 test-no-polling-loop:tests/e2e/helpers/daemon-generation-processes.ts 1 test-no-polling-loop:tests/e2e/helpers/electron-process-shutdown.ts 1 test-no-polling-loop:tests/e2e/helpers/headless-layout-oracle-hosts.ts 1 test-no-polling-loop:tests/e2e/helpers/hold-window-graph-publication.ts +2 test-no-polling-loop:tests/e2e/helpers/layout-compat-baseline.ts +2 test-no-polling-loop:tests/e2e/helpers/legacy-relay-docker-host.ts 1 test-no-polling-loop:tests/e2e/helpers/orca-app.ts 1 test-no-polling-loop:tests/e2e/helpers/orca-restart.ts 1 test-no-polling-loop:tests/e2e/helpers/orca-serve-cli-host.ts @@ -126,34 +158,56 @@ 1 test-no-polling-loop:tests/e2e/helpers/terminal-typing-benchmark.ts 1 test-no-polling-loop:tests/e2e/helpers/workspace-layout-oracle-markers.ts 1 test-no-polling-loop:tests/e2e/helpers/workspace-layout-oracle.ts +3 test-no-polling-loop:tests/e2e/host-parked-pane-remote-viewer.spec.ts 1 test-no-polling-loop:tests/e2e/large-file-count-fixtures.ts 1 test-no-polling-loop:tests/e2e/orchestration-idle-mail-delivery.spec.ts +5 test-no-polling-loop:tests/e2e/paced-terminal-typing.ts +2 test-no-polling-loop:tests/e2e/paired-instant-browser-tab.spec.ts 1 test-no-polling-loop:tests/e2e/paired-remote-browser-ghost-subscriber-rejoin.spec.ts +3 test-no-polling-loop:tests/e2e/paired-remote-terminal-client-restart-survival.spec.ts 1 test-no-polling-loop:tests/e2e/paired-remote-terminal-materialization-reconnect.spec.ts 1 test-no-polling-loop:tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts 1 test-no-polling-loop:tests/e2e/paired-remote-terminal-parked-scrollback-restart.spec.ts 1 test-no-polling-loop:tests/e2e/paired-two-client-emptied-workspace-reseed.spec.ts 1 test-no-polling-loop:tests/e2e/project-group-manual-sort.spec.ts 1 test-no-polling-loop:tests/e2e/slept-workspace-remount-wake.spec.ts +2 test-no-polling-loop:tests/e2e/terminal-column-desync-repro.spec.ts +2 test-no-polling-loop:tests/e2e/terminal-column-probes.ts +2 test-no-polling-loop:tests/e2e/terminal-hidden-view-parking.spec.ts +4 test-no-polling-loop:tests/e2e/terminal-inline-tui-reveal-convergence.spec.ts 1 test-no-polling-loop:tests/e2e/terminal-opencode-emoji-table-rendering.spec.ts 1 test-no-polling-loop:tests/e2e/terminal-pane-close-layout-consistency.spec.ts +2 test-no-polling-loop:tests/e2e/terminal-parked-memory.spec.ts +2 test-no-polling-loop:tests/e2e/terminal-pty-readiness.ts 1 test-no-polling-loop:tests/e2e/terminal-tab-screenshot.ts +2 test-no-polling-loop:tests/e2e/terminal-tab-switch-visual-restore.spec.ts +2 test-no-polling-loop:tests/e2e/terminal-tui-wheel-reports.spec.ts 1 test-no-polling-loop:tests/e2e/workspace-sleep-in-main.spec.ts +2 test-no-polling-loop:tests/e2e/worktree-card-downward-drag.spec.ts 1 test-no-polling-loop:tests/e2e/worktree-switch-first-paint.spec.ts +2 test-no-real-time-wait:config/scripts/test-runtime/dom/happy-dom-mutation-observer-retention.test.ts +2 test-no-real-time-wait:mobile/src/notifications/push-registration-cancellation.test.ts 1 test-no-real-time-wait:mobile/src/tasks/worktree-create-retry.test.ts 1 test-no-real-time-wait:mobile/src/terminal/terminal-web-document-mount.test.ts 1 test-no-real-time-wait:mobile/src/terminal/terminal-webview-tap-routing.test.ts 1 test-no-real-time-wait:mobile/src/transport/mobile-relay-runtime-failover.test.ts +4 test-no-real-time-wait:mobile/src/transport/rpc-client-live-recovery.test.ts 1 test-no-real-time-wait:mobile/src/transport/rpc-operation-barrier.test.ts 1 test-no-real-time-wait:mobile/src/transport/rpc-operation.test.ts 1 test-no-real-time-wait:src/main/agent-hooks/posix-hook-json-stdin-reader.test.ts +3 test-no-real-time-wait:src/main/agent-hooks/server-copilot-normalization.test.ts 1 test-no-real-time-wait:src/main/agent-hooks/server-opencode-binder.test.ts +2 test-no-real-time-wait:src/main/agent-hooks/server-transport-interference.test.ts 1 test-no-real-time-wait:src/main/agent-hooks/server-turn-ended-at.test.ts 1 test-no-real-time-wait:src/main/agent-hooks/server-turn-started-at.test.ts +10 test-no-real-time-wait:src/main/agent-hooks/wsl-hook-relay-manager.test.ts 1 test-no-real-time-wait:src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process.test.ts +2 test-no-real-time-wait:src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-scan-scope.test.ts 1 test-no-real-time-wait:src/main/antigravity/windows-hook-json-post.test.ts 1 test-no-real-time-wait:src/main/antigravity/windows-hook-payload-delivery.test.ts 1 test-no-real-time-wait:src/main/browser/cdp/input/guest-focused-frame-route.test.ts +4 test-no-real-time-wait:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts +2 test-no-real-time-wait:src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts 1 test-no-real-time-wait:src/main/browser/guest-lifecycle/popups/browser-popup-native-compatibility.electron.test.ts 1 test-no-real-time-wait:src/main/browser/identity/browser-session-ua-cloudflare-live.electron.test.ts 1 test-no-real-time-wait:src/main/browser/identity/browser-session-ua-wire-identity-cross-context.electron.test.ts @@ -162,35 +216,59 @@ 1 test-no-real-time-wait:src/main/browser/network/tunnels/execution-route-socket-duplex.test.ts 1 test-no-real-time-wait:src/main/browser/network/tunnels/remote-browser-socks-server.test.ts 1 test-no-real-time-wait:src/main/claude-accounts/claude-login-session.test.ts +2 test-no-real-time-wait:src/main/claude-accounts/claude-profile-router.test.ts +3 test-no-real-time-wait:src/main/claude-accounts/claude-profile-wsl-router.test.ts 1 test-no-real-time-wait:src/main/claude-accounts/runtime-auth-service.test.ts 1 test-no-real-time-wait:src/main/claude-usage/scanner-incremental-reader.test.ts 1 test-no-real-time-wait:src/main/claude/claude-agent-sdk-exit-proof.test.ts 1 test-no-real-time-wait:src/main/claude/claude-agent-sdk-user-message-queue.test.ts +3 test-no-real-time-wait:src/main/claude/claude-cli-flag-support.test.ts 1 test-no-real-time-wait:src/main/claude/claude-stop-ack-race.test.ts +2 test-no-real-time-wait:src/main/claude/claude-stream-json-connection.test.ts 1 test-no-real-time-wait:src/main/claude/claude-subagent-permission-request.test.ts 1 test-no-real-time-wait:src/main/claude/claude-supervised-stop-real-cli.test.ts 1 test-no-real-time-wait:src/main/claude/claude-supervised-stop.integration.test.ts +2 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli-fold.test.ts +2 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts +6 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli.test.ts 1 test-no-real-time-wait:src/main/claude/structured/launch/claude-structured-real-cli-options.test.ts +3 test-no-real-time-wait:src/main/cli/packaged-cli-assets.test.ts +3 test-no-real-time-wait:src/main/codex/hooks/installation/hook-service-concurrent-launch-install.test.ts 1 test-no-real-time-wait:src/main/codex/hooks/installation/hook-service-managed-codex-hashes.test.ts +3 test-no-real-time-wait:src/main/codex/hooks/reconciliation/codex-hook-reconcile.test.ts 1 test-no-real-time-wait:src/main/codex/hooks/reconciliation/codex-hook-toggle-off-wins.test.ts 1 test-no-real-time-wait:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts 1 test-no-real-time-wait:src/main/codex/structured/turns/codex-structured-turn-open-wait.test.ts 1 test-no-real-time-wait:src/main/codex/trust/hooks/codex-hook-hash-lookup.test.ts 1 test-no-real-time-wait:src/main/computer/desktop-script-runtime-host.test.ts 1 test-no-real-time-wait:src/main/computer/macos-computer-use-permission-status.test.ts -1 test-no-real-time-wait:src/main/daemon/launch/testing/daemon-bundle-staleness.test.ts 1 test-no-real-time-wait:src/main/daemon/executable-host/windows/testing/daemon-host-file-hash-cache.test.ts -1 test-no-real-time-wait:src/main/daemon/server/testing/daemon-idle-shutdown.test.ts -1 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-self-retirement-respawn.test.ts -1 test-no-real-time-wait:src/main/daemon/server/testing/daemon-server.test.ts -1 test-no-real-time-wait:src/main/daemon/providers/checkpointing/testing/daemon-shutdown-final-checkpoint-caller-deadline.test.ts +1 test-no-real-time-wait:src/main/daemon/launch/testing/daemon-bundle-staleness.test.ts 1 test-no-real-time-wait:src/main/daemon/permissions/testing/daemon-tcc-attribution.test.ts +2 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-daemon-recovery.test.ts +6 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-checkpoints.test.ts +2 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-recovery.test.ts +5 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-session-adoption.test.ts +5 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter.test.ts +1 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-self-retirement-respawn.test.ts +1 test-no-real-time-wait:src/main/daemon/providers/checkpointing/testing/daemon-shutdown-final-checkpoint-caller-deadline.test.ts +2 test-no-real-time-wait:src/main/daemon/pty-subprocess/testing/node-pty-conout-worker-errors.test.ts +3 test-no-real-time-wait:src/main/daemon/pty-subprocess/testing/node-pty-fd-leak.test.ts +4 test-no-real-time-wait:src/main/daemon/pty-subprocess/testing/node-pty-windows-input-error.win32.test.ts 1 test-no-real-time-wait:src/main/daemon/pty-subprocess/testing/node-pty-windows-output-error.win32.test.ts +1 test-no-real-time-wait:src/main/daemon/server/testing/daemon-idle-shutdown.test.ts +1 test-no-real-time-wait:src/main/daemon/server/testing/daemon-server.test.ts +11 test-no-real-time-wait:src/main/daemon/sessions/testing/reattach-snapshot.test.ts 1 test-no-real-time-wait:src/main/daemon/sessions/testing/repro-12101-mouse-tracking-survives-agent-death.test.ts +4 test-no-real-time-wait:src/main/daemon/sessions/testing/session-shell-recovery.test.ts 1 test-no-real-time-wait:src/main/daemon/sessions/testing/session.test.ts -1 test-no-real-time-wait:src/main/daemon/terminal-host/testing/terminal-host.test.ts +6 test-no-real-time-wait:src/main/daemon/shell-readiness/testing/repro-13767-shell-ready-marker-lost-to-exec.test.ts 1 test-no-real-time-wait:src/main/daemon/shell-readiness/testing/terminal-shell-recovery-barrier.test.ts +1 test-no-real-time-wait:src/main/daemon/terminal-host/testing/terminal-host.test.ts +3 test-no-real-time-wait:src/main/daemon/transport/client/testing/client.test.ts +2 test-no-real-time-wait:src/main/foreign-sqlite-readers/foreign-sqlite-reader-event-loop.test.ts 1 test-no-real-time-wait:src/main/git/refs/maintenance/local-repo-ref-maintenance.test.ts +4 test-no-real-time-wait:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts 1 test-no-real-time-wait:src/main/git/source-control/status-submodule.test.ts 1 test-no-real-time-wait:src/main/git/worktrees/creation/worktree-configured-paths-concurrency.test.ts 1 test-no-real-time-wait:src/main/git/worktrees/removal/remove-worktree-branch-cleanup.test.ts @@ -199,34 +277,55 @@ 1 test-no-real-time-wait:src/main/grok/grok-hook-stdin-no-eof.test.ts 1 test-no-real-time-wait:src/main/ipc/created-worktree-reconciliation.test.ts 1 test-no-real-time-wait:src/main/ipc/filesystem/access/filesystem-auth.test.ts +5 test-no-real-time-wait:src/main/ipc/filesystem/local-disk-write-precondition.test.ts 1 test-no-real-time-wait:src/main/ipc/filesystem/watcher-process/parcel-watcher-shallow-file-subscription.test.ts 1 test-no-real-time-wait:src/main/ipc/filesystem/watcher-process/rebinding-file-watch-noise.test.ts 1 test-no-real-time-wait:src/main/ipc/filesystem/watcher-process/rebinding-file-watch.test.ts +2 test-no-real-time-wait:src/main/ipc/folder-repo-git-upgrade.test.ts +2 test-no-real-time-wait:src/main/ipc/native-chat.test.ts 1 test-no-real-time-wait:src/main/ipc/pty/host-env/spawn-cwd-hung-folder.test.ts 1 test-no-real-time-wait:src/main/ipc/pty/pty-agent-launch-pane-attach.test.ts 1 test-no-real-time-wait:src/main/ipc/pty/pty-daemon-controller-teardown.test.ts 1 test-no-real-time-wait:src/main/ipc/pty/pty-launch-parity.test.ts +3 test-no-real-time-wait:src/main/ipc/runtime-environments/runtime-environment-preference.test.ts +4 test-no-real-time-wait:src/main/ipc/runtime-environments/runtime-environment-request-connections.test.ts +2 test-no-real-time-wait:src/main/ipc/workspace-cleanup/workspace-cleanup-snapshot-ipc.test.ts +2 test-no-real-time-wait:src/main/ipc/worktrees-background-removal.test.ts 1 test-no-real-time-wait:src/main/ipc/worktrees-detected-scan-cache.test.ts 1 test-no-real-time-wait:src/main/ipc/worktrees/creation/worktree-base-directory-poller-marker-fanout.test.ts +14 test-no-real-time-wait:src/main/ipc/worktrees/creation/worktree-base-directory-poller.test.ts +6 test-no-real-time-wait:src/main/ipc/worktrees/git/worktree-git-common-polling.test.ts +6 test-no-real-time-wait:src/main/ipc/worktrees/git/worktree-git-common-watch.test.ts +2 test-no-real-time-wait:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts +5 test-no-real-time-wait:src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts 1 test-no-real-time-wait:src/main/managed-server/install/orcad-remote-launch-file-modes.test.ts 1 test-no-real-time-wait:src/main/managed-server/install/orcad-remote-launch.test.ts 1 test-no-real-time-wait:src/main/managed-server/install/orcad-remote-shell-commands.integration.test.ts +2 test-no-real-time-wait:src/main/managed-server/install/orcad-remote-windows-scripts.test.ts +2 test-no-real-time-wait:src/main/managed-server/install/remote-node-runtime-store-lock-host-release.test.ts 1 test-no-real-time-wait:src/main/managed-server/lifecycle/orcad-managed-tunnel-local-port.test.ts 1 test-no-real-time-wait:src/main/managed-server/lifecycle/orcad-stdio-bridge-provider.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-accept-then-deliver.test.ts +3 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-at-rest-commands.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-claude-echo-working.test.ts +2 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-claude-subagent-row.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-owed-work-release.test.ts +3 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-command.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-quit.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-refused-card.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-restart-cap.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-restart-offer-withdrawal.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-restart-ownership.test.ts +2 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-start-admission.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-stop-aborts-start.test.ts 1 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-target-reconcile.test.ts 1 test-no-real-time-wait:src/main/native-chat/transcript-opencode2-sqlite.test.ts 1 test-no-real-time-wait:src/main/native-chat/transcript-watch-error.test.ts +2 test-no-real-time-wait:src/main/native-chat/transcript-watch-liveness.test.ts +11 test-no-real-time-wait:src/main/native-chat/transcript-watch.test.ts 1 test-no-real-time-wait:src/main/opencode/hook-plugin-legacy-tui-ownership.test.ts +6 test-no-real-time-wait:src/main/opencode/hook-plugin-module-contract.test.ts 1 test-no-real-time-wait:src/main/opencode/hook-plugin-opencode2-tui-ownership.test.ts 1 test-no-real-time-wait:src/main/opencode/opencode-startup-prompt-source.test.ts 1 test-no-real-time-wait:src/main/orcad/orcad-bundled-runtime.integration.test.ts @@ -235,103 +334,165 @@ 1 test-no-real-time-wait:src/main/orcad/orcad-node-launcher.integration.test.ts 1 test-no-real-time-wait:src/main/orcad/orcad-secret-store.test.ts 1 test-no-real-time-wait:src/main/orcad/orcad-serve-parity.integration.test.ts +4 test-no-real-time-wait:src/main/orcad/orcad-stop-request-listener.test.ts 1 test-no-real-time-wait:src/main/provider-process/provider-group-orphan-guard.integration.test.ts +3 test-no-real-time-wait:src/main/provider-process/provider-process-supervisor.integration.test.ts 1 test-no-real-time-wait:src/main/providers/agent-foreground-process-git-bash.win32.test.ts +2 test-no-real-time-wait:src/main/providers/startup-line-typed-length.live-shell.test.ts +2 test-no-real-time-wait:src/main/pty/history/terminal-history-fish-session.node-pty.test.ts +2 test-no-real-time-wait:src/main/pty/history/terminal-history-tombstone-scan-cost.test.ts 1 test-no-real-time-wait:src/main/pty/process-retirement/node-pty-master-fd-retirement.test.ts 1 test-no-real-time-wait:src/main/pty/process-retirement/posix-pty-process-groups.integration.test.ts +5 test-no-real-time-wait:src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts 1 test-no-real-time-wait:src/main/rate-limits/opencode-go-usage-fetcher.test.ts +4 test-no-real-time-wait:src/main/runtime/agent-session/environment/structured-agent-shell-environment.test.ts +1 test-no-real-time-wait:src/main/runtime/agent-session/lifecycle/claude-structured-idle-releases-unknown.test.ts 1 test-no-real-time-wait:src/main/runtime/agent-session/structured-agent-session-legacy-send-behind-command.test.ts 1 test-no-real-time-wait:src/main/runtime/agent-session/structured-agent-session-provider-operations-while-starting.test.ts 1 test-no-real-time-wait:src/main/runtime/agent-session/structured-agent-session-runtime-exit.test.ts 1 test-no-real-time-wait:src/main/runtime/agent-session/structured-agent-session-runtime.test.ts -1 test-no-real-time-wait:src/main/runtime/agent-session/lifecycle/claude-structured-idle-releases-unknown.test.ts -1 test-no-real-time-wait:src/main/runtime/terminal/wait/launched-agent-crash-guard.live-shell.test.ts -1 test-no-real-time-wait:src/main/runtime/terminal/wait/launched-agent-shell-handoff-readiness.test.ts +3 test-no-real-time-wait:src/main/runtime/layout-command-pane-starts-layout-owner.test.ts 1 test-no-real-time-wait:src/main/runtime/mobile-desktop-relay/mobile-desktop-relay.integration.test.ts 1 test-no-real-time-wait:src/main/runtime/mobile-desktop-relay/mobile-desktop-relay.test.ts 1 test-no-real-time-wait:src/main/runtime/orca-runtime-files-mobile-explorer-reads.test.ts +3 test-no-real-time-wait:src/main/runtime/orchestration-codex-real-pty.integration.test.ts 1 test-no-real-time-wait:src/main/runtime/owned-session-teardown-policy.test.ts 1 test-no-real-time-wait:src/main/runtime/remote-runtime-request-connection.integration.test.ts 1 test-no-real-time-wait:src/main/runtime/restored-pane-start-cli-handles.test.ts 1 test-no-real-time-wait:src/main/runtime/rpc/methods/agent-launch-instant-tab.test.ts +2 test-no-real-time-wait:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts +1 test-no-real-time-wait:src/main/runtime/rpc/server/runtime-rpc-client-activity.test.ts +1 test-no-real-time-wait:src/main/runtime/rpc/server/runtime-rpc-dispatch-inject-long-poll.test.ts +6 test-no-real-time-wait:src/main/runtime/rpc/server/runtime-rpc-long-poll-transport.test.ts 1 test-no-real-time-wait:src/main/runtime/rpc/terminal-multiplex-input-sequence-replay.test.ts 1 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-admission.test.ts 1 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-mounted-pane.test.ts 1 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-ownership.test.ts -1 test-no-real-time-wait:src/main/runtime/rpc/server/runtime-rpc-client-activity.test.ts -1 test-no-real-time-wait:src/main/runtime/rpc/server/runtime-rpc-dispatch-inject-long-poll.test.ts +3 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-reconnect-rebind.test.ts +6 test-no-real-time-wait:src/main/runtime/rpc/ws-transport.test.ts 1 test-no-real-time-wait:src/main/runtime/sidebar-inputs/paired-server-rows-producer.test.ts +1 test-no-real-time-wait:src/main/runtime/terminal/wait/launched-agent-crash-guard.live-shell.test.ts +1 test-no-real-time-wait:src/main/runtime/terminal/wait/launched-agent-shell-handoff-readiness.test.ts +2 test-no-real-time-wait:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts 1 test-no-real-time-wait:src/main/runtime/workspaces/removal/structured-session-worktree-teardown.test.ts +4 test-no-real-time-wait:src/main/runtime/workspaces/removal/worktree-teardown-unstopped-pty.test.ts +3 test-no-real-time-wait:src/main/skills/skill-bundle-process-termination.integration.test.ts 1 test-no-real-time-wait:src/main/skills/skill-cloud-direct-upload.test.ts 1 test-no-real-time-wait:src/main/skills/skill-process-contention-child.test.ts 1 test-no-real-time-wait:src/main/skills/skill-process-contention.integration.test.ts +3 test-no-real-time-wait:src/main/skills/skill-process-termination.integration.test.ts +2 test-no-real-time-wait:src/main/skills/skill-upload-process-restart.integration.test.ts +4 test-no-real-time-wait:src/main/ssh/connection/ssh-connection-host-key-store-wiring.test.ts 1 test-no-real-time-wait:src/main/ssh/legacy-relay/legacy-relay-cli-server.test.ts 1 test-no-real-time-wait:src/main/ssh/legacy-relay/ssh-relay-endpoint-incumbent-shell.integration.test.ts +2 test-no-real-time-wait:src/main/ssh/sftp-upload.test.ts 1 test-no-real-time-wait:src/main/ssh/ssh-credential-prompt-login-grace-wire.test.ts +2 test-no-real-time-wait:src/main/ssh/ssh-quit-abort-upload.test.ts +2 test-no-real-time-wait:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts 1 test-no-real-time-wait:src/main/startup/main-process-ready-duplicate-pty-repair.test.ts +3 test-no-real-time-wait:src/main/startup/run-electron-vite-dev-web.test.ts +3 test-no-real-time-wait:src/main/startup/run-electron-vite-dev.test.ts +2 test-no-real-time-wait:src/main/startup/windows-install-dir-acl-recovery.test.ts 1 test-no-real-time-wait:src/main/updater/lifecycle/serve-supervisor-install-park.test.ts 1 test-no-real-time-wait:src/main/updater/updater.quit-and-install.test.ts 1 test-no-real-time-wait:src/main/window/main-window-updater-deferred-setup.test.ts +3 test-no-real-time-wait:src/main/windows/windows-host-job.win32.test.ts 1 test-no-real-time-wait:src/main/windows/windows-process-tree-command-line-patch.test.ts +2 test-no-real-time-wait:src/main/windows/windows-pty-job.win32.test.ts 1 test-no-real-time-wait:src/main/worker-thread-child-process/worker-thread-child-process.test.ts 1 test-no-real-time-wait:src/main/workspaces/creation/preparation/worktree-create-preparation-cancellation.test.ts 1 test-no-real-time-wait:src/main/workspaces/creation/preparation/worktree-preparation-discard-retry.test.ts 1 test-no-real-time-wait:src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts +2 test-no-real-time-wait:src/main/wsl/execution/wsl-command-loop.test.ts 1 test-no-real-time-wait:src/main/wsl/orcad/wsl-orcad-connection.test.ts +2 test-no-real-time-wait:src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts 1 test-no-real-time-wait:src/main/wsl/orcad/wsl-orcad-stdio-bridge.test.ts +3 test-no-real-time-wait:src/main/wsl/orcad/wsl-orcad-watch.test.ts 1 test-no-real-time-wait:src/renderer/src/components/UpdateCard.error-card.test.tsx +4 test-no-real-time-wait:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx 1 test-no-real-time-wait:src/renderer/src/components/activity/activity-portal-readiness-loop.react185.test.tsx 1 test-no-real-time-wait:src/renderer/src/components/editor/DiagramViewerModal.test.tsx 1 test-no-real-time-wait:src/renderer/src/components/editor/combined-diff/load-sections/combined-diff-stale-analysis-work-budget.test.tsx 1 test-no-real-time-wait:src/renderer/src/components/native-chat/NativeChatModelCombobox.test.tsx 1 test-no-real-time-wait:src/renderer/src/components/native-chat/native-chat-composer-draft-lifecycle.test.tsx +4 test-no-real-time-wait:src/renderer/src/components/native-chat/native-chat-composer-draft-store.test.ts 1 test-no-real-time-wait:src/renderer/src/components/status-bar/NativeChatResumeStatusSegment.test.tsx +2 test-no-real-time-wait:src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts 1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/issue-12112-agent-pane-startup-color-reply-leak.repro.test.ts +3 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-connection-hidden-backlog-snapshot.test.ts 1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/remote-runtime-connect-failure-recovery.test.ts +2 test-no-real-time-wait:src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-exit-record.test.ts +3 test-no-real-time-wait:src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-subscribe-ack-input.test.ts 1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/resolve-split-cwd.test.ts 1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/terminal-fit-restore.test.ts 1 test-no-real-time-wait:src/renderer/src/components/terminal-pane/terminal-ime-xterm-preedit-cell-grid.test.ts 1 test-no-real-time-wait:src/renderer/src/hooks/runtime-project-refresh-scheduler.test.ts 1 test-no-real-time-wait:src/renderer/src/lib/agent-hibernation-coordinator.test.ts +2 test-no-real-time-wait:src/renderer/src/lib/execute-open-editor-path-move.test.ts 1 test-no-real-time-wait:src/renderer/src/lib/native-chat-cli-fork-preparation.test.ts 1 test-no-real-time-wait:src/renderer/src/lib/orca-yaml-trust-prompt-slot-eviction.test.ts 1 test-no-real-time-wait:src/renderer/src/store/slices/github-pr-checks-fetch.test.ts +2 test-no-real-time-wait:src/renderer/src/store/slices/workspace-cleanup-removal-preflight.test.ts 1 test-no-real-time-wait:src/renderer/src/store/terminals/legacy-relay-bridged-tab-close.test.ts +2 test-no-real-time-wait:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts +3 test-no-real-time-wait:src/shared/darwin-process-table-capture.test.ts 1 test-no-real-time-wait:src/shared/darwin-terminal-names-real-ps.test.ts 1 test-no-real-time-wait:src/shared/darwin-terminal-names.test.ts +5 test-no-real-time-wait:src/shared/fish-query-reply-child-stdin.node-pty.test.ts 1 test-no-real-time-wait:src/shared/git/status/git-branch-line-total-soft-deadline.test.ts +2 test-no-real-time-wait:src/shared/remote-runtime/control/remote-runtime-shared-control-auth-refusal.test.ts 1 test-no-real-time-wait:src/shared/remote-runtime/control/remote-runtime-shared-control-standing-intent.test.ts 1 test-no-real-time-wait:src/shared/remote-runtime/remote-runtime-outbound-admission.test.ts 1 test-no-real-time-wait:src/shared/secure-file-windows.test.ts 1 test-no-real-time-wait:src/shared/secure-path-windows-acl.win32.test.ts 1 test-no-real-time-wait:src/shared/setup-agent-sequencing-codex-no-daemon.test.ts +2 test-no-real-time-wait:src/shared/setup-agent-sequencing.test.ts +2 test-no-real-time-wait:src/shared/startup-command-staging.node-pty.test.ts +4 test-no-real-time-wait:src/shared/terminal/pty/ingress/pty-reply-echo-shapes.node-pty.test.ts 1 test-no-real-time-wait:src/wsl-guest/agent-hook-canonical-status.test.ts +6 test-no-real-time-wait:src/wsl-guest/agent-hook-server.test.ts 1 test-no-real-time-wait:tests/e2e/accumulated-workspace-status-fixture.ts 1 test-no-real-time-wait:tests/e2e/agent-session-live-force-exit-resume.spec.ts +3 test-no-real-time-wait:tests/e2e/agent-session-log-tail-stability.spec.ts 1 test-no-real-time-wait:tests/e2e/artificial-opencode-pane-interactions.ts 1 test-no-real-time-wait:tests/e2e/artificial-opencode-revisit-pressure-scenario.ts 1 test-no-real-time-wait:tests/e2e/artificial-opencode-scroll-scenario.ts 1 test-no-real-time-wait:tests/e2e/browser-guest-crash-recovery.spec.ts 1 test-no-real-time-wait:tests/e2e/browser-tab.spec.ts +9 test-no-real-time-wait:tests/e2e/chinese-ime-chat-input-repro.spec.ts +2 test-no-real-time-wait:tests/e2e/cli-floating-file-open-position.spec.ts 1 test-no-real-time-wait:tests/e2e/codex-ctrl-c-status.spec.ts +4 test-no-real-time-wait:tests/e2e/combined-diff-scroll-restore.spec.ts 1 test-no-real-time-wait:tests/e2e/computer-windows.e2e.ts 1 test-no-real-time-wait:tests/e2e/cross-version-wire/cross-version-agent-session-wire.unit.test.ts +3 test-no-real-time-wait:tests/e2e/cross-version-wire/host-model-catalog-released-phone.unit.test.ts 1 test-no-real-time-wait:tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts 1 test-no-real-time-wait:tests/e2e/cross-version-wire/released-relay-daemon.ts +2 test-no-real-time-wait:tests/e2e/cross-version-wire/released-relay-transport.ts 1 test-no-real-time-wait:tests/e2e/daemon-lifecycle-retirement.spec.ts +2 test-no-real-time-wait:tests/e2e/default-tabs-mark-crash-relaunch.spec.ts 1 test-no-real-time-wait:tests/e2e/diff-note-draft.spec.ts +2 test-no-real-time-wait:tests/e2e/droid-notification.spec.ts +2 test-no-real-time-wait:tests/e2e/editor-tab-selection-restore.spec.ts 1 test-no-real-time-wait:tests/e2e/file-explorer-linked-watch-refresh.spec.ts 1 test-no-real-time-wait:tests/e2e/file-explorer-watch-refresh.spec.ts 1 test-no-real-time-wait:tests/e2e/fixtures/daemon-generation-legacy-close-client.ts 1 test-no-real-time-wait:tests/e2e/fixtures/daemon-generation-reconnect-client.ts +4 test-no-real-time-wait:tests/e2e/floating-workspace-reopen-webgl-recovery.spec.ts +4 test-no-real-time-wait:tests/e2e/floating-workspace-shared-glyph-atlas.spec.ts +2 test-no-real-time-wait:tests/e2e/github-project-board.spec.ts 1 test-no-real-time-wait:tests/e2e/golden-core-flows.spec.ts 1 test-no-real-time-wait:tests/e2e/headless-paired-remote-terminal-reveal-grid.spec.ts 1 test-no-real-time-wait:tests/e2e/headless-paired-remote-terminal-viewer-size.spec.ts +2 test-no-real-time-wait:tests/e2e/helpers/computer-cli-driver.ts +4 test-no-real-time-wait:tests/e2e/helpers/computer-driver.ts 1 test-no-real-time-wait:tests/e2e/helpers/daemon-generation-processes.ts 1 test-no-real-time-wait:tests/e2e/helpers/electron-main-evaluate-retry.ts 1 test-no-real-time-wait:tests/e2e/helpers/electron-process-shutdown.ts 1 test-no-real-time-wait:tests/e2e/helpers/headless-layout-oracle-hosts.ts 1 test-no-real-time-wait:tests/e2e/helpers/hold-window-graph-publication.ts +2 test-no-real-time-wait:tests/e2e/helpers/layout-compat-baseline.ts +2 test-no-real-time-wait:tests/e2e/helpers/legacy-relay-docker-host.ts 1 test-no-real-time-wait:tests/e2e/helpers/orca-app.ts 1 test-no-real-time-wait:tests/e2e/helpers/orca-restart.ts 1 test-no-real-time-wait:tests/e2e/helpers/orca-serve-cli-host.ts @@ -341,31 +502,54 @@ 1 test-no-real-time-wait:tests/e2e/helpers/paired-desktop-server-layout.ts 1 test-no-real-time-wait:tests/e2e/helpers/paired-electron-client.ts 1 test-no-real-time-wait:tests/e2e/helpers/paired-host-terminal.ts +3 test-no-real-time-wait:tests/e2e/helpers/remote-session-bulk-open-oracle.ts 1 test-no-real-time-wait:tests/e2e/helpers/restored-terminal-input-readiness.ts 1 test-no-real-time-wait:tests/e2e/helpers/terminal-pty-write-spy.ts 1 test-no-real-time-wait:tests/e2e/helpers/terminal-typing-benchmark.ts +2 test-no-real-time-wait:tests/e2e/helpers/workspace-layout-oracle-markers.ts +2 test-no-real-time-wait:tests/e2e/helpers/workspace-layout-oracle.ts 1 test-no-real-time-wait:tests/e2e/hidden-workspace-notifications.spec.ts +3 test-no-real-time-wait:tests/e2e/host-parked-pane-remote-viewer.spec.ts +2 test-no-real-time-wait:tests/e2e/host-terminal-agent-phone-push.spec.ts +7 test-no-real-time-wait:tests/e2e/korean-ime-terminal-shift-enter-commit.spec.ts 1 test-no-real-time-wait:tests/e2e/large-file-count-fixtures.ts 1 test-no-real-time-wait:tests/e2e/large-markdown-preview.spec.ts 1 test-no-real-time-wait:tests/e2e/layout-stream-loss-reopen.spec.ts 1 test-no-real-time-wait:tests/e2e/markdown-table-row-backspace.spec.ts 1 test-no-real-time-wait:tests/e2e/native-chat-history-prepend-anchor.spec.ts +3 test-no-real-time-wait:tests/e2e/notification-sound-replay.spec.ts +5 test-no-real-time-wait:tests/e2e/orchestration-idle-mail-delivery.spec.ts 1 test-no-real-time-wait:tests/e2e/orchestration-idle-mail-restore.spec.ts +4 test-no-real-time-wait:tests/e2e/paced-terminal-typing.ts 1 test-no-real-time-wait:tests/e2e/paired-client-hosted-browser-double-restart.spec.ts 1 test-no-real-time-wait:tests/e2e/paired-client-hosted-browser-ghost-close.spec.ts +4 test-no-real-time-wait:tests/e2e/paired-client-hosted-browser-network-outage.spec.ts +2 test-no-real-time-wait:tests/e2e/paired-client-hosted-browser-quit-survival.spec.ts 1 test-no-real-time-wait:tests/e2e/paired-host-usage-credentials.spec.ts +6 test-no-real-time-wait:tests/e2e/paired-instant-browser-tab.spec.ts +2 test-no-real-time-wait:tests/e2e/paired-remote-browser-ghost-subscriber-rejoin.spec.ts +2 test-no-real-time-wait:tests/e2e/paired-remote-browser-stream-reconnect.spec.ts +3 test-no-real-time-wait:tests/e2e/paired-remote-terminal-client-restart-survival.spec.ts 1 test-no-real-time-wait:tests/e2e/paired-remote-terminal-materialization-reconnect.spec.ts 1 test-no-real-time-wait:tests/e2e/paired-remote-terminal-network-outage.spec.ts 1 test-no-real-time-wait:tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts 1 test-no-real-time-wait:tests/e2e/paired-remote-terminal-parked-scrollback-restart.spec.ts 1 test-no-real-time-wait:tests/e2e/paired-remote-terminal-reconnect-idle-frame.spec.ts +2 test-no-real-time-wait:tests/e2e/paired-two-client-emptied-workspace-reseed.spec.ts 1 test-no-real-time-wait:tests/e2e/pdf-find-counter.spec.ts 1 test-no-real-time-wait:tests/e2e/pdf-viewer-rebuild-recovery.spec.ts 1 test-no-real-time-wait:tests/e2e/project-group-manual-sort.spec.ts +2 test-no-real-time-wait:tests/e2e/relaunch-first-terminal.spec.ts +4 test-no-real-time-wait:tests/e2e/relaunch-sleeping-agents-resume-on-view.spec.ts 1 test-no-real-time-wait:tests/e2e/resource-manager-local-pty-view.spec.ts 1 test-no-real-time-wait:tests/e2e/settings-display-name-ime.spec.ts 1 test-no-real-time-wait:tests/e2e/settled-worker-tab-survives-restart.spec.ts +2 test-no-real-time-wait:tests/e2e/setup-script-prompt-unreadable-orca-yaml.spec.ts +2 test-no-real-time-wait:tests/e2e/sidebar-desktop-reads-main.spec.ts +2 test-no-real-time-wait:tests/e2e/sidebar-sort-stamps-order.spec.ts +2 test-no-real-time-wait:tests/e2e/sidebar-sort-stamps.spec.ts 1 test-no-real-time-wait:tests/e2e/sidebar-unread-older-paired-host.spec.ts +2 test-no-real-time-wait:tests/e2e/slept-workspace-remount-wake.spec.ts 1 test-no-real-time-wait:tests/e2e/source-control-create-pr-intent-switch.spec.ts 1 test-no-real-time-wait:tests/e2e/sparse-preset-proof.spec.ts 1 test-no-real-time-wait:tests/e2e/ssh-orcad-explorer-selected-host.spec.ts @@ -378,215 +562,469 @@ 1 test-no-real-time-wait:tests/e2e/ssh-orcad-terminal-reconnect-idle-frame.spec.ts 1 test-no-real-time-wait:tests/e2e/status-bar-session-count-management-kill.spec.ts 1 test-no-real-time-wait:tests/e2e/structured-attention-read-retirement.unit.test.ts +2 test-no-real-time-wait:tests/e2e/tasks-page.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-attention.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-cjk-ime-committed-text.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-closed-pane-quit-relaunch.spec.ts +8 test-no-real-time-wait:tests/e2e/terminal-column-desync-repro.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-column-probes.ts +2 test-no-real-time-wait:tests/e2e/terminal-document-visibility-webgl-recovery.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-hangul-terminating-digit-native.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-hangul-wrap-boundary-bytes.spec.ts +3 test-no-real-time-wait:tests/e2e/terminal-hidden-view-parking.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-ibus-hangul-native.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-ime-cdp-composition.ts +9 test-no-real-time-wait:tests/e2e/terminal-inline-tui-reveal-convergence.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-korean-composing-chord-order.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-large-paste-responsiveness.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-link-click-ownership.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-link-hover-after-worktree-return.spec.ts +13 test-no-real-time-wait:tests/e2e/terminal-long-table-scroll-restore.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-macos-system-key-remap.spec.ts +4 test-no-real-time-wait:tests/e2e/terminal-opencode-emoji-table-rendering.spec.ts +4 test-no-real-time-wait:tests/e2e/terminal-pane-close-layout-consistency.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-pane-title-editing.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-pane-title-focus-handoff.spec.ts +4 test-no-real-time-wait:tests/e2e/terminal-parked-memory.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-pinned-viewport-streaming-switch.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-pinned-viewport-worktree-switch.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-pty-readiness.ts +3 test-no-real-time-wait:tests/e2e/terminal-raw-emoji-table-scroll-restore.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-reattach-mouse-mode-leak.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-reattach-tui-mouse-mode.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-restart-persistence.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-reveal-paused-render-repro.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-scroll-intent-follow.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-split-activation-latency.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-tab-close-restart-persistence.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-tab-close-running-confirm-mouse.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-tab-close-running-confirm.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-tab-level-binding-upgrade.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-tab-screenshot.ts +2 test-no-real-time-wait:tests/e2e/terminal-tab-switch-sigwinch-restore.spec.ts +4 test-no-real-time-wait:tests/e2e/terminal-tab-switch-visual-restore.spec.ts 1 test-no-real-time-wait:tests/e2e/terminal-tui-wheel-drain.spec.ts +5 test-no-real-time-wait:tests/e2e/terminal-tui-wheel-reports.spec.ts +4 test-no-real-time-wait:tests/e2e/terminal-warm-reattach-split-live-output.spec.ts +2 test-no-real-time-wait:tests/e2e/terminal-windows-codex-multiline-paste.spec.ts 1 test-no-real-time-wait:tests/e2e/unopened-workspace-agent-single-resume.spec.ts +2 test-no-real-time-wait:tests/e2e/workspace-emoji-picker.spec.ts 1 test-no-real-time-wait:tests/e2e/workspace-sleep-in-main.spec.ts +3 test-no-real-time-wait:tests/e2e/workspace-sleep-main-resume.spec.ts 1 test-no-real-time-wait:tests/e2e/worktree-active-delete-scroll-position.spec.ts +2 test-no-real-time-wait:tests/e2e/worktree-card-downward-drag.spec.ts 1 test-no-real-time-wait:tests/e2e/worktree-jump-sleep-focus.spec.ts 1 test-no-real-time-wait:tests/e2e/worktree-parent-reorder.spec.ts +3 test-no-real-time-wait:tests/e2e/worktree-switch-first-paint.spec.ts +3 test-no-real-time-wait:tests/e2e/worktree.spec.ts 1 test-no-real-time-wait:tests/e2e/wsl-host-fake-transport.spec.ts +1 test-no-wall-clock:config/scripts/worktree-storage/reclaim-dev-electron-bundles.test.ts 1 test-no-wall-clock:config/scripts/worktree-storage/reclaim-release-test-caches.test.ts 1 test-no-wall-clock:mobile/scripts/native-build-cache.test.ts 1 test-no-wall-clock:mobile/src/session/mobile-structured-send-new-action.test.ts +1 test-no-wall-clock:mobile/src/session/native-chat/composer/use-mobile-native-chat-message-send-draft-lifetime.test.ts 1 test-no-wall-clock:mobile/src/session/native-chat/transcript/use-mobile-native-chat-message-send.test.ts 1 test-no-wall-clock:mobile/src/transport/host-store.test.ts 1 test-no-wall-clock:mobile/src/transport/mobile-relay-invite-director.test.ts +3 test-no-wall-clock:mobile/src/transport/mobile-relay-resume-director.test.ts +3 test-no-wall-clock:mobile/src/transport/rpc-client-live-recovery.test.ts +2 test-no-wall-clock:src/cli/format.test.ts +2 test-no-wall-clock:src/cli/runtime/serve-appimage-update.test.ts +4 test-no-wall-clock:src/cli/runtime/serve-bundle-park.test.ts +5 test-no-wall-clock:src/cli/runtime/serve-pid1-init-reaper.test.ts 1 test-no-wall-clock:src/cli/runtime/status-caller.test.ts 1 test-no-wall-clock:src/main/acp/acp-structured-mail-admission.test.ts +2 test-no-wall-clock:src/main/agent-hooks/managed-hook-timeout.test.ts +2 test-no-wall-clock:src/main/agent-hooks/manual-compact-hook-stream.test.ts +2 test-no-wall-clock:src/main/agent-hooks/posix-hook-json-stdin-reader.test.ts 1 test-no-wall-clock:src/main/agent-hooks/restored-status-dead-terminal-sweep.test.ts 1 test-no-wall-clock:src/main/agent-hooks/server-codex-capacity.test.ts 1 test-no-wall-clock:src/main/agent-hooks/server-endpoint-file-lifecycle.test.ts +2 test-no-wall-clock:src/main/agent-hooks/server-hook-http-ingest.test.ts +3 test-no-wall-clock:src/main/agent-hooks/server-ingest-structured-status.test.ts 1 test-no-wall-clock:src/main/agent-hooks/server-last-status-hydrate-validation.test.ts +6 test-no-wall-clock:src/main/agent-hooks/server-launch-resume-identity.test.ts +6 test-no-wall-clock:src/main/agent-hooks/spool.test.ts +2 test-no-wall-clock:src/main/agent-hooks/windows-native-hook-exe-hosts.test.ts 1 test-no-wall-clock:src/main/ai-vault-search/session-search-index-consumer.test.ts 1 test-no-wall-clock:src/main/ai-vault-search/session-search-index-generation.test.ts +8 test-no-wall-clock:src/main/ai-vault-search/session-search-indexer.test.ts 1 test-no-wall-clock:src/main/ai-vault/parse-cache/session-parse-cache-preview-upgrade.test.ts +3 test-no-wall-clock:src/main/ai-vault/scanners/claude/session-scanner-claude-subagents.test.ts 1 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-cache-upgrade.test.ts +2 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-parser.test.ts +3 test-no-wall-clock:src/main/ai-vault/scanners/cursor/session-scanner-cursor-chat-meta.test.ts 1 test-no-wall-clock:src/main/ai-vault/scanners/devin/session-scanner-devin-db.test.ts +4 test-no-wall-clock:src/main/ai-vault/scanners/devin/session-scanner-devin-parser.test.ts +2 test-no-wall-clock:src/main/ai-vault/scanners/grok/session-scanner-grok-parser.test.ts +3 test-no-wall-clock:src/main/ai-vault/scanners/jcode/session-scanner-jcode-parser.test.ts 1 test-no-wall-clock:src/main/ai-vault/scanners/kimi/session-scanner-kimi-parser.test.ts 1 test-no-wall-clock:src/main/ai-vault/scanners/opencode/reader-transport/session-scanner-opencode-sqlite-process.test.ts +2 test-no-wall-clock:src/main/ai-vault/scanners/opencode/session-scanner-opencode-parser.test.ts +2 test-no-wall-clock:src/main/antigravity/posix-hook-invocation.test.ts +2 test-no-wall-clock:src/main/browser/cookies/browser-cookie-import-partition-reland.electron.test.ts +2 test-no-wall-clock:src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts +2 test-no-wall-clock:src/main/browser/sessions/browser-session-registry.test.ts 1 test-no-wall-clock:src/main/claude-accounts/claude-account-folder.test.ts 1 test-no-wall-clock:src/main/claude-usage/persisted-source-authority.test.ts 1 test-no-wall-clock:src/main/claude/claude-background-wake-retention.test.ts 1 test-no-wall-clock:src/main/claude/claude-descendant-escalation-boundary.test.ts 1 test-no-wall-clock:src/main/claude/claude-folder-trust-file.test.ts +5 test-no-wall-clock:src/main/claude/claude-supervised-stop-real-cli.test.ts +6 test-no-wall-clock:src/main/claude/claude-supervised-stop.integration.test.ts +4 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli-fold.test.ts 1 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli-rewind.test.ts +3 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts +16 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli.test.ts +3 test-no-wall-clock:src/main/claude/structured/launch/claude-structured-real-cli-options.test.ts 1 test-no-wall-clock:src/main/cli/appimage-generation-lease.test.ts +6 test-no-wall-clock:src/main/cli/packaged-cli-assets.test.ts 1 test-no-wall-clock:src/main/cli/wsl-cli-registration-registry.test.ts 1 test-no-wall-clock:src/main/codex-accounts/legacy-wsl-runtime-auth-drain-rollback-script.test.ts 1 test-no-wall-clock:src/main/codex-accounts/service.test.ts +6 test-no-wall-clock:src/main/codex/app-server/codex-app-server-client.test.ts +2 test-no-wall-clock:src/main/codex/configuration/settings/config-settings-promotion.test.ts 1 test-no-wall-clock:src/main/codex/history/backfill/codex-session-backfill-marker.test.ts 1 test-no-wall-clock:src/main/codex/history/backfill/codex-session-backfill.test.ts 1 test-no-wall-clock:src/main/codex/structured/catalog/codex-usage-limits.test.ts +2 test-no-wall-clock:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts +2 test-no-wall-clock:src/main/codex/trust/hooks/codex-hook-trust-derivation.test.ts 1 test-no-wall-clock:src/main/crash-reporting/self-initiated-tree-kill-log.test.ts -1 test-no-wall-clock:src/main/daemon/providers/lifecycle/testing/daemon-automatic-work-resume.test.ts -1 test-no-wall-clock:src/main/daemon/executable-host/windows/testing/daemon-host-relocation.test.ts -1 test-no-wall-clock:src/main/daemon/providers/checkpointing/testing/daemon-shutdown-final-checkpoint-caller-deadline.test.ts -1 test-no-wall-clock:src/main/daemon/terminal-host/testing/terminal-session-teardown.test.ts 1 test-no-wall-clock:src/main/daemon/admission/testing/terminal-spawn-gate-legacy-restores.test.ts +1 test-no-wall-clock:src/main/daemon/executable-host/windows/testing/daemon-host-relocation.test.ts +2 test-no-wall-clock:src/main/daemon/history/restoration/testing/terminal-history-incremental-restore.test.ts +3 test-no-wall-clock:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-checkpoints.test.ts +3 test-no-wall-clock:src/main/daemon/providers/adapter/testing/daemon-self-retirement-respawn.test.ts +1 test-no-wall-clock:src/main/daemon/providers/checkpointing/testing/daemon-shutdown-final-checkpoint-caller-deadline.test.ts +1 test-no-wall-clock:src/main/daemon/providers/lifecycle/testing/daemon-automatic-work-resume.test.ts +2 test-no-wall-clock:src/main/daemon/server/testing/daemon-idle-shutdown.test.ts +2 test-no-wall-clock:src/main/daemon/shell-readiness/testing/terminal-shell-recovery-barrier.test.ts +1 test-no-wall-clock:src/main/daemon/terminal-host/testing/terminal-session-teardown.test.ts +2 test-no-wall-clock:src/main/daemon/transport/framing/testing/daemon-stream-binary-negotiation.test.ts +2 test-no-wall-clock:src/main/external-conversations/external-conversation-cancel-settlement.test.ts +3 test-no-wall-clock:src/main/external-conversations/external-conversation-cancel.test.ts +2 test-no-wall-clock:src/main/git/command-runner/git-command-resolution-windows-checkout.test.ts +4 test-no-wall-clock:src/main/git/gh-rate-limit-breaker.test.ts 1 test-no-wall-clock:src/main/git/refs/maintenance/pack-refs-lock-ownership.test.ts +2 test-no-wall-clock:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts +2 test-no-wall-clock:src/main/git/runner-gh-account-binding.test.ts +6 test-no-wall-clock:src/main/git/runner-gh-rate-limit-breaker.test.ts 1 test-no-wall-clock:src/main/git/source-control/blob-absence-real-git.test.ts +2 test-no-wall-clock:src/main/git/worktrees/catalog/worktree-created-description-real-git.test.ts 1 test-no-wall-clock:src/main/git/wsl-windows-checkout-git-probe.test.ts +2 test-no-wall-clock:src/main/github/client-pr-fallback-number.test.ts 1 test-no-wall-clock:src/main/github/client-work-items.test.ts +6 test-no-wall-clock:src/main/github/pr-refresh-coordinator-active-burst-pacing.test.ts +9 test-no-wall-clock:src/main/github/pr-refresh-coordinator-active-visible-priority.test.ts +15 test-no-wall-clock:src/main/github/pr-refresh-coordinator-alias-coalescing.test.ts +5 test-no-wall-clock:src/main/github/pr-refresh-coordinator-completion-order.test.ts +2 test-no-wall-clock:src/main/github/pr-refresh-coordinator-error-cadence.test.ts +3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-foreground-pacing.test.ts +3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-refresh-events.test.ts +11 test-no-wall-clock:src/main/github/pr-refresh-coordinator-visibility-policy.test.ts +18 test-no-wall-clock:src/main/github/pr-refresh-coordinator-visible-follow-up.test.ts +6 test-no-wall-clock:src/main/github/pr-refresh-queue-growth-bound.test.ts +2 test-no-wall-clock:src/main/grok/grok-hook-stdin-no-eof.test.ts 1 test-no-wall-clock:src/main/ipc/ai-vault/ai-vault.test.ts +3 test-no-wall-clock:src/main/ipc/folder-repo-git-upgrade.test.ts +2 test-no-wall-clock:src/main/ipc/native-chat-subscribe-lifecycle.test.ts +2 test-no-wall-clock:src/main/ipc/native-chat.test.ts 1 test-no-wall-clock:src/main/ipc/pty/runtime/kill-legacy-relay-bridged.test.ts +3 test-no-wall-clock:src/main/ipc/runtime-environments/runtime-environment-request-connections.test.ts 1 test-no-wall-clock:src/main/ipc/runtime-environments/runtime-environments-pairing.test.ts 1 test-no-wall-clock:src/main/ipc/terminal-render-desync-evidence.test.ts +5 test-no-wall-clock:src/main/ipc/worktrees-orphan-directory-cleanup.test.ts +3 test-no-wall-clock:src/main/ipc/worktrees/creation/worktree-base-directory-poller.test.ts +2 test-no-wall-clock:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts +2 test-no-wall-clock:src/main/macos-permissions/macos-tcc-log-stream-orphans.test.ts 1 test-no-wall-clock:src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts +3 test-no-wall-clock:src/main/managed-server/host-state/orcad-state-snapshot-shell.test.ts +3 test-no-wall-clock:src/main/managed-server/host-state/orcad-windows-host-fence-ops.test.ts 1 test-no-wall-clock:src/main/managed-server/host-state/orcad-windows-host-state-ops.test.ts +2 test-no-wall-clock:src/main/managed-server/install/orcad-remote-launch-file-modes.test.ts +3 test-no-wall-clock:src/main/managed-server/install/orcad-remote-shell-commands.integration.test.ts +2 test-no-wall-clock:src/main/managed-server/install/orcad-remote-windows-scripts.test.ts 1 test-no-wall-clock:src/main/managed-server/install/remote-install-lock-exited-owner.test.ts +2 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-host-download.test.ts +4 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-store-gc.test.ts +4 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-store-lock-host-release.test.ts +3 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-store-windows.test.ts 1 test-no-wall-clock:src/main/native-chat/agent-session-attachments/agent-session-attachment-sweep.test.ts +4 test-no-wall-clock:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-ends-session.test.ts 1 test-no-wall-clock:src/main/native-chat/agent-session-wire/structured-agent-session-close-verdict.test.ts 1 test-no-wall-clock:src/main/native-chat/structured-chat-naming.test.ts 1 test-no-wall-clock:src/main/native-chat/transcript-watch-inplace-drain-race.test.ts +2 test-no-wall-clock:src/main/native-chat/transcript-watch.test.ts +10 test-no-wall-clock:src/main/observability/bundle.test.ts 1 test-no-wall-clock:src/main/opencode/opencode-launch-model-context-supervision.test.ts 1 test-no-wall-clock:src/main/opencode/overlay-dir-gc.test.ts +10 test-no-wall-clock:src/main/orca-profiles/profile-cloud-auth-characterization.test.ts 1 test-no-wall-clock:src/main/orca-profiles/profile-cloud-org-members-service.test.ts 1 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-auth-retry.test.ts +4 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-connect-overlap.test.ts +3 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-refresh.test.ts +2 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-sign-out-connect-race.test.ts 1 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service.test.ts +2 test-no-wall-clock:src/main/orcad/orcad-artifact-cache-retention.test.ts +2 test-no-wall-clock:src/main/orcad/orcad-artifact-materializer.test.ts +3 test-no-wall-clock:src/main/orcad/orcad-node-launcher.integration.test.ts 1 test-no-wall-clock:src/main/orcad/orcad-push-startup.test.ts +2 test-no-wall-clock:src/main/orcad/orcad-secret-store.test.ts +6 test-no-wall-clock:src/main/orcad/orcad-serve-parity.integration.test.ts +2 test-no-wall-clock:src/main/orcad/orcad-stale-lock-reclaim.test.ts +3 test-no-wall-clock:src/main/orcad/orcad-stop-request-shutdown.integration.test.ts 1 test-no-wall-clock:src/main/persistence/closed-terminal-tab-write-fence.test.ts 1 test-no-wall-clock:src/main/persistence/loading-store/persisted-state-redundancy.test.ts 1 test-no-wall-clock:src/main/persistence/loading-store/profile-state-sqlite-authority.test.ts 1 test-no-wall-clock:src/main/persistence/loading-store/profile-state-temp-cleanup-lifetime.test.ts 1 test-no-wall-clock:src/main/persistence/loading-store/pty-spawn-restore-durability.test.ts 1 test-no-wall-clock:src/main/persistence/loading-store/worktree-meta-alias-projection.test.ts +2 test-no-wall-clock:src/main/persistence/migrating-orcad-catalog/orcad-source-release-upgrade.test.ts 1 test-no-wall-clock:src/main/persistence/migrating-orcad-catalog/persistence-orcad-migration-catalog.test.ts +4 test-no-wall-clock:src/main/persistence/profile-state/profile-state-backup-rotation.test.ts +2 test-no-wall-clock:src/main/persistence/profile-state/profile-state-backup-temporary-files.test.ts 1 test-no-wall-clock:src/main/persistence/profile-state/profile-state-database.test.ts +2 test-no-wall-clock:src/main/persistence/profile-state/profile-state-live-store-factory.test.ts 1 test-no-wall-clock:src/main/persistence/profile-state/profile-state-pre-migration-backup.test.ts +2 test-no-wall-clock:src/main/persistence/profile-state/profile-state-section-repair.test.ts +3 test-no-wall-clock:src/main/persistence/terminal-topology/persistence-pane-identity-migration.test.ts +2 test-no-wall-clock:src/main/persistence/tracking-repos/persistence-deregistered-repo-residue.test.ts +2 test-no-wall-clock:src/main/persistence/tracking-repos/persistence-workspace-session-scrollback.test.ts 1 test-no-wall-clock:src/main/persistence/tracking-repos/worktree-metadata-normalization.test.ts 1 test-no-wall-clock:src/main/plugins/workers/plugin-host-methods.test.ts +2 test-no-wall-clock:src/main/provider-process/provider-group-orphan-guard.integration.test.ts 1 test-no-wall-clock:src/main/provider-process/provider-group-orphan-guard.test.ts +18 test-no-wall-clock:src/main/provider-process/provider-process-supervisor.integration.test.ts +3 test-no-wall-clock:src/main/provider-process/provider-process-teardown.test.ts +2 test-no-wall-clock:src/main/providers/startup-line-typed-length.live-shell.test.ts 1 test-no-wall-clock:src/main/pty/history/fish-history-session.test.ts +2 test-no-wall-clock:src/main/pty/history/terminal-history-fish-session.node-pty.test.ts +1 test-no-wall-clock:src/main/pty/history/terminal-history-gc-fs-call-count.test.ts +2 test-no-wall-clock:src/main/pty/process-retirement/posix-pty-process-groups.integration.test.ts +4 test-no-wall-clock:src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts 1 test-no-wall-clock:src/main/rate-limits/claude-oauth-usage-error.test.ts +2 test-no-wall-clock:src/main/rate-limits/claude-profile-usage.test.ts 1 test-no-wall-clock:src/main/rate-limits/cursor-current-period-usage.test.ts 1 test-no-wall-clock:src/main/rate-limits/kimi-fetcher-wsl-home.test.ts 1 test-no-wall-clock:src/main/rate-limits/opencode-go-usage-source-selection.test.ts +43 test-no-wall-clock:src/main/rate-limits/service-account-target-selection.test.ts +2 test-no-wall-clock:src/main/rate-limits/service-cursor-usage.test.ts +12 test-no-wall-clock:src/main/rate-limits/service-minimax-usage.test.ts +38 test-no-wall-clock:src/main/rate-limits/service-refresh-orchestration.test.ts +4 test-no-wall-clock:src/main/rate-limits/service-zcode-usage.test.ts +1 test-no-wall-clock:src/main/runtime/agent-session/launch/structured-agent-launch-support.test.ts +1 test-no-wall-clock:src/main/runtime/agent-session/lifecycle/claude-structured-session-integration.test.ts 1 test-no-wall-clock:src/main/runtime/agent-session/ownership/agent-session-process-identity-probe.test.ts +2 test-no-wall-clock:src/main/runtime/agent-session/structured-agent-session-held-signal.test.ts 1 test-no-wall-clock:src/main/runtime/agent-session/structured-agent-session-provider-operations-while-starting.test.ts 1 test-no-wall-clock:src/main/runtime/agent-state-rules/agent-state-rules-engine.test.ts 1 test-no-wall-clock:src/main/runtime/antigravity-readiness-transcripts.test.ts -1 test-no-wall-clock:src/main/runtime/agent-session/lifecycle/claude-structured-session-integration.test.ts +2 test-no-wall-clock:src/main/runtime/client/settings/runtime-client-agent-launch-settings-durability.test.ts 1 test-no-wall-clock:src/main/runtime/mobile-cloud-relay/mobile-relay-e2ee.integration.test.ts 1 test-no-wall-clock:src/main/runtime/mobile-cloud-relay/relay-http-client.test.ts 1 test-no-wall-clock:src/main/runtime/mobile-store-orphaned-temp-cleanup.test.ts 1 test-no-wall-clock:src/main/runtime/mobile-subscribe-idle-pane-hydrate.test.ts +3 test-no-wall-clock:src/main/runtime/orca-runtime-agent-session-operation.test.ts +3 test-no-wall-clock:src/main/runtime/orca-runtime-codex-idle-title-chat-address.test.ts 1 test-no-wall-clock:src/main/runtime/orca-runtime-default-tab-agent-status.test.ts +5 test-no-wall-clock:src/main/runtime/orca-runtime-migrated-pane-restore-cwd.test.ts +3 test-no-wall-clock:src/main/runtime/orchestration-cli-subprocess.test.ts +2 test-no-wall-clock:src/main/runtime/orchestration-codex-real-pty.integration.test.ts +2 test-no-wall-clock:src/main/runtime/orchestration/worker-output-archive.test.ts 1 test-no-wall-clock:src/main/runtime/owned-session-teardown-policy.test.ts 1 test-no-wall-clock:src/main/runtime/push/push-device-registration-persistence.test.ts 1 test-no-wall-clock:src/main/runtime/push/push-registration-rpc.test.ts 1 test-no-wall-clock:src/main/runtime/push/push-unpair-persistence.test.ts 1 test-no-wall-clock:src/main/runtime/remote-agent-session-host-authority.integration.test.ts +2 test-no-wall-clock:src/main/runtime/remote-runtime-request-connection.integration.test.ts 1 test-no-wall-clock:src/main/runtime/rpc/methods/agent-launch-prestart-failure.test.ts 1 test-no-wall-clock:src/main/runtime/rpc/methods/agent-launch-replay.test.ts +5 test-no-wall-clock:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts 1 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/federation/federation-output.test.ts 1 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/agent-status-producer-census.test.ts +2 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/fleet-status-observed-identity.test.ts +3 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/fleet-status-terminal-identity.test.ts 1 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/worker-interactive-wait.test.ts 1 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/worker-list-pagination.test.ts +2 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/worker-output.test.ts 1 test-no-wall-clock:src/main/runtime/rpc/methods/pairing.test.ts +6 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-pairing-mode-persistence.test.ts +11 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-relay-pairing.test.ts +2 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-websocket-bind-host.test.ts +9 test-no-wall-clock:src/main/runtime/session-lifecycle/projection/runtime-mobile-agent-status-builder.test.ts 1 test-no-wall-clock:src/main/runtime/session-lifecycle/projection/runtime-mobile-codex-side-title.test.ts -1 test-no-wall-clock:src/main/runtime/agent-session/launch/structured-agent-launch-support.test.ts 1 test-no-wall-clock:src/main/runtime/structured-child-records-switch.test.ts 1 test-no-wall-clock:src/main/runtime/structured-codex-child-work-runtime.test.ts 1 test-no-wall-clock:src/main/runtime/terminal-pane-recovery-liveness-gate.test.ts +46 test-no-wall-clock:src/main/runtime/terminal-query-responder.test.ts 1 test-no-wall-clock:src/main/runtime/terminal-subscriber-driven-daemon-attach.test.ts +2 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-claude-task-wakeup.test.ts +16 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-hook-lane-runtime.test.ts +4 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts +4 test-no-wall-clock:src/main/runtime/worker-terminal-archive-release.test.ts +9 test-no-wall-clock:src/main/runtime/worker-terminal-archive-screen.test.ts +7 test-no-wall-clock:src/main/runtime/worker-terminal-wrap-provenance.test.ts +2 test-no-wall-clock:src/main/runtime/workspace-layout-live-titles.test.ts +3 test-no-wall-clock:src/main/runtime/workspaces/process-listing/runtime-worktree-structured-agent-rows-liveness.test.ts +6 test-no-wall-clock:src/main/skills/skill-bundle-process-termination.integration.test.ts +7 test-no-wall-clock:src/main/skills/skill-install-lock.test.ts 1 test-no-wall-clock:src/main/skills/skill-install-recovery.test.ts 1 test-no-wall-clock:src/main/skills/skill-install-request-service.test.ts 1 test-no-wall-clock:src/main/skills/skill-install-service.test.ts 1 test-no-wall-clock:src/main/skills/skill-package-download-response-lifetime.test.ts 1 test-no-wall-clock:src/main/skills/skill-placement-reconciliation.test.ts 1 test-no-wall-clock:src/main/skills/skill-placement-transaction.test.ts +2 test-no-wall-clock:src/main/skills/skill-process-contention-child.test.ts +2 test-no-wall-clock:src/main/skills/skill-process-contention.integration.test.ts +4 test-no-wall-clock:src/main/skills/skill-process-termination.integration.test.ts +2 test-no-wall-clock:src/main/skills/skill-transaction-startup-recovery.test.ts +4 test-no-wall-clock:src/main/skills/skill-upload-process-restart.integration.test.ts +4 test-no-wall-clock:src/main/sqlite/sync-database.test.ts 1 test-no-wall-clock:src/main/ssh/legacy-relay/legacy-relay-bridge-runtime-exit.test.ts +4 test-no-wall-clock:src/main/ssh/orcad-exited-own-fence-mutation-race.test.ts +8 test-no-wall-clock:src/main/ssh/orcad-exited-own-fence.test.ts +6 test-no-wall-clock:src/main/ssh/orcad-exited-own-install-lock.test.ts +2 test-no-wall-clock:src/main/ssh/orcad-exited-own-lock-windows.test.ts +4 test-no-wall-clock:src/main/ssh/ssh-remote-commands.test.ts +2 test-no-wall-clock:src/main/star-nag/service-direct-star.test.ts 1 test-no-wall-clock:src/main/star-nag/service-force-show-races.test.ts +3 test-no-wall-clock:src/main/star-nag/service-threshold-prompt.test.ts +2 test-no-wall-clock:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts 1 test-no-wall-clock:src/main/startup/login-shell-environment.test.ts +2 test-no-wall-clock:src/main/startup/run-electron-vite-dev-web.test.ts +2 test-no-wall-clock:src/main/startup/run-electron-vite-dev.test.ts +13 test-no-wall-clock:src/main/startup/windows-install-dir-acl-recovery.test.ts +4 test-no-wall-clock:src/main/updater/lifecycle/serve-supervisor-install-park.test.ts 1 test-no-wall-clock:src/main/window/desktop-integration/macos-press-and-hold-default.defaults-domain.test.ts +2 test-no-wall-clock:src/main/windows/windows-host-job.win32.test.ts +3 test-no-wall-clock:src/main/windows/windows-msys-job.win32.test.ts 1 test-no-wall-clock:src/main/windows/windows-process-table-native-addon.win32.test.ts +2 test-no-wall-clock:src/main/windows/windows-pty-job.win32.test.ts +2 test-no-wall-clock:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts 1 test-no-wall-clock:src/main/workspace-hooks/hooks-runner.test.ts +2 test-no-wall-clock:src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts 1 test-no-wall-clock:src/main/workspaces/removal/worktree-removal-close-records.test.ts +2 test-no-wall-clock:src/main/wsl/execution/wsl-runner.wsl.test.ts +3 test-no-wall-clock:src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts +3 test-no-wall-clock:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx +2 test-no-wall-clock:src/renderer/src/components/artifacts/ArtifactCollection.test.tsx +2 test-no-wall-clock:src/renderer/src/components/artifacts/artifact-list-windowing.test.tsx 1 test-no-wall-clock:src/renderer/src/components/automations/use-automation-list-search.test.tsx 1 test-no-wall-clock:src/renderer/src/components/browser-pane/assemble-chrome/browser-workspace-pane.adoption-chrome.test.tsx +2 test-no-wall-clock:src/renderer/src/components/dashboard/useLiveDashboardSnapshot.test.ts 1 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatMessageList.opening-send.test.tsx 1 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatMessageList.queued-turn-order.test.tsx +3 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatMessageList.test.tsx +3 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsx 1 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatMessageList.unsent-message.test.tsx +3 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatResolvedView.turn-status.test.tsx +2 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.test.tsx 1 test-no-wall-clock:src/renderer/src/components/settings/accounts/providers/GrokAccountsSection.test.tsx +4 test-no-wall-clock:src/renderer/src/components/sidebar/workspace-card/review/use-workspace-reference-details.test.tsx +1 test-no-wall-clock:src/renderer/src/components/sidebar/workspace-card/surface/WorktreeCard.single-reference-details.test.tsx 1 test-no-wall-clock:src/renderer/src/components/sidebar/worktree-list/listing/WorktreeList.lineage-agent-expansion-coupling.test.tsx +2 test-no-wall-clock:src/renderer/src/components/status-bar/status-bar-antigravity-segment.test.tsx +4 test-no-wall-clock:src/renderer/src/components/task-page/jira/task-page-jira-cache-selectors.test.ts 1 test-no-wall-clock:src/renderer/src/components/task-page/jira/task-page-jira-saved-filter-load-failure.test.tsx 1 test-no-wall-clock:src/renderer/src/components/terminal-pane/cache-timer-seeding.test.ts +2 test-no-wall-clock:src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts +2 test-no-wall-clock:src/renderer/src/components/terminal-pane/remote-snapshot-alt-screen-host-chain.test.ts +3 test-no-wall-clock:src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts 1 test-no-wall-clock:src/renderer/src/components/terminal-pane/terminal-link-worktree-root-activation.test.ts 1 test-no-wall-clock:src/renderer/src/components/terminal/initial-terminal-structured-launch.test.tsx +2 test-no-wall-clock:src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-removal.agent-stop.test.tsx +7 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx +8 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx 1 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.test.tsx +2 test-no-wall-clock:src/renderer/src/hooks/ipc-events/agent-status-terminal-title-tab-write.test.ts +3 test-no-wall-clock:src/renderer/src/hooks/useAutomationDispatchEvents.test.ts 1 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-agent-status-hook-titles.test.ts +2 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-cli-worktree-activation.test.ts +3 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.ts 1 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-ssh-disconnect-cleanup.test.ts +2 test-no-wall-clock:src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-persistence.test.ts 1 test-no-wall-clock:src/renderer/src/lib/paired-runtime-closed-tab-resume.test.ts +2 test-no-wall-clock:src/renderer/src/lib/settled-worker-wake-policy.test.ts +2 test-no-wall-clock:src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx +2 test-no-wall-clock:src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts 1 test-no-wall-clock:src/renderer/src/lib/workspace-terminal-host-authority.test.ts 1 test-no-wall-clock:src/renderer/src/lib/worktree-activation-emptied-workspace-reseed.test.ts 1 test-no-wall-clock:src/renderer/src/runtime/close-mirrored-editor-tab.test.ts +2 test-no-wall-clock:src/renderer/src/runtime/structured-agent-session-tab-retirement.test.ts +2 test-no-wall-clock:src/renderer/src/store/slices/github-pr-branch-linked-pr-divergence.test.ts 1 test-no-wall-clock:src/renderer/src/store/slices/github-pr-refresh-hosted-review-cache-leak.test.ts +7 test-no-wall-clock:src/renderer/src/store/slices/jira.test.ts 1 test-no-wall-clock:src/renderer/src/store/slices/store-sleep-exact-runtime-stop.test.ts 1 test-no-wall-clock:src/renderer/src/store/slices/worktrees-always-force-delete.test.ts +6 test-no-wall-clock:src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts 1 test-no-wall-clock:src/renderer/src/store/slices/worktrees-terminal-reference-origins.test.ts 1 test-no-wall-clock:src/shared/__tests__/process-host/windows-cmd-shim-resolution.test.ts +7 test-no-wall-clock:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts 1 test-no-wall-clock:src/shared/agent-hook-listener/transport/agent-hook-spool-drain.test.ts 1 test-no-wall-clock:src/shared/agent-hook-listener/transport/agent-hook-spool-read.test.ts 1 test-no-wall-clock:src/shared/automation-schedules.test.ts +2 test-no-wall-clock:src/shared/crash-reporting.test.ts +2 test-no-wall-clock:src/shared/fish-query-reply-child-stdin.node-pty.test.ts 1 test-no-wall-clock:src/shared/git/compatibility/git-binary-compatibility.test.ts 1 test-no-wall-clock:src/shared/mobile-push-contract.test.ts +2 test-no-wall-clock:src/shared/startup-command-staging.node-pty.test.ts 1 test-no-wall-clock:src/shared/startup-command-staging.test.ts +2 test-no-wall-clock:src/shared/terminal/pty/ingress/pty-reply-echo-shapes.node-pty.test.ts +14 test-no-wall-clock:src/wsl-guest/agent-hook-integration.test.ts 1 test-no-wall-clock:src/wsl-guest/agent-hook-opencode-tui-identity.test.ts 1 test-no-wall-clock:src/wsl-guest/agent-hook-provider-normalization.test.ts +2 test-no-wall-clock:src/wsl-guest/agent-hook-server.test.ts 1 test-no-wall-clock:src/wsl-guest/relay-idle-process-owner.test.ts 1 test-no-wall-clock:tests/e2e/cross-version-wire/cross-version-web-device-key.unit.test.ts +2 test-no-wall-clock:tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts +4 test-no-wall-clock:tests/e2e/cross-version-wire/release-checkout.unit.test.ts +2 test-no-wall-clock:tests/e2e/cross-version-wire/release-source-retention.unit.test.ts 1 test-no-wall-clock:tests/e2e/host-cold-park-remote-subscriber.unit.test.ts +2 test-no-wall-clock:tests/e2e/omp-child-session-recovery.unit.test.ts 1 test-no-wall-clock:tests/e2e/structured-session-tab-close-regressions.unit.test.ts 1 test-skip-needs-quarantine:src/main/browser/identity/browser-session-ua-cloudflare-live.electron.test.ts +7 test-timeout-needs-reason:mobile/src/tasks/worktree-create-retry.test.ts +2 test-timeout-needs-reason:mobile/src/terminal/document/native-document-bundle.test.ts 1 test-timeout-needs-reason:mobile/src/test-support/rpc-recording/family-recordings.test.ts 1 test-timeout-needs-reason:mobile/src/test-support/rpc-recording/mutants/family-mutants.test.ts 1 test-timeout-needs-reason:mobile/src/test-support/rpc-recording/rpc-recording-through-bridge.test.ts +3 test-timeout-needs-reason:mobile/src/transport/rpc-client-reconnect-wait.test.ts 1 test-timeout-needs-reason:src/cli/agent-launch-process.test.ts 1 test-timeout-needs-reason:src/cli/runtime/launch-serve-replaced-app-restart.test.ts 1 test-timeout-needs-reason:src/cli/runtime/launch-serve-supervise.test.ts 1 test-timeout-needs-reason:src/cli/runtime/serve-pid1-init-reaper.test.ts 1 test-timeout-needs-reason:src/cli/skills-install.test.ts +2 test-timeout-needs-reason:src/main/acp/acp-structured-broken-stream.test.ts 1 test-timeout-needs-reason:src/main/acp/acp-structured-electron-free.test.ts +4 test-timeout-needs-reason:src/main/agent-hooks/server-transport-interference.test.ts 1 test-timeout-needs-reason:src/main/agent-hooks/wsl-hook-relay-live.integration.test.ts 1 test-timeout-needs-reason:src/main/agent-hooks/wsl-hook-relay-manager.test.ts 1 test-timeout-needs-reason:src/main/ai-vault/parse-cache/session-parse-cache-large-scan.test.ts 1 test-timeout-needs-reason:src/main/antigravity/native-macos-credentials.real.test.ts 1 test-timeout-needs-reason:src/main/antigravity/posix-hook-invocation.test.ts +2 test-timeout-needs-reason:src/main/antigravity/windows-hook-json-post.test.ts +3 test-timeout-needs-reason:src/main/antigravity/windows-hook-payload-delivery.test.ts 1 test-timeout-needs-reason:src/main/browser/agent-browser/agent-browser-bridge-raw-process.test.ts 1 test-timeout-needs-reason:src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts +2 test-timeout-needs-reason:src/main/browser/cookies/browser-cookie-import-partition-reland.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/cookies/browser-cookie-import-partition-rollback.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/cookies/browser-cookie-import-partition-success.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/cookies/browser-cookie-import-partition.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/cookies/browser-cookie-import-validated-partition.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/guest-lifecycle/find/browser-find-frame-traversal.electron.test.ts 1 test-timeout-needs-reason:src/main/browser/identity/browser-session-ua-cloudflare-live.electron.test.ts +2 test-timeout-needs-reason:src/main/browser/identity/browser-session-ua-wire-identity-cross-context.electron.test.ts +5 test-timeout-needs-reason:src/main/browser/identity/browser-session-ua-wire-identity.electron.test.ts +5 test-timeout-needs-reason:src/main/claude-usage/scanner-incremental-reader.test.ts +4 test-timeout-needs-reason:src/main/claude/claude-agent-sdk-exit-proof.test.ts 1 test-timeout-needs-reason:src/main/claude/claude-background-run-isolation-real-cli.test.ts 1 test-timeout-needs-reason:src/main/claude/claude-child-exit-proof-ladder.test.ts +2 test-timeout-needs-reason:src/main/claude/claude-status-line-windows.test.ts 1 test-timeout-needs-reason:src/main/claude/claude-stop-ack-race.test.ts 1 test-timeout-needs-reason:src/main/claude/claude-stream-json-connection.test.ts 1 test-timeout-needs-reason:src/main/claude/structured/claude-structured-real-cli.test.ts 1 test-timeout-needs-reason:src/main/claude/windows-native-hook-registration.test.ts +2 test-timeout-needs-reason:src/main/codex/app-server/codex-app-server-teardown.integration.test.ts 1 test-timeout-needs-reason:src/main/codex/hooks/installation/hook-service-legacy-cleanup.test.ts 1 test-timeout-needs-reason:src/main/codex/structured/catalog/codex-model-catalog-probe.test.ts 1 test-timeout-needs-reason:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts @@ -594,22 +1032,37 @@ 1 test-timeout-needs-reason:src/main/codex/structured/launch/codex-structured-real-cli-visuals.test.ts 1 test-timeout-needs-reason:src/main/codex/trust/toml/codex-trust-config-concurrent-launch.test.ts 1 test-timeout-needs-reason:src/main/cursor/hook-service.test.ts -1 test-timeout-needs-reason:src/main/daemon/providers/routing/testing/daemon-pty-router-unanswering-legacy.test.ts 1 test-timeout-needs-reason:src/main/daemon/emulation/testing/headless-emulator-fidelity.fuzz.test.ts -1 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-windows-output-error.win32.test.ts -1 test-timeout-needs-reason:src/main/daemon/providers/routing/testing/slow-daemon-session-verification.test.ts +2 test-timeout-needs-reason:src/main/daemon/executable-host/linux/testing/daemon-appimage-copy-host.electron.test.ts +2 test-timeout-needs-reason:src/main/daemon/health/testing/issue-6814-daemon-failure-classification.test.ts 1 test-timeout-needs-reason:src/main/daemon/history/restoration/testing/terminal-history-large-checkpoint-cold-restore.test.ts +2 test-timeout-needs-reason:src/main/daemon/providers/checkpointing/testing/daemon-reattach-checkpoint-isolation.test.ts +3 test-timeout-needs-reason:src/main/daemon/providers/checkpointing/testing/daemon-shutdown-final-checkpoint-caller-deadline.test.ts +1 test-timeout-needs-reason:src/main/daemon/providers/routing/testing/daemon-pty-router-unanswering-legacy.test.ts +1 test-timeout-needs-reason:src/main/daemon/providers/routing/testing/slow-daemon-session-verification.test.ts +2 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-conout-worker-errors.test.ts +4 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-fd-leak.test.ts +3 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-windows-input-error.win32.test.ts +1 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-windows-output-error.win32.test.ts 1 test-timeout-needs-reason:src/main/foreign-sqlite-readers/foreign-sqlite-reader-event-loop.test.ts +6 test-timeout-needs-reason:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts 1 test-timeout-needs-reason:src/main/git/worktrees/removal/worktree-removal-real-git.test.ts 1 test-timeout-needs-reason:src/main/hermes/hook-service.test.ts +1 test-timeout-needs-reason:src/main/ipc/filesystem/filesystem-quick-open-options.integration.test.ts 1 test-timeout-needs-reason:src/main/ipc/preflight-runnable-local-cli.test.ts 1 test-timeout-needs-reason:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts 1 test-timeout-needs-reason:src/main/jcode/hook-gate-script.test.ts +4 test-timeout-needs-reason:src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts 1 test-timeout-needs-reason:src/main/managed-server/host-state/orcad-state-snapshot-shell.test.ts 1 test-timeout-needs-reason:src/main/managed-server/host-state/orcad-windows-host-lane.test.ts 1 test-timeout-needs-reason:src/main/managed-server/host-state/orcad-windows-host-state-ops.test.ts 1 test-timeout-needs-reason:src/main/managed-server/install/orcad-remote-node-runtime-slow-hash.test.ts 1 test-timeout-needs-reason:src/main/managed-server/install/remote-node-runtime-host-download.test.ts +2 test-timeout-needs-reason:src/main/managed-server/install/remote-node-runtime-store-lock-host-release.test.ts +4 test-timeout-needs-reason:src/main/managed-server/lifecycle/orcad-managed-tunnel-transport-real-openssh.test.ts +3 test-timeout-needs-reason:src/main/native-chat/agent-model-catalog/agent-model-catalog-probe-runner.test.ts +5 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-queued-stop.test.ts +2 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-ends-session.test.ts 1 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-turn-end.test.ts 1 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-interrupted-continuation.test.ts 1 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-status-feed-children.test.ts @@ -617,33 +1070,59 @@ 1 test-timeout-needs-reason:src/main/orcad/orcad-bundle-native-load-order.test.ts 1 test-timeout-needs-reason:src/main/orcad/orcad-packaged-node-pty.integration.test.ts 1 test-timeout-needs-reason:src/main/orcad/orcad-packaged-structured-chat.integration.test.ts +2 test-timeout-needs-reason:src/main/orcad/orcad-serve-parity.integration.test.ts 1 test-timeout-needs-reason:src/main/orcad/orcad-stop-request-shutdown.integration.test.ts 1 test-timeout-needs-reason:src/main/orcad/orcad-windows-conpty-breakaway.integration.test.ts 1 test-timeout-needs-reason:src/main/persistence/applying-settings/persistence-source-control-ai-migration.test.ts +2 test-timeout-needs-reason:src/main/persistence/persistence-initial-load.test.ts 1 test-timeout-needs-reason:src/main/persistence/profile-state/profile-state-writer-stall.electron.test.ts 1 test-timeout-needs-reason:src/main/persistence/terminal-topology/terminal-topology-model.test.ts 1 test-timeout-needs-reason:src/main/plugins/workers/plugin-worker-supervision.integration.test.ts 1 test-timeout-needs-reason:src/main/ports/port-scan-command-client.test.ts 1 test-timeout-needs-reason:src/main/ports/port-scan-command-execution.test.ts +2 test-timeout-needs-reason:src/main/providers/agent-foreground-process-git-bash.win32.test.ts 1 test-timeout-needs-reason:src/main/providers/local-pty/local-pty-child-process-verdict.test.ts +2 test-timeout-needs-reason:src/main/providers/startup-line-typed-length.live-shell.test.ts +5 test-timeout-needs-reason:src/main/pty/process-retirement/node-pty-master-fd-retirement.test.ts +1 test-timeout-needs-reason:src/main/runtime/browser/client-pages/orca-runtime-browser.test.ts +2 test-timeout-needs-reason:src/main/runtime/cline-screen-readiness-transcripts.test.ts +4 test-timeout-needs-reason:src/main/runtime/codex-header-readiness-transcripts.test.ts 1 test-timeout-needs-reason:src/main/runtime/codex-quiet-ready-screen.test.ts 1 test-timeout-needs-reason:src/main/runtime/mobile-cloud-relay/mobile-relay-e2ee.integration.test.ts -1 test-timeout-needs-reason:src/main/runtime/browser/client-pages/orca-runtime-browser.test.ts +3 test-timeout-needs-reason:src/main/runtime/orchestration-cli-subprocess.test.ts +2 test-timeout-needs-reason:src/main/runtime/orchestration/preamble.test.ts 1 test-timeout-needs-reason:src/main/runtime/qoder-mobile-resume-adoption.test.ts 1 test-timeout-needs-reason:src/main/runtime/remote-agent-session-host-authority.integration.test.ts 1 test-timeout-needs-reason:src/main/runtime/remote-runtime-close-intent.integration.test.ts +4 test-timeout-needs-reason:src/main/runtime/remote-runtime-request-connection.integration.test.ts +2 test-timeout-needs-reason:src/main/runtime/rpc/server/runtime-rpc-device-revocation.test.ts 1 test-timeout-needs-reason:src/main/runtime/rpc/ws-transport.test.ts 1 test-timeout-needs-reason:src/main/runtime/terminal-close-slow-agent-exit.test.ts +3 test-timeout-needs-reason:src/main/runtime/terminal-interactive-wait-visibility.test.ts +2 test-timeout-needs-reason:src/main/runtime/terminal/wait/launched-agent-crash-guard.live-shell.test.ts 1 test-timeout-needs-reason:src/main/runtime/terminal/wait/terminal-wait-name-only-idle.test.ts +4 test-timeout-needs-reason:src/main/runtime/terminal/wait/tui-idle-hook-lane-runtime.test.ts +3 test-timeout-needs-reason:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts 1 test-timeout-needs-reason:src/main/skills/skill-bundle-process-termination.integration.test.ts 1 test-timeout-needs-reason:src/main/skills/skill-process-contention.integration.test.ts 1 test-timeout-needs-reason:src/main/sqlite/sync-database-concurrent-backup.test.ts +2 test-timeout-needs-reason:src/main/ssh/connection/ssh-connection-sftp-wire.test.ts 1 test-timeout-needs-reason:src/main/ssh/orcad-exited-own-fence.test.ts +1 test-timeout-needs-reason:src/main/ssh/ssh-credential-prompt-login-grace-wire.test.ts 1 test-timeout-needs-reason:src/main/ssh/ssh-exec-stdin-file-transfer.test.ts +2 test-timeout-needs-reason:src/main/ssh/system-transport/system-ssh-forward-process-real-openssh.test.ts +2 test-timeout-needs-reason:src/main/startup/single-instance-lock-exit.electron.test.ts 1 test-timeout-needs-reason:src/main/window/renderer-publication-throttle.electron.test.ts 1 test-timeout-needs-reason:src/main/windows/windows-administrator-restart.win32.test.ts 1 test-timeout-needs-reason:src/main/windows/windows-host-job.win32.test.ts 1 test-timeout-needs-reason:src/main/windows/windows-msys-job.win32.test.ts +2 test-timeout-needs-reason:src/main/windows/windows-pty-job.win32.test.ts +8 test-timeout-needs-reason:src/main/worker-thread-child-process/worker-thread-child-process.test.ts +2 test-timeout-needs-reason:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts +2 test-timeout-needs-reason:src/main/workspace-hooks/hook-termination-real-process.test.ts +2 test-timeout-needs-reason:src/main/workspaces/removal/local-worktree-filesystem-wsl-banner.wsl.test.ts +4 test-timeout-needs-reason:src/main/wsl/execution/wsl-runner.wsl.test.ts +4 test-timeout-needs-reason:src/packages/process-host/src/run-process.test.ts 1 test-timeout-needs-reason:src/renderer/src/hooks/agent-hook-completion-notifications.test.ts 1 test-timeout-needs-reason:src/renderer/src/lib/check-run-details-log-normalization-performance.test.ts 1 test-timeout-needs-reason:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts @@ -657,31 +1136,48 @@ 1 test-timeout-needs-reason:tests/e2e/agent-send-picker-reveal.spec.ts 1 test-timeout-needs-reason:tests/e2e/agent-session-log-tail-stability.spec.ts 1 test-timeout-needs-reason:tests/e2e/browser-agent-input-focus-isolation-native.spec.ts +5 test-timeout-needs-reason:tests/e2e/browser-agent-input-focus-isolation.spec.ts 1 test-timeout-needs-reason:tests/e2e/cli-agent-unopened-workspace-resume.spec.ts 1 test-timeout-needs-reason:tests/e2e/combined-diff-invalidation-freeze-repro.spec.ts 1 test-timeout-needs-reason:tests/e2e/completed-worker-retirement-resume.spec.ts +2 test-timeout-needs-reason:tests/e2e/cross-version-wire/agent-session-clear-old-client.unit.test.ts +2 test-timeout-needs-reason:tests/e2e/cross-version-wire/agent-session-newer-chat-refusal.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/cross-version-wire/agent-session-stop-event-downgrade.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/cross-version-wire/cross-version-agent-session-send.unit.test.ts +3 test-timeout-needs-reason:tests/e2e/cross-version-wire/cross-version-terminal-wire.unit.test.ts +4 test-timeout-needs-reason:tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts +3 test-timeout-needs-reason:tests/e2e/cross-version-wire/release-checkout.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/cross-version-wire/release-source-retention.unit.test.ts +2 test-timeout-needs-reason:tests/e2e/cross-version-wire/reported-lossy-initial-snapshot.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/csv-paged-preview.spec.ts 1 test-timeout-needs-reason:tests/e2e/csv-url-links.spec.ts 1 test-timeout-needs-reason:tests/e2e/cursor-quota-transport.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/daemon-generation-legacy-close-safety.spec.ts +2 test-timeout-needs-reason:tests/e2e/daemon-generation-reconnect-safety.spec.ts +2 test-timeout-needs-reason:tests/e2e/default-tabs-mark-crash-relaunch.spec.ts 1 test-timeout-needs-reason:tests/e2e/desktop-published-split-orientation-legacy-leaf.spec.ts +2 test-timeout-needs-reason:tests/e2e/desktop-window-mobile-markdown.spec.ts 1 test-timeout-needs-reason:tests/e2e/floating-tab-rename.spec.ts 1 test-timeout-needs-reason:tests/e2e/golden-quit-relaunch-session.spec.ts +2 test-timeout-needs-reason:tests/e2e/golden-terminal-file-link.spec.ts 1 test-timeout-needs-reason:tests/e2e/golden-worktree-create-switch.spec.ts 1 test-timeout-needs-reason:tests/e2e/headless-mobile-markdown.spec.ts +2 test-timeout-needs-reason:tests/e2e/headless-paired-remote-terminal-retention-memory.spec.ts 1 test-timeout-needs-reason:tests/e2e/headless-paired-remote-terminal-reveal-grid.spec.ts 1 test-timeout-needs-reason:tests/e2e/headless-paired-remote-terminal-stall-recovery.spec.ts 1 test-timeout-needs-reason:tests/e2e/headless-paired-remote-terminal-viewer-size.spec.ts +2 test-timeout-needs-reason:tests/e2e/headless-serve-browser-tab-restart.spec.ts 1 test-timeout-needs-reason:tests/e2e/headless-serve-chat-tab-placement.spec.ts 1 test-timeout-needs-reason:tests/e2e/headless-serve-cli-terminal-retention-parity.spec.ts 1 test-timeout-needs-reason:tests/e2e/headless-serve-mobile-markdown.spec.ts +3 test-timeout-needs-reason:tests/e2e/headless-serve-mobile-native-chat-identity.spec.ts +4 test-timeout-needs-reason:tests/e2e/helpers/electron-process-shutdown.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/host-parked-pane-remote-viewer.spec.ts +2 test-timeout-needs-reason:tests/e2e/host-terminal-agent-phone-push.spec.ts 1 test-timeout-needs-reason:tests/e2e/html-file-url-opening.spec.ts 1 test-timeout-needs-reason:tests/e2e/landing-preflight-runtime-routing.spec.ts 1 test-timeout-needs-reason:tests/e2e/layout-compat-new-desktop-on-old-server.spec.ts +2 test-timeout-needs-reason:tests/e2e/layout-compat-old-desktop-on-new-server.spec.ts 1 test-timeout-needs-reason:tests/e2e/layout-compat-old-phone-on-new-server.spec.ts 1 test-timeout-needs-reason:tests/e2e/layout-compat-serve-restart-keeps-at-at-terminals.spec.ts 1 test-timeout-needs-reason:tests/e2e/linear-issue-view-persistence.spec.ts @@ -691,11 +1187,15 @@ 1 test-timeout-needs-reason:tests/e2e/markdown-review-selection-performance.spec.ts 1 test-timeout-needs-reason:tests/e2e/mobile-subscribe-idle-hidden-pane-fit.spec.ts 1 test-timeout-needs-reason:tests/e2e/orcad-serve-open-url-on-desktop.spec.ts +10 test-timeout-needs-reason:tests/e2e/orchestration-idle-mail-delivery.spec.ts 1 test-timeout-needs-reason:tests/e2e/orchestration-idle-mail-restore.spec.ts 1 test-timeout-needs-reason:tests/e2e/orchestration-legacy-worker-missing-terminal-recovery.spec.ts 1 test-timeout-needs-reason:tests/e2e/orchestration-legacy-worker-restart-recovery.spec.ts 1 test-timeout-needs-reason:tests/e2e/orchestration-worker-settlement-release-cli.spec.ts 1 test-timeout-needs-reason:tests/e2e/orchestration-worker-transcript-providers.spec.ts +2 test-timeout-needs-reason:tests/e2e/packaged-mixed-version-browser-placement.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-browser-create-navigation-deadline.spec.ts +3 test-timeout-needs-reason:tests/e2e/paired-browser-creation-reconciliation-failure.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-cli-terminal-graph-sync-tab-retention.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-first-terminal-unopened-host-worktree.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-host-repo-id-change-rows.spec.ts @@ -705,8 +1205,10 @@ 1 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser-host-strip.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser-markup.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser-network-outage.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser-quit-survival.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser-restart-survival.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser-title-hold.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-hosted-profile-cookies.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-client-project-removal-stops-host-terminals.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-cmd-j-host-qualified-tabs.spec.ts @@ -715,15 +1217,21 @@ 1 test-timeout-needs-reason:tests/e2e/paired-desktop-server-layout-intents.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-desktop-server-layout-writes.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-external-worktree-discovery.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-host-usage-credentials.spec.ts +9 test-timeout-needs-reason:tests/e2e/paired-instant-browser-tab.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror-files-git-review.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror-server-browser.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror-workspace-visibility.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-tab-composition.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-mobile-serve-restart-terminal-tabs.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-pane-title-desktop-host.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-preview-address-bar-convergence.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-quick-open-large-tree.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-browser-ghost-subscriber-rejoin.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-browser-link-open-routing.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-remote-browser-stream-reconnect.spec.ts +3 test-timeout-needs-reason:tests/e2e/paired-remote-html-preview-local-render.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-large-file-open.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-pane-layout-retry.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-split-pane-focus.spec.ts @@ -734,32 +1242,50 @@ 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-host-restart-background-sync.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-initial-snapshot-scrollback.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-lossy-initial-snapshot.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-materialization-reconnect.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-network-outage.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-parked-reveal-interactivity.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-parked-scrollback-restart.spec.ts +3 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-parked-scrollback-survives.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-probe-gap-recovery.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-reconnect-idle-frame.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-retention-memory.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-stall-recovery.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-wide-viewport.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-serve-cold-restore-agent-status.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-server-rows-shadow.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-skill-installation.spec.ts +4 test-timeout-needs-reason:tests/e2e/paired-split-pane-browser-placement.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-startup-exec-readiness.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-terminal-switch-desktop-reveal.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-two-client-emptied-workspace-reseed.spec.ts +2 test-timeout-needs-reason:tests/e2e/paired-usage-owner-placeholders.spec.ts 1 test-timeout-needs-reason:tests/e2e/paired-worktree-activation-isolation.spec.ts +5 test-timeout-needs-reason:tests/e2e/persisted-session-production-upgrade.spec.ts 1 test-timeout-needs-reason:tests/e2e/pr11346-selected-runtime-add.spec.ts 1 test-timeout-needs-reason:tests/e2e/profile-state-automatic-backup-recovery.spec.ts +3 test-timeout-needs-reason:tests/e2e/relay-region-correction.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/remote-agent-session-focus-authority.spec.ts +2 test-timeout-needs-reason:tests/e2e/remote-session-bulk-open-freeze-repro.spec.ts 1 test-timeout-needs-reason:tests/e2e/remote-terminal-input-delivery-model.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/renderer-crash-recovery-terminal-input.spec.ts +3 test-timeout-needs-reason:tests/e2e/restart-restore-terminal-input.spec.ts 1 test-timeout-needs-reason:tests/e2e/runtime-file-browser-windows-drives.spec.ts 1 test-timeout-needs-reason:tests/e2e/runtime-host-status-recovery.spec.ts 1 test-timeout-needs-reason:tests/e2e/settled-worker-tab-survives-restart.spec.ts 1 test-timeout-needs-reason:tests/e2e/sidebar-creation-registry.spec.ts 1 test-timeout-needs-reason:tests/e2e/sidebar-desktop-reads-main.spec.ts +2 test-timeout-needs-reason:tests/e2e/sidebar-host-unread.spec.ts +4 test-timeout-needs-reason:tests/e2e/sidebar-phone-feed-list.spec.ts 1 test-timeout-needs-reason:tests/e2e/sidebar-sort-stamps-order.spec.ts 1 test-timeout-needs-reason:tests/e2e/sidebar-sort-stamps-startup.spec.ts 1 test-timeout-needs-reason:tests/e2e/sidebar-sort-stamps.spec.ts +2 test-timeout-needs-reason:tests/e2e/sidebar-unread-older-paired-host.spec.ts 1 test-timeout-needs-reason:tests/e2e/sidebar-workspace-rows.spec.ts +2 test-timeout-needs-reason:tests/e2e/source-control-large-file-count.spec.ts +5 test-timeout-needs-reason:tests/e2e/ssh-orcad-auto-convert.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-browser-drop-owner.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-browser-routing.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-browser-service-status.spec.ts @@ -769,582 +1295,52 @@ 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-editor-watch-recovery.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-explorer-selected-host.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-explorer-watch-recovery.spec.ts +4 test-timeout-needs-reason:tests/e2e/ssh-orcad-idle-exit.spec.ts +3 test-timeout-needs-reason:tests/e2e/ssh-orcad-legacy-relay-bridge.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-markdown-conversion.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-markdown-link-refresh.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-markdown-live-documents.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-open-in-owner.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-paired-phone-projects.spec.ts +3 test-timeout-needs-reason:tests/e2e/ssh-orcad-pairing-repair.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-phone-feed-list.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-relay-tab-only-shell.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-shared-home-machines.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-shared-login-migration.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-sleep-disconnected.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-terminal-browser-link.spec.ts +3 test-timeout-needs-reason:tests/e2e/ssh-orcad-terminal-journeys.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-terminal-network-outage.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-terminal-reconnect-idle-frame.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-terminal-root-owner.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-unbindable-tunnel-port.spec.ts 1 test-timeout-needs-reason:tests/e2e/ssh-orcad-update-anyway.spec.ts +2 test-timeout-needs-reason:tests/e2e/ssh-orcad-windows-cli-matrix.spec.ts +4 test-timeout-needs-reason:tests/e2e/ssh-orcad-workspace-tools.spec.ts 1 test-timeout-needs-reason:tests/e2e/staging-skill-sharing.spec.ts 1 test-timeout-needs-reason:tests/e2e/structured-chat-tabs-open-close.spec.ts 1 test-timeout-needs-reason:tests/e2e/sustained-agent-typing-load-scripts.unit.test.ts 1 test-timeout-needs-reason:tests/e2e/terminal-cli-split-closed-before-mount.spec.ts +6 test-timeout-needs-reason:tests/e2e/terminal-column-desync-repro.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-hidden-view-parking.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-inline-images-memory.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-inline-images-paired-runtime.spec.ts +6 test-timeout-needs-reason:tests/e2e/terminal-inline-tui-reveal-convergence.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-parked-cli-split.spec.ts +3 test-timeout-needs-reason:tests/e2e/terminal-parked-memory.spec.ts +3 test-timeout-needs-reason:tests/e2e/terminal-send-agent-prompt-submit.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-split-activation-latency.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-stuck-occlusion-recovery.spec.ts +3 test-timeout-needs-reason:tests/e2e/terminal-tab-close-running-confirm-mouse.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-tab-close-running-confirm.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-tab-level-binding-upgrade.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-warm-reattach-split-live-output.spec.ts 1 test-timeout-needs-reason:tests/e2e/terminal-window-wake-stale-grid-repro.spec.ts +2 test-timeout-needs-reason:tests/e2e/terminal-windows-codex-multiline-paste.spec.ts 1 test-timeout-needs-reason:tests/e2e/unopened-workspace-agent-single-resume.spec.ts 1 test-timeout-needs-reason:tests/e2e/windows-wsl-terminal-restore.spec.ts 1 test-timeout-needs-reason:tests/e2e/workspace-layout-oracle-headless.spec.ts 1 test-timeout-needs-reason:tests/e2e/workspace-session-corrupt-tab-salvage.spec.ts -1 test-timeout-needs-reason:tests/e2e/worktree-switch-first-paint.spec.ts -10 test-no-in-test-import-actual:src/main/claude-usage/scanner-scan.test.ts -10 test-no-real-time-wait:src/main/agent-hooks/wsl-hook-relay-manager.test.ts -10 test-no-real-time-wait:src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts -10 test-no-wall-clock:src/main/observability/bundle.test.ts -10 test-no-wall-clock:src/main/orca-profiles/profile-cloud-auth-characterization.test.ts -10 test-timeout-needs-reason:tests/e2e/orchestration-idle-mail-delivery.spec.ts -11 test-no-real-time-wait:src/main/daemon/sessions/testing/reattach-snapshot.test.ts -11 test-no-real-time-wait:src/main/native-chat/transcript-watch.test.ts -11 test-no-wall-clock:src/main/github/pr-refresh-coordinator-visibility-policy.test.ts -11 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-relay-pairing.test.ts -12 test-no-real-time-wait:src/main/browser/cdp/transport/cdp-ws-proxy.test.ts -12 test-no-wall-clock:src/main/rate-limits/service-minimax-usage.test.ts -13 test-no-real-time-wait:tests/e2e/terminal-long-table-scroll-restore.spec.ts -13 test-no-wall-clock:src/main/startup/windows-install-dir-acl-recovery.test.ts -3 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatMessageList.test.tsx -3 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatMessageList.turn-indicator.test.tsx -14 test-no-real-time-wait:src/main/ipc/worktrees/creation/worktree-base-directory-poller.test.ts -14 test-no-wall-clock:src/wsl-guest/agent-hook-integration.test.ts -15 test-no-wall-clock:src/main/github/pr-refresh-coordinator-alias-coalescing.test.ts -16 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli.test.ts -18 test-no-wall-clock:src/main/github/pr-refresh-coordinator-visible-follow-up.test.ts -18 test-no-wall-clock:src/main/provider-process/provider-process-supervisor.integration.test.ts -16 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-hook-lane-runtime.test.ts -2 test-no-in-test-import-actual:src/main/daemon/history/storage/testing/terminal-history-permissions.test.ts -2 test-no-in-test-import-actual:src/main/managed-server/activation/orcad-activation-crash-recovery.test.ts -2 test-no-in-test-import-actual:src/main/ssh/connection/ssh-connection-auth-fallback.test.ts -2 test-no-in-test-import-actual:src/main/workspace-hooks/hooks-runner.test.ts -2 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-cli-worktree-activation.test.ts -2 test-no-polling-loop:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts -2 test-no-polling-loop:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts -2 test-no-polling-loop:src/main/native-chat/transcript-watch-liveness.test.ts -2 test-no-polling-loop:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts -2 test-no-polling-loop:src/main/skills/skill-process-termination.integration.test.ts -2 test-no-polling-loop:src/main/skills/skill-upload-process-restart.integration.test.ts -2 test-no-polling-loop:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts -2 test-no-polling-loop:src/main/windows/windows-host-job.win32.test.ts -1 test-no-polling-loop:src/main/windows/windows-pty-job.win32.test.ts -2 test-no-polling-loop:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts -2 test-no-polling-loop:tests/e2e/floating-workspace-reopen-webgl-recovery.spec.ts -2 test-no-polling-loop:tests/e2e/helpers/computer-driver.ts -2 test-no-polling-loop:tests/e2e/helpers/layout-compat-baseline.ts -2 test-no-polling-loop:tests/e2e/helpers/legacy-relay-docker-host.ts -2 test-no-polling-loop:tests/e2e/paired-instant-browser-tab.spec.ts -2 test-no-polling-loop:tests/e2e/terminal-column-desync-repro.spec.ts -2 test-no-polling-loop:tests/e2e/terminal-column-probes.ts -2 test-no-polling-loop:tests/e2e/terminal-hidden-view-parking.spec.ts -2 test-no-polling-loop:tests/e2e/terminal-parked-memory.spec.ts -2 test-no-polling-loop:tests/e2e/terminal-pty-readiness.ts -2 test-no-polling-loop:tests/e2e/terminal-tab-switch-visual-restore.spec.ts -2 test-no-polling-loop:tests/e2e/terminal-tui-wheel-reports.spec.ts -2 test-no-polling-loop:tests/e2e/worktree-card-downward-drag.spec.ts -2 test-no-real-time-wait:config/scripts/test-runtime/dom/happy-dom-mutation-observer-retention.test.ts -2 test-no-real-time-wait:mobile/src/notifications/push-registration-cancellation.test.ts -2 test-no-real-time-wait:src/main/agent-hooks/server-transport-interference.test.ts -2 test-no-real-time-wait:src/main/ai-vault/scanners/opencode/sqlite/session-scanner-opencode-sqlite-scan-scope.test.ts -2 test-no-real-time-wait:src/main/browser/guest-lifecycle/popups/browser-popup-compatibility.electron.test.ts -2 test-no-real-time-wait:src/main/claude-accounts/claude-profile-router.test.ts -2 test-no-real-time-wait:src/main/claude/claude-stream-json-connection.test.ts -2 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli-fold.test.ts -2 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts -2 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-daemon-recovery.test.ts -2 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-recovery.test.ts -2 test-no-real-time-wait:src/main/daemon/pty-subprocess/testing/node-pty-conout-worker-errors.test.ts -2 test-no-real-time-wait:src/main/foreign-sqlite-readers/foreign-sqlite-reader-event-loop.test.ts -2 test-no-real-time-wait:src/main/ipc/folder-repo-git-upgrade.test.ts -2 test-no-real-time-wait:src/main/ipc/native-chat.test.ts -2 test-no-real-time-wait:src/main/ipc/workspace-cleanup/workspace-cleanup-snapshot-ipc.test.ts -2 test-no-real-time-wait:src/main/ipc/worktrees-background-removal.test.ts -2 test-no-real-time-wait:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts -2 test-no-real-time-wait:src/main/managed-server/install/orcad-remote-windows-scripts.test.ts -2 test-no-real-time-wait:src/main/managed-server/install/remote-node-runtime-store-lock-host-release.test.ts -2 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-claude-subagent-row.test.ts -2 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-restart-resume.test.ts -2 test-no-real-time-wait:src/main/native-chat/transcript-watch-liveness.test.ts -2 test-no-real-time-wait:src/main/providers/startup-line-typed-length.live-shell.test.ts -2 test-no-real-time-wait:src/main/pty/history/terminal-history-fish-session.node-pty.test.ts -2 test-no-real-time-wait:src/main/pty/history/terminal-history-tombstone-scan-cost.test.ts -2 test-no-real-time-wait:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts -2 test-no-real-time-wait:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts -2 test-no-real-time-wait:src/main/skills/skill-upload-process-restart.integration.test.ts -2 test-no-real-time-wait:src/main/ssh/sftp-upload.test.ts -2 test-no-real-time-wait:src/main/ssh/ssh-quit-abort-upload.test.ts -2 test-no-real-time-wait:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts -2 test-no-real-time-wait:src/main/startup/windows-install-dir-acl-recovery.test.ts -2 test-no-real-time-wait:src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts -2 test-no-real-time-wait:src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts -2 test-no-real-time-wait:src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-host-exit-record.test.ts -2 test-no-real-time-wait:src/renderer/src/lib/execute-open-editor-path-move.test.ts -2 test-no-real-time-wait:src/renderer/src/store/slices/workspace-cleanup-removal-preflight.test.ts -2 test-no-real-time-wait:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts -2 test-no-real-time-wait:src/shared/remote-runtime/control/remote-runtime-shared-control-auth-refusal.test.ts -2 test-no-real-time-wait:src/shared/setup-agent-sequencing.test.ts -2 test-no-real-time-wait:src/shared/startup-command-staging.node-pty.test.ts -2 test-no-real-time-wait:tests/e2e/cli-floating-file-open-position.spec.ts -2 test-no-real-time-wait:tests/e2e/cross-version-wire/released-relay-transport.ts -2 test-no-real-time-wait:tests/e2e/default-tabs-mark-crash-relaunch.spec.ts -2 test-no-real-time-wait:tests/e2e/droid-notification.spec.ts -2 test-no-real-time-wait:tests/e2e/editor-tab-selection-restore.spec.ts -2 test-no-real-time-wait:tests/e2e/github-project-board.spec.ts -2 test-no-real-time-wait:tests/e2e/helpers/computer-cli-driver.ts -2 test-no-real-time-wait:tests/e2e/helpers/layout-compat-baseline.ts -2 test-no-real-time-wait:tests/e2e/helpers/legacy-relay-docker-host.ts -2 test-no-real-time-wait:tests/e2e/helpers/workspace-layout-oracle-markers.ts -2 test-no-real-time-wait:tests/e2e/helpers/workspace-layout-oracle.ts -2 test-no-real-time-wait:tests/e2e/host-terminal-agent-phone-push.spec.ts -2 test-no-real-time-wait:tests/e2e/paired-client-hosted-browser-quit-survival.spec.ts -2 test-no-real-time-wait:tests/e2e/paired-remote-browser-ghost-subscriber-rejoin.spec.ts -2 test-no-real-time-wait:tests/e2e/paired-remote-browser-stream-reconnect.spec.ts -2 test-no-real-time-wait:tests/e2e/paired-two-client-emptied-workspace-reseed.spec.ts -2 test-no-real-time-wait:tests/e2e/relaunch-first-terminal.spec.ts -2 test-no-real-time-wait:tests/e2e/setup-script-prompt-unreadable-orca-yaml.spec.ts -2 test-no-real-time-wait:tests/e2e/sidebar-desktop-reads-main.spec.ts -2 test-no-real-time-wait:tests/e2e/sidebar-sort-stamps-order.spec.ts -2 test-no-real-time-wait:tests/e2e/sidebar-sort-stamps.spec.ts -2 test-no-real-time-wait:tests/e2e/slept-workspace-remount-wake.spec.ts -2 test-no-real-time-wait:tests/e2e/tasks-page.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-cjk-ime-committed-text.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-column-probes.ts -2 test-no-real-time-wait:tests/e2e/terminal-document-visibility-webgl-recovery.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-hangul-terminating-digit-native.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-pane-title-editing.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-pinned-viewport-streaming-switch.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-pinned-viewport-worktree-switch.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-reveal-paused-render-repro.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-tab-level-binding-upgrade.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-tab-switch-sigwinch-restore.spec.ts -2 test-no-real-time-wait:tests/e2e/terminal-windows-codex-multiline-paste.spec.ts -2 test-no-real-time-wait:tests/e2e/workspace-emoji-picker.spec.ts -2 test-no-real-time-wait:tests/e2e/worktree-card-downward-drag.spec.ts -1 test-no-wall-clock:mobile/src/session/native-chat/composer/use-mobile-native-chat-message-send-draft-lifetime.test.ts -2 test-no-wall-clock:src/cli/format.test.ts -2 test-no-wall-clock:src/cli/runtime/serve-appimage-update.test.ts -2 test-no-wall-clock:src/main/agent-hooks/managed-hook-timeout.test.ts -2 test-no-wall-clock:src/main/agent-hooks/manual-compact-hook-stream.test.ts -2 test-no-wall-clock:src/main/agent-hooks/posix-hook-json-stdin-reader.test.ts -2 test-no-wall-clock:src/main/agent-hooks/server-hook-http-ingest.test.ts -2 test-no-wall-clock:src/main/agent-hooks/windows-native-hook-exe-hosts.test.ts -2 test-no-wall-clock:src/main/ai-vault/scanners/copilot/session-scanner-copilot-parser.test.ts -2 test-no-wall-clock:src/main/ai-vault/scanners/grok/session-scanner-grok-parser.test.ts -2 test-no-wall-clock:src/main/ai-vault/scanners/opencode/session-scanner-opencode-parser.test.ts -2 test-no-wall-clock:src/main/antigravity/posix-hook-invocation.test.ts -2 test-no-wall-clock:src/main/browser/cdp/transport/cdp-ws-proxy.test.ts -2 test-no-wall-clock:src/main/browser/cookies/browser-cookie-import-partition-reland.electron.test.ts -2 test-no-wall-clock:src/main/browser/network/execution-routes/wsl-browser-network-execution-route.test.ts -2 test-no-wall-clock:src/main/browser/sessions/browser-session-registry.test.ts -2 test-no-wall-clock:src/main/codex/configuration/settings/config-settings-promotion.test.ts -2 test-no-wall-clock:src/main/codex/structured/launch/codex-structured-real-cli-command-env.test.ts -2 test-no-wall-clock:src/main/codex/trust/hooks/codex-hook-trust-derivation.test.ts -2 test-no-wall-clock:src/main/daemon/server/testing/daemon-idle-shutdown.test.ts -2 test-no-wall-clock:src/main/daemon/transport/framing/testing/daemon-stream-binary-negotiation.test.ts -2 test-no-wall-clock:src/main/daemon/history/restoration/testing/terminal-history-incremental-restore.test.ts -2 test-no-wall-clock:src/main/daemon/shell-readiness/testing/terminal-shell-recovery-barrier.test.ts -2 test-no-wall-clock:src/main/external-conversations/external-conversation-cancel-settlement.test.ts -2 test-no-wall-clock:src/main/git/command-runner/git-command-resolution-windows-checkout.test.ts -2 test-no-wall-clock:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts -2 test-no-wall-clock:src/main/git/runner-gh-account-binding.test.ts -2 test-no-wall-clock:src/main/git/worktrees/catalog/worktree-created-description-real-git.test.ts -2 test-no-wall-clock:src/main/github/client-pr-fallback-number.test.ts -2 test-no-wall-clock:src/main/github/pr-refresh-coordinator-error-cadence.test.ts -2 test-no-wall-clock:src/main/grok/grok-hook-stdin-no-eof.test.ts -2 test-no-wall-clock:src/main/ipc/native-chat-subscribe-lifecycle.test.ts -2 test-no-wall-clock:src/main/ipc/native-chat.test.ts -2 test-no-wall-clock:src/main/ipc/worktrees/git/worktree-git-status-attribution-real-git.test.ts -2 test-no-wall-clock:src/main/macos-permissions/macos-tcc-log-stream-orphans.test.ts -2 test-no-wall-clock:src/main/managed-server/install/orcad-remote-launch-file-modes.test.ts -2 test-no-wall-clock:src/main/managed-server/install/orcad-remote-windows-scripts.test.ts -2 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-host-download.test.ts -2 test-no-wall-clock:src/main/native-chat/transcript-watch.test.ts -2 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-sign-out-connect-race.test.ts -2 test-no-wall-clock:src/main/orcad/orcad-artifact-cache-retention.test.ts -2 test-no-wall-clock:src/main/orcad/orcad-artifact-materializer.test.ts -2 test-no-wall-clock:src/main/orcad/orcad-secret-store.test.ts -2 test-no-wall-clock:src/main/orcad/orcad-stale-lock-reclaim.test.ts -2 test-no-wall-clock:src/main/persistence/migrating-orcad-catalog/orcad-source-release-upgrade.test.ts -2 test-no-wall-clock:src/main/persistence/profile-state/profile-state-backup-temporary-files.test.ts -2 test-no-wall-clock:src/main/persistence/profile-state/profile-state-live-store-factory.test.ts -2 test-no-wall-clock:src/main/persistence/profile-state/profile-state-section-repair.test.ts -2 test-no-wall-clock:src/main/persistence/tracking-repos/persistence-deregistered-repo-residue.test.ts -2 test-no-wall-clock:src/main/persistence/tracking-repos/persistence-workspace-session-scrollback.test.ts -2 test-no-wall-clock:src/main/provider-process/provider-group-orphan-guard.integration.test.ts -2 test-no-wall-clock:src/main/providers/startup-line-typed-length.live-shell.test.ts -2 test-no-wall-clock:src/main/pty/history/terminal-history-fish-session.node-pty.test.ts -1 test-no-wall-clock:src/main/pty/history/terminal-history-gc-fs-call-count.test.ts -2 test-no-wall-clock:src/main/pty/process-retirement/posix-pty-process-groups.integration.test.ts -2 test-no-wall-clock:src/main/rate-limits/claude-profile-usage.test.ts -2 test-no-wall-clock:src/main/rate-limits/service-cursor-usage.test.ts -2 test-no-wall-clock:src/main/runtime/agent-session/structured-agent-session-held-signal.test.ts -2 test-no-wall-clock:src/main/runtime/orchestration-codex-real-pty.integration.test.ts -2 test-no-wall-clock:src/main/runtime/orchestration/worker-output-archive.test.ts -2 test-no-wall-clock:src/main/runtime/remote-runtime-request-connection.integration.test.ts -2 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/fleet-status-observed-identity.test.ts -2 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/worker-output.test.ts -2 test-no-wall-clock:src/main/runtime/client/settings/runtime-client-agent-launch-settings-durability.test.ts -2 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-websocket-bind-host.test.ts -2 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-claude-task-wakeup.test.ts -2 test-no-wall-clock:src/main/skills/skill-process-contention-child.test.ts -2 test-no-wall-clock:src/main/skills/skill-process-contention.integration.test.ts -2 test-no-wall-clock:src/main/skills/skill-transaction-startup-recovery.test.ts -2 test-no-wall-clock:src/main/ssh/orcad-exited-own-lock-windows.test.ts -2 test-no-wall-clock:src/main/star-nag/service-direct-star.test.ts -2 test-no-wall-clock:src/main/startup/gpu-lifecycle-install-dir-acl-guard.test.ts -2 test-no-wall-clock:src/main/startup/run-electron-vite-dev-web.test.ts -2 test-no-wall-clock:src/main/startup/run-electron-vite-dev.test.ts -2 test-no-wall-clock:src/main/windows/windows-host-job.win32.test.ts -2 test-no-wall-clock:src/main/windows/windows-pty-job.win32.test.ts -2 test-no-wall-clock:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts -2 test-no-wall-clock:src/main/workspaces/removal/local-worktree-removal-recovery-live.test.ts -2 test-no-wall-clock:src/main/wsl/execution/wsl-runner.wsl.test.ts -2 test-no-wall-clock:src/renderer/src/components/artifacts/ArtifactCollection.test.tsx -2 test-no-wall-clock:src/renderer/src/components/artifacts/artifact-list-windowing.test.tsx -2 test-no-wall-clock:src/renderer/src/components/dashboard/useLiveDashboardSnapshot.test.ts -2 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatStructuredSessionStatus.test.tsx -1 test-no-wall-clock:src/renderer/src/components/sidebar/workspace-card/surface/WorktreeCard.single-reference-details.test.tsx -2 test-no-wall-clock:src/renderer/src/components/status-bar/status-bar-antigravity-segment.test.tsx -2 test-no-wall-clock:src/renderer/src/components/terminal-pane/fish-color-scheme-child-stdin.node-pty.test.ts -2 test-no-wall-clock:src/renderer/src/components/terminal-pane/remote-snapshot-alt-screen-host-chain.test.ts -2 test-no-wall-clock:src/renderer/src/components/workspace-cleanup/use-workspace-cleanup-removal.agent-stop.test.tsx -2 test-no-wall-clock:src/renderer/src/hooks/ipc-events/agent-status-terminal-title-tab-write.test.ts -2 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-cli-worktree-activation.test.ts -2 test-no-wall-clock:src/renderer/src/lib/agent-session/launch/structured-agent-session-launch-persistence.test.ts -2 test-no-wall-clock:src/renderer/src/lib/settled-worker-wake-policy.test.ts -2 test-no-wall-clock:src/renderer/src/lib/use-tab-agent-observed-signal-dispatch.test.tsx -2 test-no-wall-clock:src/renderer/src/lib/wake-sleeping-agents-live-unmounted-pane.test.ts -2 test-no-wall-clock:src/renderer/src/runtime/structured-agent-session-tab-retirement.test.ts -2 test-no-wall-clock:src/renderer/src/store/slices/github-pr-branch-linked-pr-divergence.test.ts -2 test-no-wall-clock:src/shared/crash-reporting.test.ts -2 test-no-wall-clock:src/shared/fish-query-reply-child-stdin.node-pty.test.ts -2 test-no-wall-clock:src/shared/terminal/pty/ingress/pty-reply-echo-shapes.node-pty.test.ts -2 test-no-wall-clock:src/shared/startup-command-staging.node-pty.test.ts -2 test-no-wall-clock:src/wsl-guest/agent-hook-server.test.ts -2 test-no-wall-clock:tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts -2 test-no-wall-clock:tests/e2e/cross-version-wire/release-source-retention.unit.test.ts -2 test-no-wall-clock:tests/e2e/omp-child-session-recovery.unit.test.ts -2 test-timeout-needs-reason:mobile/src/terminal/document/native-document-bundle.test.ts -2 test-timeout-needs-reason:src/main/acp/acp-structured-broken-stream.test.ts -2 test-timeout-needs-reason:src/main/antigravity/windows-hook-json-post.test.ts -2 test-timeout-needs-reason:src/main/browser/cookies/browser-cookie-import-partition-reland.electron.test.ts -2 test-timeout-needs-reason:src/main/browser/identity/browser-session-ua-wire-identity-cross-context.electron.test.ts -2 test-timeout-needs-reason:src/main/claude/claude-status-line-windows.test.ts -2 test-timeout-needs-reason:src/main/codex/app-server/codex-app-server-teardown.integration.test.ts -2 test-timeout-needs-reason:src/main/daemon/executable-host/linux/testing/daemon-appimage-copy-host.electron.test.ts -2 test-timeout-needs-reason:src/main/daemon/providers/checkpointing/testing/daemon-reattach-checkpoint-isolation.test.ts -2 test-timeout-needs-reason:src/main/daemon/health/testing/issue-6814-daemon-failure-classification.test.ts -2 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-conout-worker-errors.test.ts -1 test-timeout-needs-reason:src/main/ipc/filesystem/filesystem-quick-open-options.integration.test.ts -2 test-timeout-needs-reason:src/main/managed-server/install/remote-node-runtime-store-lock-host-release.test.ts -2 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-ends-session.test.ts -2 test-timeout-needs-reason:src/main/orcad/orcad-serve-parity.integration.test.ts -2 test-timeout-needs-reason:src/main/persistence/persistence-initial-load.test.ts -2 test-timeout-needs-reason:src/main/providers/agent-foreground-process-git-bash.win32.test.ts -2 test-timeout-needs-reason:src/main/providers/startup-line-typed-length.live-shell.test.ts -2 test-timeout-needs-reason:src/main/runtime/cline-screen-readiness-transcripts.test.ts -2 test-timeout-needs-reason:src/main/runtime/terminal/wait/launched-agent-crash-guard.live-shell.test.ts -2 test-timeout-needs-reason:src/main/runtime/orchestration/preamble.test.ts -2 test-timeout-needs-reason:src/main/runtime/rpc/server/runtime-rpc-device-revocation.test.ts -2 test-timeout-needs-reason:src/main/ssh/connection/ssh-connection-sftp-wire.test.ts -1 test-timeout-needs-reason:src/main/ssh/ssh-credential-prompt-login-grace-wire.test.ts -2 test-timeout-needs-reason:src/main/ssh/system-transport/system-ssh-forward-process-real-openssh.test.ts -2 test-timeout-needs-reason:src/main/startup/single-instance-lock-exit.electron.test.ts -2 test-timeout-needs-reason:src/main/workspace-hooks/hook-archive-timeout-observation.test.ts -2 test-timeout-needs-reason:src/main/workspace-hooks/hook-termination-real-process.test.ts -2 test-timeout-needs-reason:src/main/workspaces/removal/local-worktree-filesystem-wsl-banner.wsl.test.ts -2 test-timeout-needs-reason:tests/e2e/cross-version-wire/agent-session-clear-old-client.unit.test.ts -2 test-timeout-needs-reason:tests/e2e/cross-version-wire/agent-session-newer-chat-refusal.unit.test.ts -2 test-timeout-needs-reason:tests/e2e/cross-version-wire/reported-lossy-initial-snapshot.unit.test.ts -2 test-timeout-needs-reason:tests/e2e/daemon-generation-reconnect-safety.spec.ts -2 test-timeout-needs-reason:tests/e2e/default-tabs-mark-crash-relaunch.spec.ts -2 test-timeout-needs-reason:tests/e2e/desktop-window-mobile-markdown.spec.ts -2 test-timeout-needs-reason:tests/e2e/golden-terminal-file-link.spec.ts -2 test-timeout-needs-reason:tests/e2e/headless-paired-remote-terminal-retention-memory.spec.ts -2 test-timeout-needs-reason:tests/e2e/headless-serve-browser-tab-restart.spec.ts -2 test-timeout-needs-reason:tests/e2e/host-terminal-agent-phone-push.spec.ts -2 test-timeout-needs-reason:tests/e2e/layout-compat-old-desktop-on-new-server.spec.ts -2 test-timeout-needs-reason:tests/e2e/packaged-mixed-version-browser-placement.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-browser-create-navigation-deadline.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser-quit-survival.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-client-hosted-browser.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-host-usage-credentials.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-mobile-desktop-mirror.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-quick-open-large-tree.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-remote-browser-stream-reconnect.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-materialization-reconnect.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-parked-scrollback-restart.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-serve-restart-binding.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-truncated-tail-first-paint.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-skill-installation.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-startup-exec-readiness.spec.ts -2 test-timeout-needs-reason:tests/e2e/paired-usage-owner-placeholders.spec.ts -2 test-timeout-needs-reason:tests/e2e/remote-session-bulk-open-freeze-repro.spec.ts -2 test-timeout-needs-reason:tests/e2e/sidebar-host-unread.spec.ts -2 test-timeout-needs-reason:tests/e2e/sidebar-unread-older-paired-host.spec.ts -2 test-timeout-needs-reason:tests/e2e/source-control-large-file-count.spec.ts -2 test-timeout-needs-reason:tests/e2e/ssh-orcad-windows-cli-matrix.spec.ts -2 test-timeout-needs-reason:tests/e2e/terminal-windows-codex-multiline-paste.spec.ts 2 test-timeout-needs-reason:tests/e2e/worktree-reveal-host-sections.spec.ts -3 test-no-in-test-import-actual:src/main/codex-accounts/runtime-home-read-only-launch-resolution.test.ts -3 test-no-in-test-import-actual:src/renderer/src/components/terminal-pane/remote-snapshot-alt-screen-host-chain.test.ts -3 test-no-in-test-import-actual:src/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.ts -3 test-no-polling-loop:src/main/cli/packaged-cli-assets.test.ts -3 test-no-polling-loop:src/main/skills/skill-bundle-process-termination.integration.test.ts -3 test-no-polling-loop:tests/e2e/combined-diff-scroll-restore.spec.ts -3 test-no-polling-loop:tests/e2e/host-parked-pane-remote-viewer.spec.ts -3 test-no-polling-loop:tests/e2e/paired-remote-terminal-client-restart-survival.spec.ts -3 test-no-real-time-wait:src/main/agent-hooks/server-copilot-normalization.test.ts -3 test-no-real-time-wait:src/main/claude-accounts/claude-profile-wsl-router.test.ts -3 test-no-real-time-wait:src/main/claude/claude-cli-flag-support.test.ts -3 test-no-real-time-wait:src/main/cli/packaged-cli-assets.test.ts -3 test-no-real-time-wait:src/main/codex/hooks/installation/hook-service-concurrent-launch-install.test.ts -3 test-no-real-time-wait:src/main/codex/hooks/reconciliation/codex-hook-reconcile.test.ts -3 test-no-real-time-wait:src/main/daemon/transport/client/testing/client.test.ts -3 test-no-real-time-wait:src/main/daemon/pty-subprocess/testing/node-pty-fd-leak.test.ts -3 test-no-real-time-wait:src/main/ipc/runtime-environments/runtime-environment-preference.test.ts -3 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-at-rest-commands.test.ts -3 test-no-real-time-wait:src/main/native-chat/agent-session-wire/structured-agent-session-queued-command.test.ts -3 test-no-real-time-wait:src/main/provider-process/provider-process-supervisor.integration.test.ts -3 test-no-real-time-wait:src/main/runtime/layout-command-pane-starts-layout-owner.test.ts -3 test-no-real-time-wait:src/main/runtime/orchestration-codex-real-pty.integration.test.ts -3 test-no-real-time-wait:src/main/runtime/rpc/terminal-subscribe-reconnect-rebind.test.ts -3 test-no-real-time-wait:src/main/skills/skill-bundle-process-termination.integration.test.ts -3 test-no-real-time-wait:src/main/skills/skill-process-termination.integration.test.ts -3 test-no-real-time-wait:src/main/startup/run-electron-vite-dev-web.test.ts -3 test-no-real-time-wait:src/main/startup/run-electron-vite-dev.test.ts -3 test-no-real-time-wait:src/main/windows/windows-host-job.win32.test.ts -2 test-no-real-time-wait:src/main/wsl/execution/wsl-command-loop.test.ts -3 test-no-real-time-wait:src/main/wsl/orcad/wsl-orcad-watch.test.ts -3 test-no-real-time-wait:src/renderer/src/components/terminal-pane/pty-connection-hidden-backlog-snapshot.test.ts -3 test-no-real-time-wait:src/renderer/src/components/terminal-pane/remote-runtime-pty-transport-subscribe-ack-input.test.ts -3 test-no-real-time-wait:src/shared/darwin-process-table-capture.test.ts -3 test-no-real-time-wait:tests/e2e/agent-session-log-tail-stability.spec.ts -3 test-no-real-time-wait:tests/e2e/cross-version-wire/host-model-catalog-released-phone.unit.test.ts -3 test-no-real-time-wait:tests/e2e/helpers/remote-session-bulk-open-oracle.ts -3 test-no-real-time-wait:tests/e2e/host-parked-pane-remote-viewer.spec.ts -3 test-no-real-time-wait:tests/e2e/notification-sound-replay.spec.ts -3 test-no-real-time-wait:tests/e2e/paired-remote-terminal-client-restart-survival.spec.ts -3 test-no-real-time-wait:tests/e2e/terminal-hidden-view-parking.spec.ts -3 test-no-real-time-wait:tests/e2e/terminal-raw-emoji-table-scroll-restore.spec.ts -3 test-no-real-time-wait:tests/e2e/workspace-sleep-main-resume.spec.ts -3 test-no-real-time-wait:tests/e2e/worktree-switch-first-paint.spec.ts -3 test-no-real-time-wait:tests/e2e/worktree.spec.ts -1 test-no-wall-clock:config/scripts/worktree-storage/reclaim-dev-electron-bundles.test.ts -3 test-no-wall-clock:mobile/src/transport/mobile-relay-resume-director.test.ts -3 test-no-wall-clock:mobile/src/transport/rpc-client-live-recovery.test.ts -3 test-no-wall-clock:src/main/agent-hooks/server-ingest-structured-status.test.ts -3 test-no-wall-clock:src/main/ai-vault/scanners/claude/session-scanner-claude-subagents.test.ts -3 test-no-wall-clock:src/main/ai-vault/scanners/cursor/session-scanner-cursor-chat-meta.test.ts -3 test-no-wall-clock:src/main/ai-vault/scanners/jcode/session-scanner-jcode-parser.test.ts -3 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli-stop-task.test.ts -3 test-no-wall-clock:src/main/claude/structured/launch/claude-structured-real-cli-options.test.ts -3 test-no-wall-clock:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-checkpoints.test.ts -3 test-no-wall-clock:src/main/daemon/providers/adapter/testing/daemon-self-retirement-respawn.test.ts -3 test-no-wall-clock:src/main/external-conversations/external-conversation-cancel.test.ts -3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-foreground-pacing.test.ts -3 test-no-wall-clock:src/main/github/pr-refresh-coordinator-refresh-events.test.ts -3 test-no-wall-clock:src/main/ipc/folder-repo-git-upgrade.test.ts -3 test-no-wall-clock:src/main/ipc/runtime-environments/runtime-environment-request-connections.test.ts -3 test-no-wall-clock:src/main/ipc/worktrees/creation/worktree-base-directory-poller.test.ts -3 test-no-wall-clock:src/main/managed-server/host-state/orcad-state-snapshot-shell.test.ts -3 test-no-wall-clock:src/main/managed-server/host-state/orcad-windows-host-fence-ops.test.ts -3 test-no-wall-clock:src/main/managed-server/install/orcad-remote-shell-commands.integration.test.ts -3 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-store-windows.test.ts -3 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-refresh.test.ts -3 test-no-wall-clock:src/main/orcad/orcad-node-launcher.integration.test.ts -3 test-no-wall-clock:src/main/orcad/orcad-stop-request-shutdown.integration.test.ts -3 test-no-wall-clock:src/main/persistence/terminal-topology/persistence-pane-identity-migration.test.ts -3 test-no-wall-clock:src/main/provider-process/provider-process-teardown.test.ts -3 test-no-wall-clock:src/main/runtime/orca-runtime-agent-session-operation.test.ts -3 test-no-wall-clock:src/main/runtime/orca-runtime-codex-idle-title-chat-address.test.ts -3 test-no-wall-clock:src/main/runtime/orchestration-cli-subprocess.test.ts -3 test-no-wall-clock:src/main/runtime/rpc/methods/orchestration/worker/fleet-status-terminal-identity.test.ts -2 test-no-wall-clock:src/main/runtime/workspace-layout-live-titles.test.ts -3 test-no-wall-clock:src/main/star-nag/service-threshold-prompt.test.ts -3 test-no-wall-clock:src/main/windows/windows-msys-job.win32.test.ts -3 test-no-wall-clock:src/main/wsl/orcad/wsl-orcad-real-distro-lane.test.ts -3 test-no-wall-clock:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx -3 test-no-wall-clock:src/renderer/src/components/terminal-pane/terminal-hidden-view-parking.test.ts -3 test-no-wall-clock:src/renderer/src/hooks/useAutomationDispatchEvents.test.ts -3 test-no-wall-clock:src/renderer/src/hooks/useIpcEvents-close-routing-browser-pages.test.ts -3 test-timeout-needs-reason:mobile/src/transport/rpc-client-reconnect-wait.test.ts -3 test-timeout-needs-reason:src/main/antigravity/windows-hook-payload-delivery.test.ts -3 test-timeout-needs-reason:src/main/daemon/providers/checkpointing/testing/daemon-shutdown-final-checkpoint-caller-deadline.test.ts -3 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-windows-input-error.win32.test.ts -3 test-timeout-needs-reason:src/main/native-chat/agent-model-catalog/agent-model-catalog-probe-runner.test.ts -3 test-timeout-needs-reason:src/main/runtime/orchestration-cli-subprocess.test.ts -3 test-timeout-needs-reason:src/main/runtime/terminal-interactive-wait-visibility.test.ts -3 test-timeout-needs-reason:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts -3 test-timeout-needs-reason:tests/e2e/cross-version-wire/cross-version-terminal-wire.unit.test.ts -3 test-timeout-needs-reason:tests/e2e/cross-version-wire/release-checkout.unit.test.ts -3 test-timeout-needs-reason:tests/e2e/headless-serve-mobile-native-chat-identity.spec.ts -3 test-timeout-needs-reason:tests/e2e/paired-browser-creation-reconciliation-failure.spec.ts -3 test-timeout-needs-reason:tests/e2e/paired-remote-html-preview-local-render.spec.ts -3 test-timeout-needs-reason:tests/e2e/paired-remote-terminal-parked-scrollback-survives.spec.ts -3 test-timeout-needs-reason:tests/e2e/relay-region-correction.unit.test.ts -3 test-timeout-needs-reason:tests/e2e/restart-restore-terminal-input.spec.ts -3 test-timeout-needs-reason:tests/e2e/ssh-orcad-legacy-relay-bridge.spec.ts -3 test-timeout-needs-reason:tests/e2e/ssh-orcad-pairing-repair.spec.ts -3 test-timeout-needs-reason:tests/e2e/ssh-orcad-terminal-journeys.spec.ts -3 test-timeout-needs-reason:tests/e2e/terminal-parked-memory.spec.ts -3 test-timeout-needs-reason:tests/e2e/terminal-send-agent-prompt-submit.spec.ts -3 test-timeout-needs-reason:tests/e2e/terminal-tab-close-running-confirm-mouse.spec.ts +1 test-timeout-needs-reason:tests/e2e/worktree-switch-first-paint.spec.ts 3 test-timeout-needs-reason:tests/e2e/wsl-host-fake-transport.spec.ts -38 test-no-wall-clock:src/main/rate-limits/service-refresh-orchestration.test.ts -4 test-no-in-test-import-actual:src/main/bitbucket/credential-store.test.ts -4 test-no-polling-loop:src/main/runtime/rpc/ws-transport.test.ts -4 test-no-polling-loop:tests/e2e/terminal-inline-tui-reveal-convergence.spec.ts -4 test-no-real-time-wait:mobile/src/transport/rpc-client-live-recovery.test.ts -4 test-no-real-time-wait:src/main/browser/cookies/browser-cookie-import-concurrency.test.ts -4 test-no-real-time-wait:src/main/daemon/pty-subprocess/testing/node-pty-windows-input-error.win32.test.ts -4 test-no-real-time-wait:src/main/daemon/sessions/testing/session-shell-recovery.test.ts -4 test-no-real-time-wait:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts -4 test-no-real-time-wait:src/main/orcad/orcad-stop-request-listener.test.ts -4 test-no-real-time-wait:src/main/runtime/agent-session/environment/structured-agent-shell-environment.test.ts -4 test-no-real-time-wait:src/main/runtime/workspaces/removal/worktree-teardown-unstopped-pty.test.ts -4 test-no-real-time-wait:src/main/ssh/connection/ssh-connection-host-key-store-wiring.test.ts -4 test-no-real-time-wait:src/renderer/src/components/activity/activity-auto-mark-read-loop.react185.test.tsx -4 test-no-real-time-wait:src/shared/terminal/pty/ingress/pty-reply-echo-shapes.node-pty.test.ts -4 test-no-real-time-wait:tests/e2e/combined-diff-scroll-restore.spec.ts -4 test-no-real-time-wait:tests/e2e/floating-workspace-reopen-webgl-recovery.spec.ts -4 test-no-real-time-wait:tests/e2e/floating-workspace-shared-glyph-atlas.spec.ts -4 test-no-real-time-wait:tests/e2e/helpers/computer-driver.ts -4 test-no-real-time-wait:tests/e2e/paced-terminal-typing.ts -4 test-no-real-time-wait:tests/e2e/paired-client-hosted-browser-network-outage.spec.ts -4 test-no-real-time-wait:tests/e2e/relaunch-sleeping-agents-resume-on-view.spec.ts -4 test-no-real-time-wait:tests/e2e/terminal-opencode-emoji-table-rendering.spec.ts -4 test-no-real-time-wait:tests/e2e/terminal-pane-close-layout-consistency.spec.ts -4 test-no-real-time-wait:tests/e2e/terminal-parked-memory.spec.ts -4 test-no-real-time-wait:tests/e2e/terminal-tab-switch-visual-restore.spec.ts -4 test-no-real-time-wait:tests/e2e/terminal-warm-reattach-split-live-output.spec.ts -4 test-no-wall-clock:src/cli/runtime/serve-bundle-park.test.ts -4 test-no-wall-clock:src/main/ai-vault/scanners/devin/session-scanner-devin-parser.test.ts -4 test-no-wall-clock:src/main/claude/structured/claude-structured-real-cli-fold.test.ts -4 test-no-wall-clock:src/main/git/gh-rate-limit-breaker.test.ts -4 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-store-gc.test.ts -4 test-no-wall-clock:src/main/managed-server/install/remote-node-runtime-store-lock-host-release.test.ts -4 test-no-wall-clock:src/main/native-chat/agent-session-wire/structured-agent-session-claude-stop-ends-session.test.ts -4 test-no-wall-clock:src/main/orca-profiles/profile-cloud-service-connect-overlap.test.ts -4 test-no-wall-clock:src/main/persistence/profile-state/profile-state-backup-rotation.test.ts -4 test-no-wall-clock:src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts -4 test-no-wall-clock:src/main/rate-limits/service-zcode-usage.test.ts -3 test-no-wall-clock:src/main/runtime/workspaces/process-listing/runtime-worktree-structured-agent-rows-liveness.test.ts -4 test-no-wall-clock:src/main/runtime/terminal/wait/tui-idle-name-only-real-pty.integration.test.ts -4 test-no-wall-clock:src/main/runtime/worker-terminal-archive-release.test.ts -4 test-no-wall-clock:src/main/skills/skill-process-termination.integration.test.ts -4 test-no-wall-clock:src/main/skills/skill-upload-process-restart.integration.test.ts -4 test-no-wall-clock:src/main/sqlite/sync-database.test.ts -4 test-no-wall-clock:src/main/ssh/orcad-exited-own-fence-mutation-race.test.ts -4 test-no-wall-clock:src/main/ssh/ssh-remote-commands.test.ts -4 test-no-wall-clock:src/main/updater/lifecycle/serve-supervisor-install-park.test.ts -4 test-no-wall-clock:src/renderer/src/components/task-page/jira/task-page-jira-cache-selectors.test.ts -4 test-no-wall-clock:tests/e2e/cross-version-wire/release-checkout.unit.test.ts -4 test-timeout-needs-reason:src/main/claude/claude-agent-sdk-exit-proof.test.ts -4 test-timeout-needs-reason:src/main/daemon/pty-subprocess/testing/node-pty-fd-leak.test.ts -4 test-timeout-needs-reason:src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts -4 test-timeout-needs-reason:src/main/managed-server/lifecycle/orcad-managed-tunnel-transport-real-openssh.test.ts -4 test-timeout-needs-reason:src/main/runtime/codex-header-readiness-transcripts.test.ts -4 test-timeout-needs-reason:src/main/runtime/remote-runtime-request-connection.integration.test.ts -4 test-timeout-needs-reason:src/main/wsl/execution/wsl-runner.wsl.test.ts -4 test-timeout-needs-reason:src/packages/process-host/src/run-process.test.ts -4 test-timeout-needs-reason:tests/e2e/cross-version-wire/legacy-relay-bridge.unit.test.ts -4 test-timeout-needs-reason:tests/e2e/helpers/electron-process-shutdown.unit.test.ts -4 test-timeout-needs-reason:tests/e2e/paired-split-pane-browser-placement.spec.ts -4 test-timeout-needs-reason:tests/e2e/sidebar-phone-feed-list.spec.ts -4 test-timeout-needs-reason:tests/e2e/ssh-orcad-idle-exit.spec.ts -4 test-timeout-needs-reason:tests/e2e/ssh-orcad-workspace-tools.spec.ts -43 test-no-wall-clock:src/main/rate-limits/service-account-target-selection.test.ts -46 test-no-wall-clock:src/main/runtime/terminal-query-responder.test.ts -5 test-no-in-test-import-actual:src/main/ssh/config/ssh-config-loader-regression.test.ts -5 test-no-polling-loop:tests/e2e/paced-terminal-typing.ts -5 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-session-adoption.test.ts -5 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter.test.ts -5 test-no-real-time-wait:src/main/ipc/filesystem/local-disk-write-precondition.test.ts -4 test-no-real-time-wait:src/main/ipc/runtime-environments/runtime-environment-request-connections.test.ts -5 test-no-real-time-wait:src/main/managed-server/host-state/orcad-state-mutation-fence-heartbeat.test.ts -5 test-no-real-time-wait:src/main/pty/process-retirement/windows-live-tree-kill.win32.test.ts -5 test-no-real-time-wait:src/shared/fish-query-reply-child-stdin.node-pty.test.ts -5 test-no-real-time-wait:tests/e2e/orchestration-idle-mail-delivery.spec.ts -5 test-no-real-time-wait:tests/e2e/terminal-tui-wheel-reports.spec.ts -5 test-no-wall-clock:src/cli/runtime/serve-pid1-init-reaper.test.ts -5 test-no-wall-clock:src/main/claude/claude-supervised-stop-real-cli.test.ts -5 test-no-wall-clock:src/main/github/pr-refresh-coordinator-completion-order.test.ts -5 test-no-wall-clock:src/main/ipc/worktrees-orphan-directory-cleanup.test.ts -5 test-no-wall-clock:src/main/runtime/orca-runtime-migrated-pane-restore-cwd.test.ts -5 test-no-wall-clock:src/main/runtime/rpc/methods/agent-launch-restart-replay.test.ts -3 test-no-wall-clock:src/renderer/src/components/native-chat/NativeChatResolvedView.turn-status.test.tsx -4 test-no-wall-clock:src/renderer/src/components/sidebar/workspace-card/review/use-workspace-reference-details.test.tsx -4 test-timeout-needs-reason:src/main/agent-hooks/server-transport-interference.test.ts -5 test-timeout-needs-reason:src/main/browser/identity/browser-session-ua-wire-identity.electron.test.ts -5 test-timeout-needs-reason:src/main/claude-usage/scanner-incremental-reader.test.ts -5 test-timeout-needs-reason:src/main/native-chat/agent-session-wire/structured-agent-session-claude-queued-stop.test.ts -5 test-timeout-needs-reason:src/main/pty/process-retirement/node-pty-master-fd-retirement.test.ts -4 test-timeout-needs-reason:src/main/runtime/terminal/wait/tui-idle-hook-lane-runtime.test.ts -5 test-timeout-needs-reason:tests/e2e/browser-agent-input-focus-isolation.spec.ts -5 test-timeout-needs-reason:tests/e2e/persisted-session-production-upgrade.spec.ts -5 test-timeout-needs-reason:tests/e2e/ssh-orcad-auto-convert.spec.ts -6 test-no-in-test-import-actual:src/main/opencode/hook-service-legacy-acl.test.ts -6 test-no-polling-loop:src/main/claude/structured/claude-structured-real-cli.test.ts -6 test-no-real-time-wait:src/main/claude/structured/claude-structured-real-cli.test.ts -6 test-no-real-time-wait:src/main/daemon/providers/adapter/testing/daemon-pty-adapter-history-checkpoints.test.ts -6 test-no-real-time-wait:src/main/daemon/shell-readiness/testing/repro-13767-shell-ready-marker-lost-to-exec.test.ts -6 test-no-real-time-wait:src/main/ipc/worktrees/git/worktree-git-common-polling.test.ts -6 test-no-real-time-wait:src/main/ipc/worktrees/git/worktree-git-common-watch.test.ts -6 test-no-real-time-wait:src/main/opencode/hook-plugin-module-contract.test.ts -6 test-no-real-time-wait:src/main/runtime/rpc/ws-transport.test.ts -6 test-no-real-time-wait:src/main/runtime/rpc/server/runtime-rpc-long-poll-transport.test.ts -2 test-no-real-time-wait:src/main/windows/windows-pty-job.win32.test.ts -4 test-no-real-time-wait:src/renderer/src/components/native-chat/native-chat-composer-draft-store.test.ts -6 test-no-real-time-wait:src/wsl-guest/agent-hook-server.test.ts -6 test-no-real-time-wait:tests/e2e/paired-instant-browser-tab.spec.ts -6 test-no-wall-clock:src/main/agent-hooks/server-launch-resume-identity.test.ts -6 test-no-wall-clock:src/main/agent-hooks/spool.test.ts -6 test-no-wall-clock:src/main/claude/claude-supervised-stop.integration.test.ts -6 test-no-wall-clock:src/main/cli/packaged-cli-assets.test.ts -6 test-no-wall-clock:src/main/codex/app-server/codex-app-server-client.test.ts -6 test-no-wall-clock:src/main/git/runner-gh-rate-limit-breaker.test.ts -6 test-no-wall-clock:src/main/github/pr-refresh-coordinator-active-burst-pacing.test.ts -6 test-no-wall-clock:src/main/github/pr-refresh-queue-growth-bound.test.ts -6 test-no-wall-clock:src/main/orcad/orcad-serve-parity.integration.test.ts -6 test-no-wall-clock:src/main/runtime/rpc/server/runtime-rpc-pairing-mode-persistence.test.ts -6 test-no-wall-clock:src/main/skills/skill-bundle-process-termination.integration.test.ts -6 test-no-wall-clock:src/main/ssh/orcad-exited-own-install-lock.test.ts -6 test-no-wall-clock:src/renderer/src/store/slices/worktrees-metadata-persistence.test.ts -6 test-timeout-needs-reason:src/main/git/refs/maintenance/repo-ref-maintenance-real-git.test.ts -2 test-timeout-needs-reason:src/main/windows/windows-pty-job.win32.test.ts -6 test-timeout-needs-reason:tests/e2e/terminal-column-desync-repro.spec.ts -6 test-timeout-needs-reason:tests/e2e/terminal-inline-tui-reveal-convergence.spec.ts -7 test-no-in-test-import-actual:src/main/browser/cookies/browser-cookie-import.comet.test.ts -7 test-no-real-time-wait:tests/e2e/korean-ime-terminal-shift-enter-commit.spec.ts -7 test-no-wall-clock:src/main/runtime/worker-terminal-wrap-provenance.test.ts -7 test-no-wall-clock:src/main/skills/skill-install-lock.test.ts -7 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.behavior.test.tsx -7 test-no-wall-clock:src/renderer/src/store/slices/jira.test.ts -7 test-no-wall-clock:src/shared/__tests__/process-host/windows-tree-kill-late-taskkill.win32.test.ts -7 test-timeout-needs-reason:mobile/src/tasks/worktree-create-retry.test.ts -8 test-no-in-test-import-actual:src/main/daemon/endpoint/publication/testing/daemon-endpoint-publish.test.ts -8 test-no-real-time-wait:tests/e2e/terminal-column-desync-repro.spec.ts -8 test-no-wall-clock:src/main/ai-vault-search/session-search-indexer.test.ts -8 test-no-wall-clock:src/main/ssh/orcad-exited-own-fence.test.ts -8 test-no-wall-clock:src/renderer/src/components/worktree-jump/WorktreeJumpPalette.recent-tabs.test.tsx -8 test-timeout-needs-reason:src/main/worker-thread-child-process/worker-thread-child-process.test.ts -9 test-no-real-time-wait:tests/e2e/chinese-ime-chat-input-repro.spec.ts -9 test-no-real-time-wait:tests/e2e/terminal-inline-tui-reveal-convergence.spec.ts -9 test-no-wall-clock:src/main/github/pr-refresh-coordinator-active-visible-priority.test.ts -9 test-no-wall-clock:src/main/runtime/session-lifecycle/projection/runtime-mobile-agent-status-builder.test.ts -9 test-no-wall-clock:src/main/runtime/worker-terminal-archive-screen.test.ts -9 test-timeout-needs-reason:tests/e2e/paired-instant-browser-tab.spec.ts diff --git a/config/reliability-gates.jsonc b/config/reliability-gates.jsonc index 0d5e05c6c4f..5d9c16c2bd5 100644 --- a/config/reliability-gates.jsonc +++ b/config/reliability-gates.jsonc @@ -6106,7 +6106,7 @@ "providers": ["local", "remote-runtime", "ssh", "wsl"], "coveredPlatforms": ["macos", "linux"], "coveredProviders": [], - "coverageNotes": "Audit1401 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audit1340 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic protocol, registry, injected-socket, and loopback-listener tests cover strict framing, remote-DNS targets, exact destination-write and source-consumption credit, at most 256 streams per route with pending opens counted inside that cap, 1024 admitted opens per 10-second monotonic window, an 8 MiB per-route application-buffer ledger, shared 32 MiB browser-host and 128 MiB process ledgers across application copies, encrypted client queues, and native WebSocket bufferedAmount, bounded byte/claim/socket-source counts, a four-frame queued-drain quantum, authority epochs, exact host selection, one host per authenticated connection, four hosts per paired device, eight global browser-host polls with four per authenticated paired device, a shared ask/host ceiling that retains one quarter for waits, bounded initial and reconnect runtime_busy recovery, long-poll metering and disconnect abort, monotonic host/page/route generations without page tombstones, two-phase exact page retirement with cancellation, connection-owned cleanup, exact client revocation, stale and replaced fences, retired stream IDs, half-close and close ordering, SOCKS CONNECT, bind/close races, listener wildcard normalization, unsupported commands, unavailable routes, and raw/terminal binary-handler isolation. Page commands use a separately echoed v1 attach negotiation, exact authority/host/page generations, bounded command IDs and sequences, and bounded create/navigate payloads; legacy attaches still receive only the unchanged ready/revoked event shapes. A second optional reconciliation subprotocol gates bounded reclaim, close, and restore payloads behind exact attach/ready echo, complete inventory, command negotiation, reconnect authority, and command-result authority; the production client advertises it only with the matching command and inventory capabilities. Exact guest or app-renderer loss marks one page generation outcome-unknown, coalesces a bounded negotiated inventory reattach, closes or retires the dead generation, and allocates a fresh generation before URL restore; explicit close is not misclassified as a crash. Mixed-version mutation tests project hidden client pages before activate, close, split, reorder, and move-to-group admission, preserve hidden raw order slots, translate visible insertion indices, and project mutation snapshots. A production server orchestrator consumes each immutable inventory once, reserves target generations without exposing placement, emits only negotiated ledger commands, commits after exact completed proof, preserves unrelated and server placements, aborts an attempt when connection authority enters reconnect grace, and requires fresh inventory after failure or abort. The production client dispatcher additionally proves per-page FIFO execution, exact payload-matched duplicate replay, frozen command/result snapshots, a global retired-generation floor, transactional admission, bounded pages/active commands/queues/per-page and global result cache/concurrency, create dependency failure, cancellation, deduplicated retirement joining, and bounded close without late-result overwrite. The server ledger owns issue order and immutable command/result snapshots, bounds outstanding commands, active pages, and per-page/global replay caches, releases active-page capacity after an exact completed close while retaining bounded result replay, validates the shared wire payload before admission, requires live delivery and exact placement, authenticates results to the negotiated connection and paired lease, rejects gaps and conflicting replay, and fences outstanding outcomes at exact retirement. Negotiated command results reuse the authenticated attach socket through bounded nested JSON requests; exact ID routing, reverse-order replies, unknown and duplicate IDs, timeout teardown, serialization failure, aggregate queue accounting, acknowledgement validation, and the unchanged non-v1 path are deterministic. A stable local listener rejects CONNECT while offline or reconnecting, retains its address across replacement, requires a strictly increasing tunnel generation, ignores late superseded callbacks, propagates tunnel protocol failure to the route owner, and recycles exhausted stream IDs only after generation replacement. Reconnect uses the unchanged native v1 attach payload and capability pair; SSH descriptors alone add an execution-host capability and require a runtime-minted grant bound to the exact browser-host lease. Exact SSH provider epoch and connection generation fence ssh2 forwardOut and one non-interactive standalone system-SSH dynamic forward per route. Unit tests preserve domain-form SOCKS requests, sanitize remote errors, bound stderr, cancel startup, release timed-out and synchronously failed sockets, and release routes once. An ephemeral Docker sshd resolves a container-only domain and returns a unique HTTP marker through both ssh2 and the actual system-OpenSSH dynamic-forward adapter without touching the user's SSH files; authority loss fences the ssh2 route. The execution runtime charges route application bytes to the same per-host/process policy; its existing E2EE owner separately caps native outbound buffers process-wide. Production-registered browser-host and paired-runtime methods lease one exact host, prove attach, command delivery, and result settlement share one exact connection identity, then carry SOCKS and HTTP bytes over a dedicated E2EE socket to the fenced execution-host revision and prove route close destroys the destination socket. The production desktop adapter now composes one exact host per environment pairing revision with the page executor, current renderer selector, route Session/WebContents registries, and one reference-counted route per canonical execution-host key. Negotiated same-client control reconnect retains exact authority, placements, grants, dispatcher dedupe, executor guests, and listener addresses; it fences tunnels immediately, blocks route admission, reattaches command delivery only after ready, and replays unsettled commands without repeating completed mutations. Terminal release, replacement, legacy disconnect, and reconnect-grace expiry make only the exact host generation's client placements non-cancellable retirement-pending while retaining capacity until exact cleanup; reconnect grace preserves them. Environment replacement and app shutdown still serialize transport closure before page cleanup and force-close every remaining route. The production placement preparation starts the exact desktop adapter and advertises host/tunnel capabilities only when the paired Electron client is eligible. Node stream-internal high-water bytes, strict cross-route scheduling, and physical cross-platform evidence remain uncovered. The two Docker remote-only SSH browser routing journeys now run in the dedicated Linux ssh-browser-network-route CI job on full runs and their mapped source/test changes; 2 baseline and 6 repeated cases passed with no skips/retries on 2026-09-06. The removed retry-arithmetic and attach-request inventory suites are not current coverage; retained lease and composition suites exercise admission retry, cleanup, inventory negotiation, and reconnect behavior. Test-value audit1293 removes src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts (4 authored cases). Their isolated assertions no longer run; surviving tests are not claimed as equivalent coverage. Fresh execution against the candidate SHA is required. Audit1302: src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts: Every route/guest lifecycle/currentness/navigation/renderer/automation authority is supplied by fake callbacks, then unavailability listener is invoked manually and private inventory/mock calls are checked. No guest destruction, renderer disconnect or actual reconciliation/close consumer. Lose generation fence/reconcile-once/missing-renderer-close branch alarms; no equivalent replacement. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1318: src/shared/remote-runtime/requests/remote-runtime-subscription-request.test.ts: Retain actual local encrypted WebSocket subscription concurrency routing when host replies out of order, plus an exception thrown by a real ws consumer callback being turned into a subscription error. Server is a test-shaped handshake/response producer using production crypto, not actual runtime host/auth authority or independent cryptographic oracle. Remove happy second-request duplicate, unknown/duplicate-ID branches, fixed32 capacity, serialization/capacity/timeouts and fake memory release/admission call-count scenarios; intentionally lose those alarms. Reduced selectors need fresh validation; historical full-suite receipts do not validate the changed coverage. No equivalent replacement or physical-provider claim. Audit1340: src/main/runtime/runtime-binary-message-router.test.ts removed. Connection mode conflict exceptions and one terminal/raw callback each. No equivalent replacement coverage is claimed. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1371 removes the reconciliation protocol/capability echo inventory from browser-client-host-reconciliation.test.ts. The pending command result refusal without exact authority and later accepted acknowledgement callback remains byte-identical. The narrow negotiation echo alarm is intentionally lost; no equivalent browser/authenticated transport proof is claimed. Existing receipts with unchanged selectors retain only their original scope. Audit1401: src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts reduced. Loses deterministic equal-length URL compaction tie-breaking and reversed-input invariance alarm. No equivalent replacement coverage is claimed.", + "coverageNotes": "Audit1559 removes mocked host/lease/reconciliation, event/flag/counter, forwarding, inventory and retry-budget alarms without equivalent replacement coverage. Retained cases establish owned promise, registry, rollback, admission and cleanup boundaries with injected Electron/renderer/host inputs; actual local sockets, file staging and Buffer collection are scoped in the PR. Receipts selecting modified tests are retired; unaffected exact-selector receipts remain historical evidence only. No live paired runtime, rendered browser/profile/TLS or device claim. Historical scope before this audit: Audit1401 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Audit1340 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic protocol, registry, injected-socket, and loopback-listener tests cover strict framing, remote-DNS targets, exact destination-write and source-consumption credit, at most 256 streams per route with pending opens counted inside that cap, 1024 admitted opens per 10-second monotonic window, an 8 MiB per-route application-buffer ledger, shared 32 MiB browser-host and 128 MiB process ledgers across application copies, encrypted client queues, and native WebSocket bufferedAmount, bounded byte/claim/socket-source counts, a four-frame queued-drain quantum, authority epochs, exact host selection, one host per authenticated connection, four hosts per paired device, eight global browser-host polls with four per authenticated paired device, a shared ask/host ceiling that retains one quarter for waits, bounded initial and reconnect runtime_busy recovery, long-poll metering and disconnect abort, monotonic host/page/route generations without page tombstones, two-phase exact page retirement with cancellation, connection-owned cleanup, exact client revocation, stale and replaced fences, retired stream IDs, half-close and close ordering, SOCKS CONNECT, bind/close races, listener wildcard normalization, unsupported commands, unavailable routes, and raw/terminal binary-handler isolation. Page commands use a separately echoed v1 attach negotiation, exact authority/host/page generations, bounded command IDs and sequences, and bounded create/navigate payloads; legacy attaches still receive only the unchanged ready/revoked event shapes. A second optional reconciliation subprotocol gates bounded reclaim, close, and restore payloads behind exact attach/ready echo, complete inventory, command negotiation, reconnect authority, and command-result authority; the production client advertises it only with the matching command and inventory capabilities. Exact guest or app-renderer loss marks one page generation outcome-unknown, coalesces a bounded negotiated inventory reattach, closes or retires the dead generation, and allocates a fresh generation before URL restore; explicit close is not misclassified as a crash. Mixed-version mutation tests project hidden client pages before activate, close, split, reorder, and move-to-group admission, preserve hidden raw order slots, translate visible insertion indices, and project mutation snapshots. A production server orchestrator consumes each immutable inventory once, reserves target generations without exposing placement, emits only negotiated ledger commands, commits after exact completed proof, preserves unrelated and server placements, aborts an attempt when connection authority enters reconnect grace, and requires fresh inventory after failure or abort. The production client dispatcher additionally proves per-page FIFO execution, exact payload-matched duplicate replay, frozen command/result snapshots, a global retired-generation floor, transactional admission, bounded pages/active commands/queues/per-page and global result cache/concurrency, create dependency failure, cancellation, deduplicated retirement joining, and bounded close without late-result overwrite. The server ledger owns issue order and immutable command/result snapshots, bounds outstanding commands, active pages, and per-page/global replay caches, releases active-page capacity after an exact completed close while retaining bounded result replay, validates the shared wire payload before admission, requires live delivery and exact placement, authenticates results to the negotiated connection and paired lease, rejects gaps and conflicting replay, and fences outstanding outcomes at exact retirement. Negotiated command results reuse the authenticated attach socket through bounded nested JSON requests; exact ID routing, reverse-order replies, unknown and duplicate IDs, timeout teardown, serialization failure, aggregate queue accounting, acknowledgement validation, and the unchanged non-v1 path are deterministic. A stable local listener rejects CONNECT while offline or reconnecting, retains its address across replacement, requires a strictly increasing tunnel generation, ignores late superseded callbacks, propagates tunnel protocol failure to the route owner, and recycles exhausted stream IDs only after generation replacement. Reconnect uses the unchanged native v1 attach payload and capability pair; SSH descriptors alone add an execution-host capability and require a runtime-minted grant bound to the exact browser-host lease. Exact SSH provider epoch and connection generation fence ssh2 forwardOut and one non-interactive standalone system-SSH dynamic forward per route. Unit tests preserve domain-form SOCKS requests, sanitize remote errors, bound stderr, cancel startup, release timed-out and synchronously failed sockets, and release routes once. An ephemeral Docker sshd resolves a container-only domain and returns a unique HTTP marker through both ssh2 and the actual system-OpenSSH dynamic-forward adapter without touching the user's SSH files; authority loss fences the ssh2 route. The execution runtime charges route application bytes to the same per-host/process policy; its existing E2EE owner separately caps native outbound buffers process-wide. Production-registered browser-host and paired-runtime methods lease one exact host, prove attach, command delivery, and result settlement share one exact connection identity, then carry SOCKS and HTTP bytes over a dedicated E2EE socket to the fenced execution-host revision and prove route close destroys the destination socket. The production desktop adapter now composes one exact host per environment pairing revision with the page executor, current renderer selector, route Session/WebContents registries, and one reference-counted route per canonical execution-host key. Negotiated same-client control reconnect retains exact authority, placements, grants, dispatcher dedupe, executor guests, and listener addresses; it fences tunnels immediately, blocks route admission, reattaches command delivery only after ready, and replays unsettled commands without repeating completed mutations. Terminal release, replacement, legacy disconnect, and reconnect-grace expiry make only the exact host generation's client placements non-cancellable retirement-pending while retaining capacity until exact cleanup; reconnect grace preserves them. Environment replacement and app shutdown still serialize transport closure before page cleanup and force-close every remaining route. The production placement preparation starts the exact desktop adapter and advertises host/tunnel capabilities only when the paired Electron client is eligible. Node stream-internal high-water bytes, strict cross-route scheduling, and physical cross-platform evidence remain uncovered. The two Docker remote-only SSH browser routing journeys now run in the dedicated Linux ssh-browser-network-route CI job on full runs and their mapped source/test changes; 2 baseline and 6 repeated cases passed with no skips/retries on 2026-09-06. The removed retry-arithmetic and attach-request inventory suites are not current coverage; retained lease and composition suites exercise admission retry, cleanup, inventory negotiation, and reconnect behavior. Test-value audit1293 removes src/main/browser/network/tunnels/browser-network-tunnel-client-memory-budget.test.ts (4 authored cases). Their isolated assertions no longer run; surviving tests are not claimed as equivalent coverage. Fresh execution against the candidate SHA is required. Audit1302: src/main/browser/client-pages/lifecycle/browser-client-page-unavailability.test.ts: Every route/guest lifecycle/currentness/navigation/renderer/automation authority is supplied by fake callbacks, then unavailability listener is invoked manually and private inventory/mock calls are checked. No guest destruction, renderer disconnect or actual reconciliation/close consumer. Lose generation fence/reconcile-once/missing-renderer-close branch alarms; no equivalent replacement. Reduced selectors require fresh validation; prior full-suite receipts do not validate removed or changed coverage. No equivalent replacement or physical-provider claim. Audit1318: src/shared/remote-runtime/requests/remote-runtime-subscription-request.test.ts: Retain actual local encrypted WebSocket subscription concurrency routing when host replies out of order, plus an exception thrown by a real ws consumer callback being turned into a subscription error. Server is a test-shaped handshake/response producer using production crypto, not actual runtime host/auth authority or independent cryptographic oracle. Remove happy second-request duplicate, unknown/duplicate-ID branches, fixed32 capacity, serialization/capacity/timeouts and fake memory release/admission call-count scenarios; intentionally lose those alarms. Reduced selectors need fresh validation; historical full-suite receipts do not validate the changed coverage. No equivalent replacement or physical-provider claim. Audit1340: src/main/runtime/runtime-binary-message-router.test.ts removed. Connection mode conflict exceptions and one terminal/raw callback each. No equivalent replacement coverage is claimed. Audit1352: focused Linux unit selections validated on source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1360: focused Linux unit selections validated on source head 415c9cffc2d10024131ec4b6721767a22195de6d. Historical statements above retain their original scope. Intentional test losses are recorded in knownGaps; these runs claim no physical-provider, p95, rendered E2E or cross-platform validation. Audit1371 removes the reconciliation protocol/capability echo inventory from browser-client-host-reconciliation.test.ts. The pending command result refusal without exact authority and later accepted acknowledgement callback remains byte-identical. The narrow negotiation echo alarm is intentionally lost; no equivalent browser/authenticated transport proof is claimed. Existing receipts with unchanged selectors retain only their original scope. Audit1401: src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts reduced. Loses deterministic equal-length URL compaction tie-breaking and reversed-input invariance alarm. No equivalent replacement coverage is claimed.", "motivatingLinks": [ "https://linear.app/stably/issue/STA-4150/refactor-remote-browser-to-client-hosted-electron-webviews" ], @@ -6118,9 +6118,9 @@ "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/leases/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-retirement.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-placement-replacement.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-placement.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/reconciliation/browser-host-page-reconciliation-plan.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-reconciliation-executor.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/reconciliation/browser-host-page-reconciliation-orchestration.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-placement.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-reconciliation-protocol.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts src/main/runtime/rpc/methods/browser-client-host-reconciliation.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-reconciliation-plan.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-reconciliation-protocol.test.ts src/main/runtime/rpc/methods/browser-client-host-reconciliation.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/lifecycle/browser-client-page-inventory.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-reconciliation-plan.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-network-tunnel-protocol.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session.test.ts src/main/browser/network/tunnels/remote-browser-socks-server.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/tunnels/browser-network-tunnel-client.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/runtime/browser/network/browser-network-tunnel-paired-runtime.integration.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/tunnels/browser-network-tunnel-outbound-memory-budget.test.ts src/main/browser/network/tunnels/browser-network-tunnel-session-aggregate-memory.test.ts src/shared/ws-outbound-backpressure-queue.test.ts src/shared/remote-runtime/remote-runtime-client.test.ts", @@ -6129,12 +6129,12 @@ "pnpm exec vitest run --config config/vitest.config.ts src/shared/remote-runtime/remote-runtime-client.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/shared/remote-runtime/requests/remote-runtime-subscription-request.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", + "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/ipc/runtime-environments/runtime-environments-subscription-teardown.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/browser/network/execution-routes/browser-network-deferred-socket.test.ts src/main/browser/network/execution-routes/browser-network-execution-route.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/rpc/methods/browser-network-tunnel.test.ts src/main/browser/network/execution-routes/ssh-browser-network-execution-route.test.ts src/main/browser/network/tunnels/system-ssh-socks-client-socket.test.ts src/main/ssh/system-transport/system-ssh-dynamic-forward-process.test.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/ssh/system-transport/system-ssh-forward-process.test.ts src/main/ssh/system-transport/system-ssh-operations.test.ts src/main/ssh/port-forwarding/ssh-port-forward.test.ts", @@ -6163,14 +6163,10 @@ "src/main/runtime/rpc/methods/browser-client-host.test.ts", "src/main/runtime/rpc/methods/browser-client-host-reconciliation.test.ts", "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts", - "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", - "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts", - "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts", "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts", "src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts", "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts", "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts", - "src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts", "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts", "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", @@ -6303,53 +6299,7 @@ }, { "file": "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts", - "assertions": [ - "a client requests commands only with a delivery handler and accepts them only after an exact v1 echo", - "an old host that omits the echo cannot deliver a command", - "one complete inventory snapshot is sampled before attach, a missing echo stays unsupported, and an unsolicited echo closes the lease", - "stale authority commands close the exact lease before handler delivery", - "completed and failed results submit exact command authority on the established subscription", - "missing result transport, handler failure, server rejection, and malformed or wrong-runtime acknowledgement close the lease", - "exact duplicate result acknowledgement remains idempotent", - "result settlement concurrency stays below nested-request capacity and excess unsettled results fail closed" - ] - }, - { - "file": "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", - "assertions": [ - "initial runtime_busy admission retries on bounded deterministic jitter and attaches when capacity returns", - "initial admission expiry and explicit close release every timer and subscription", - "runtime_busy during negotiated reconnect remains inside the existing grace without replacing authority", - "only an echoed reconnect v1 plus complete inventory preserves exact authority after recoverable transport loss", - "duplicate and stale transport callbacks cannot start extra attempts or fence the current subscription", - "repeated reconnects retain bounded timers and subscriptions while authority changes and explicit revocation fail terminally", - "missing echo preserves legacy teardown and grace expiry closes every retained attempt exactly once", - "malformed and unsolicited reconnect echoes fail closed", - "outstanding command replay reuses exact active result admissions without double-charging settlement capacity", - "an unencodable reconnect inventory cannot silently replace exact authority or fall back to legacy" - ] - }, - { - "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts", - "assertions": [ - "the optional reconciliation request is retained only after exact ready echo", - "an older host can omit the echo without enabling reconciliation", - "unsolicited and dependency-inconsistent echoes fail closed", - "exact reconnect rejects reconciliation downgrade" - ] - }, - { - "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts", - "assertions": [ - "reconciliation is advertised only when the composed host explicitly enables it beside complete inventory", - "exact dispatcher authority exists before the first same-socket command can arrive", - "explicit close shuts transport before aborting every owned page handler", - "dispatcher abort still runs when lease cleanup rejects", - "lease transport failure aborts every owned handler and reports one terminal error", - "retirement and forgetting accept only the exact owned page generation", - "timed-out retirement stays fenced until the exact late handler settles", - "bounded host close exposes exact eventual settlement for deferred page cleanup" - ] + "assertions": ["closes a subscription acquired after local teardown"] }, { "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts", @@ -6360,48 +6310,14 @@ { "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts", "assertions": [ - "exact route authority activates before the first page command", - "each initial or reconnect attach samples a fresh exact executor inventory while the compatibility gate binds to the latest published snapshot", - "control loss suspends routes without closing pages and command admission waits for exact route recovery", - "one command gate spans repeated loss while stale route recoveries cannot close the replacement", - "page retirement settles dispatcher ownership before guest cleanup and ledger forget", - "terminal close suspends routes and fences every navigation grant before control cleanup can await handlers", - "shutdown closes control transport before executor pages and every retained route", - "non-settling handlers remove network reach immediately and defer page cleanup until exact late settlement", - "deferred executor cleanup failures remain fenced and emit an observable composition error", - "same-pairing runtime replacement retires old routes, fences guest navigation, waits for old handlers, and activates retained inventory only after exact reconciliation echo", - "a legacy replacement remains available for empty inventory but cannot activate routes for unreconciled retained pages", - "retired-route cleanup failure closes the composition before replacement authority can activate", - "late callbacks from a replaced host generation cannot suspend or close its replacement", - "cleanly absent failed creates are forgotten while unresolved cleanup remains fenced" - ] - }, - { - "file": "src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts", - "assertions": [ - "reclaim, restore, and close are valid first commands only after exact reconciliation negotiation", - "reclaim and restore failure cancels later navigation without running it", - "nested prior authority is immutable and exact duplicate matching rejects mutation on both ledgers", - "successful close is terminal while failed close releases the fence and successful reclaim can continue with navigation" + "waits for old handlers and ignores their late callbacks before replacement", + "keeps one command gate across repeated loss while fencing stale route recovery", + "fails closed without racing page cleanup when handlers do not settle" ] }, { "file": "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", - "assertions": [ - "in-flight create, ambiguous cleanup, and stale renderer authority snapshot as outcome unknown", - "a destroyed exact guest snapshots as outcome unknown before executor retirement", - "create-to-active transition emits one exact page record without duplicate identity", - "successful normalized navigation updates the immutable current URL snapshot unless normalization exceeds the URL field bound", - "legacy-valid command identities remain executable even when optional inventory cannot encode them", - "executor capacity cannot exceed the shared 256-page attach limit", - "failed retirement leaves immutable outcome-unknown inventory without a retryable live-page handle", - "authority transition retains page inventory while fencing old navigation and uses the replacement connection identity for future pages", - "in-flight old-authority creation rechecks transition state and releases its route without committing a page", - "transition revocation failure keeps later commands fenced while exact cleanup still completes", - "ordinary navigation requires the page inventory to match the exact command authority", - "terminal navigation fencing revokes retained grants once and blocks late in-flight creation without inferring destruction", - "revocation failure remains observable while exact guest, renderer, Session, and route cleanup still run" - ] + "assertions": ["holds Session and route release for the exact destroyed acknowledgement"] }, { "file": "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", @@ -6428,16 +6344,7 @@ }, { "file": "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts", - "assertions": [ - "one environment pairing revision shares one host composition", - "a same-pairing runtime change preserves that composition and delegates exact authority replacement", - "a failed authority replacement retains a cleanup tombstone and cannot expose a half-active successor", - "a changed pairing revision closes before its replacement starts", - "unsettled host cleanup retains a bounded tombstone, blocks replacement, and releases only when deferred cleanup proves completion", - "unresolved deferred cleanup remains fail-closed until authenticated reconciliation or process restart", - "environment retirement permits a later exact restart", - "app shutdown permanently fences new host admission before closing every environment" - ] + "assertions": ["keeps a failed authority transition tombstoned until cleanup settles"] }, { "file": "src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts", @@ -6457,16 +6364,8 @@ { "file": "src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", "assertions": [ - "commands execute FIFO per page while only exact payload-matched duplicates replay without rerunning side effects", - "authority, sequence, generation, and create dependencies fence stale or ambiguous commands", - "failed admission consumes no page authority and every resource class stays bounded", - "retirement and close cancel immediately but retain a fence until non-cooperative handlers settle", - "bounded close exposes one exact eventual-settlement barrier after late handlers finish", - "a handler cannot reenter retirement before its bounded join is installed", - "an abort listener cannot reenter before the shared retirement operation is published", - "retiring a queued generation removes its stale scheduler entry before replacement", - "forgotten pages retain a global stale-generation floor and cached results have a global ceiling", - "lease authority and command identity are immutable snapshots while replacement releases retired cache" + "keeps a timed-out retirement fenced until its handler actually settles", + "bounds close while canceling queued and non-cooperative handlers" ] }, { @@ -6683,16 +6582,6 @@ } ], "evidenceRuns": [ - { - "date": "2026-08-15", - "runner": "local", - "platform": "macos", - "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-host-attach-request.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/browser-host-lease-reconnect-delay.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "result": "passed", - "durationSeconds": 3.61, - "summary": "On the #14753 tip, sixteen files passed 167 exact terminal navigation/route fencing, retained reconnect grace, placement retirement, attach, command, result, route recovery, admission, and mixed-version protocol assertions. The new composition oracle was 1 failed / 10 passed before implementation because terminal host loss started asynchronous close without first suspending routes or revoking navigation." - }, { "date": "2026-08-15", "runner": "local", @@ -6703,56 +6592,6 @@ "summary": "On origin/main@5b7f44278a, the new oracle was 6 failed / 1 passed before implementation because terminal host fencing left exact placements cancellable; the candidate passed 44/44 terminal release, replacement, legacy disconnect, grace expiry, reconnect preservation, exact-generation isolation, capacity retention, and two-phase settlement assertions.", "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/browser-host/leases/browser-host-lease-placement-retirement.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-retirement.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-placement-replacement.test.ts src/main/runtime/browser-host/reconciliation/browser-host-page-placement.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts" }, - { - "date": "2026-08-15", - "runner": "local", - "platform": "macos", - "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts", - "result": "passed", - "durationSeconds": 7.89, - "summary": "On origin/main@5b7f44278a, two files passed 16 authenticated per-device/global browser-host admission, shared wait reservation, exact socket-counter release, bounded initial runtime_busy retry, explicit-close cleanup, and reconnect-grace authority-preservation tests." - }, - { - "date": "2026-08-15", - "runner": "local", - "platform": "macos", - "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-host-attach-request.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/browser-host-lease-reconnect-delay.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/server/runtime-rpc-browser-host-admission.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "result": "passed", - "durationSeconds": 7.18, - "summary": "On origin/main@5b7f44278a, fifteen files passed 159 mixed-version attach, exact authority, bounded admission and recovery, reconnect, route suspension, page-command replay, result-ledger, and authenticated lease tests." - }, - { - "date": "2026-08-14", - "runner": "local", - "platform": "macos", - "command": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser-client-host-protocol.test.ts src/main/browser/browser-client-host-attach-request.test.ts src/main/browser/browser-client-network-route-registry.test.ts src/main/browser/paired-runtime-browser-client-host-composition.test.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/browser-host-lease-reconnect-delay.test.ts src/main/browser/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/browser-host-command-ledger.test.ts src/main/runtime/browser-host/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/shared/browser/client-hosting/browser-client-host-protocol.test.ts src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger.test.ts src/main/runtime/browser-host/commands/browser-host-command-ledger-capacity.test.ts src/main/runtime/browser-host/leases/browser-host-lease-registry.test.ts src/main/runtime/rpc/methods/browser-client-host.test.ts", - "result": "passed", - "durationSeconds": 2.23, - "summary": "Fourteen files passed 150 negotiated same-client reconnect, legacy skew, active takeover, exact authority, immediate route suspension, independently bounded route retry, stable fail-closed SOCKS, ready-before-replay, completed-mutation dedupe, partial-replay delivery recovery, repeated-loss, stale-callback, explicit-revocation, grace cleanup, and deterministic jittered-backoff tests." - }, - { - "date": "2026-08-14", - "runner": "local", - "platform": "macos", - "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/paired-runtime-browser-client-host.test.ts src/main/browser/paired-runtime-browser-host-lease.test.ts src/main/browser/browser-client-host-command-dispatcher.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", - "result": "passed", - "durationSeconds": 0.8, - "summary": "Fifty tests passed synchronous authority activation, hard 16/256 result bounds, exact transport-close-before-handler-abort ordering, cleanup rejection with guaranteed abort, same-socket result settlement, exact page retirement and forgetting, and late non-cooperative retirement settlement. The broader runtime/browser/shared run passed 9,711 tests with 24 existing skips." - }, - { - "date": "2026-08-14", - "runner": "local", - "platform": "macos", - "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-host-command-dispatcher.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts", - "result": "passed", - "durationSeconds": 0.2, - "summary": "Sixteen tests passed immutable lease/command/result snapshots, exact-authority FIFO dispatch, payload-matched duplicate replay, transactional bounded admission, create dependency failure, stale and forgotten-generation fencing, scheduler replacement, retired-cache release, per-page and global cached-result expiry, pre-abort shared retirement publication, deduplicated/reentrant joining, cancellation, and bounded close." - }, { "date": "2026-08-14", "runner": "local", @@ -6811,16 +6650,6 @@ "durationSeconds": 5.58, "summary": "Test Files 4 passed (4); Tests 44 passed (44). Deterministic fixtures; no physical phone or deployed mixed-host claim." }, - { - "date": "2026-11-04", - "runner": "local", - "platform": "linux", - "result": "passed", - "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm --config.verifyDepsBeforeRun=false test src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts src/main/runtime/runtime-browser-client-page-recovery.test.ts --maxWorkers=2", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/runtime/browser/client-pages/runtime-browser-client-page-recovery.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts", - "durationSeconds": 4.66, - "summary": "Test Files 6 passed (6); Tests 91 passed (91). Focused Linux unit execution; no physical-provider, p95 or cross-platform claim. Source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e." - }, { "date": "2026-11-04", "runner": "local", @@ -6831,16 +6660,6 @@ "durationSeconds": 9.31, "summary": "Test Files 4 passed (4); Tests 50 passed (50). Focused Linux unit execution; no physical-provider, p95 or cross-platform claim. Source head b638e07d395b76af3ba6b03761a1a0fe7e5e026e." }, - { - "date": "2026-11-04", - "runner": "local", - "platform": "linux", - "result": "passed", - "command": "ORCA_BACKGROUND_LAUNCH=1 pnpm --config.verifyDepsBeforeRun=false test src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts src/main/runtime/runtime-browser-client-page-recovery.test.ts --maxWorkers=2", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts src/main/runtime/browser/client-pages/runtime-browser-client-page-recovery.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-mutations.test.ts src/main/runtime/rpc/methods/session-tab-browser-placement-projection.test.ts", - "durationSeconds": 5.12, - "summary": "Test Files 6 passed (6); Tests 91 passed (91). Focused Linux unit execution; no physical-provider, p95 or cross-platform claim. Source head 415c9cffc2d10024131ec4b6721767a22195de6d." - }, { "date": "2026-11-04", "runner": "local", @@ -6877,6 +6696,7 @@ "Prove an Electron partition routes loopback, DNS, HTTP, HTTPS, WebSocket, workers, and speculative traffic without desktop fallback." ], "knownGaps": [ + "Audit1559 removes mocked host/lease/reconciliation, event/flag/counter, forwarding, inventory and retry-budget alarms without equivalent replacement coverage. Retained cases establish owned promise, registry, rollback, admission and cleanup boundaries with injected Electron/renderer/host inputs; actual local sockets, file staging and Buffer collection are scoped in the PR. Receipts selecting modified tests are retired; unaffected exact-selector receipts remain historical evidence only. No live paired runtime, rendered browser/profile/TLS or device claim.", "The mock-only browser-session startup suite was removed, dropping its once-per-module and retry-after-initialization-throw call-count alarms.", "Eligible paired Electron clients advertise the runtime capabilities, use the production paired-tunnel method, and select the prepared route partition; older and ineligible clients do not.", "The two-phase token-safe page-retirement API has no production lifecycle caller until client placement activates.", @@ -6990,7 +6810,7 @@ "id": "browser-client-host.webcontents-quarantine", "title": "Route guests stay blank and popup-denied until exact registration", "maturity": "experimental", - "protection": "partial", + "protection": "none", "owner": "browser-runtime", "layer": "electron-main-webcontents-authority", "surfaces": [ @@ -7004,158 +6824,18 @@ ], "platforms": ["macos", "linux", "windows"], "providers": ["remote-runtime", "ssh", "wsl"], - "coveredPlatforms": ["macos", "linux"], + "coveredPlatforms": [], "coveredProviders": [], - "coverageNotes": "Audit1363 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic main-process fakes cover route-Session recognition after logical release, prepared-page renderer ownership, stale and live waiters sharing pending partition setup, generic-policy-before-route-lockdown ordering, blank quarantine, exact guest/renderer/partition/logical-page registration, opaque page-authority replacement, a separate navigation grant, repeated navigation, invalid-scheme denial, dynamic page-authority revocation, popup denial, delayed/failed admission closure, exact page-release closure, retirement-start and destroyed-inspection failure, shared-partition retirement ordering, policy retention until every destroyed acknowledgement, guest process loss/destruction, opaque lifecycle claims across spontaneous destruction and WebContents ID reuse, owning-renderer process loss before, during, and after registration, mutable input isolation, page conflicts, and token-safe destroyed cleanup. The production page-command executor additionally retains an exact execution-host route, prepares its immutable partition, mounts one trusted renderer generation blank, registers and grants its exact guest, loads only normalized HTTP(S), and attempts every safe generation-scoped cleanup after failure, abort, or retirement while holding network resources without destruction proof. A production main-process bridge binds mount and retirement requests to the exact current renderer object and document generation, rejects sender spoofing and WebContents-ID reuse, carries no target URL, bounds pending requests, aborts, timeouts, malformed replies, and lifecycle replacement, and restores only an exact surviving renderer document after blocked or failed provisional navigation. The top-frame preload now queues and validates bounded requests before one replaceable subscriber, while a document-owned renderer registry mounts only blank route webviews, bounds global and per-partition guests, and fences attachment, retirement, destruction, and renderer loss by the full page tuple. Real Electron 43.1.0 proves exact main-frame reply admission, delayed guest-ID readiness, blank attachment, host ownership, destruction, and fail-closed denied attachment. Normal browser Sessions and paired web clients bypass the renderer registry. Production host composition and client placement activate the executor only after capability-gated placement preparation. Process/document swaps, worker/request/download settlement, traffic containment, and provider journeys remain uncovered. Audit1363: src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts removed. Missing preload/web-client flags, mount/rekey/retire forwarding and failure-code projection. No equivalent replacement coverage is claimed. Audit1365: focused Linux unit selection passed on source head 8880357cb420c45f1b808ae545a5bc609324624d. This new result has its own exact command; historical results keep their prior scope. Intentional test losses remain recorded in knownGaps. No physical-provider, native input, rendered E2E, p95, soak or replacement-coverage claim. Audit1421 reduces browser-client-page-retained-registry.test.ts to its attached-generation destruction fence and wrong-generation retirement case. Blank mount, budgets, rekey, guest-ID readiness, process-loss, denied-attachment timeout and absent-page retirement unit alarms are lost. Synthetic webview events do not establish native Electron lifecycle delivery. No equivalent replacement coverage is claimed. Historical receipts remain scoped to unchanged selectors; this reduced suite has no new execution result.", + "coverageNotes": "Audit1559 removes mocked host/lease/reconciliation, event/flag/counter, forwarding, inventory and retry-budget alarms without equivalent replacement coverage. Retained cases establish owned promise, registry, rollback, admission and cleanup boundaries with injected Electron/renderer/host inputs; actual local sockets, file staging and Buffer collection are scoped in the PR. Receipts selecting modified tests are retired; unaffected exact-selector receipts remain historical evidence only. No live paired runtime, rendered browser/profile/TLS or device claim. Historical scope before this audit: Audit1363 changes referenced sources. Retained unchanged-source receipts apply only to their unchanged commands; the reduced selectors have no new execution result. Historical coverage account (not a current claim for changed sources): Deterministic main-process fakes cover route-Session recognition after logical release, prepared-page renderer ownership, stale and live waiters sharing pending partition setup, generic-policy-before-route-lockdown ordering, blank quarantine, exact guest/renderer/partition/logical-page registration, opaque page-authority replacement, a separate navigation grant, repeated navigation, invalid-scheme denial, dynamic page-authority revocation, popup denial, delayed/failed admission closure, exact page-release closure, retirement-start and destroyed-inspection failure, shared-partition retirement ordering, policy retention until every destroyed acknowledgement, guest process loss/destruction, opaque lifecycle claims across spontaneous destruction and WebContents ID reuse, owning-renderer process loss before, during, and after registration, mutable input isolation, page conflicts, and token-safe destroyed cleanup. The production page-command executor additionally retains an exact execution-host route, prepares its immutable partition, mounts one trusted renderer generation blank, registers and grants its exact guest, loads only normalized HTTP(S), and attempts every safe generation-scoped cleanup after failure, abort, or retirement while holding network resources without destruction proof. A production main-process bridge binds mount and retirement requests to the exact current renderer object and document generation, rejects sender spoofing and WebContents-ID reuse, carries no target URL, bounds pending requests, aborts, timeouts, malformed replies, and lifecycle replacement, and restores only an exact surviving renderer document after blocked or failed provisional navigation. The top-frame preload now queues and validates bounded requests before one replaceable subscriber, while a document-owned renderer registry mounts only blank route webviews, bounds global and per-partition guests, and fences attachment, retirement, destruction, and renderer loss by the full page tuple. Real Electron 43.1.0 proves exact main-frame reply admission, delayed guest-ID readiness, blank attachment, host ownership, destruction, and fail-closed denied attachment. Normal browser Sessions and paired web clients bypass the renderer registry. Production host composition and client placement activate the executor only after capability-gated placement preparation. Process/document swaps, worker/request/download settlement, traffic containment, and provider journeys remain uncovered. Audit1363: src/renderer/src/components/browser-pane/browser-client-page-renderer-installation.test.ts removed. Missing preload/web-client flags, mount/rekey/retire forwarding and failure-code projection. No equivalent replacement coverage is claimed. Audit1365: focused Linux unit selection passed on source head 8880357cb420c45f1b808ae545a5bc609324624d. This new result has its own exact command; historical results keep their prior scope. Intentional test losses remain recorded in knownGaps. No physical-provider, native input, rendered E2E, p95, soak or replacement-coverage claim. Audit1421 reduces browser-client-page-retained-registry.test.ts to its attached-generation destruction fence and wrong-generation retirement case. Blank mount, budgets, rekey, guest-ID readiness, process-loss, denied-attachment timeout and absent-page retirement unit alarms are lost. Synthetic webview events do not establish native Electron lifecycle delivery. No equivalent replacement coverage is claimed. Historical receipts remain scoped to unchanged selectors; this reduced suite has no new execution result.", "motivatingLinks": [ "https://linear.app/stably/issue/STA-4150/refactor-remote-browser-to-client-hosted-electron-webviews" ], "invariant": "A prepared route page binds its opaque authority to one exact main-observed renderer WebContents while that page generation is active or retiring. Before requesting a blank guest, the production command executor must retain the exact execution-host route, verify its key, and prepare the route/profile partition for one still-current renderer generation. Main sends the approved opaque partition and exact page generation, but no target URL, through one bounded request admitted against the exact current renderer object and document generation; only a schema-valid reply from that same object, request, operation, and page generation can settle it. Preload accepts requests only in the top frame, binds outcomes to the admitted request, fails overflow and unavailable subscribers within a bounded interval, and fences callbacks replaced by a newer document subscriber. Renderer retains each blank webview under one non-React document host keyed by the exact partition, page ID, and generation, never reparents it, and holds an attached or process-lost generation until exact destruction. Renderer replacement, WebContents-ID reuse, abort, timeout, malformed reply, disposal, and process loss fence pending work without admitting a late reply. Renderer-document replacement retires before commit, while blocked external navigation is ignored and failed or cancelled provisional navigation restores only the exact surviving frame. A WebContents whose Electron Session has belonged to a prepared route partition is quarantined synchronously after generic guest policy installation, including when page authority disappears between will-attach and did-attach. It must be a live blank webview owned by the exact renderer WebContents. Nonblank navigation remains denied until main matches the exact partition, browser page, page-host generation, guest WebContents, renderer WebContents, and opaque live page authority, then issues a separate grant. Every later navigation rechecks the same opaque guest incarnation and page authority, so reusing a logical tuple or WebContents ID cannot revive a stale guest. Releasing that authority, losing or destroying the guest process, or losing its owning renderer before, during, or after registration synchronously fences pending authority admission, ends exact logical authority, revokes navigation, and closes any attached guest through the same retirement barrier. Failed, aborted, or retired creation attempts revoke the exact guest and renderer mount before releasing the Session and route, attempt every safe cleanup, and never clear or admit a replacement generation after uncertain cleanup. Session and route release require exact guest destruction proof; an ambiguous mount outcome retains them. If close is delayed or fails, the partition stays outside attachment admission and route policies remain installed until the exact destroyed acknowledgement. Route popups remain denied throughout. Active and retiring page maps and pending renderer requests are bounded, stale callbacks cannot retire or clear replacements, and non-route browser guests retain existing behavior.", "oracle": "Audit1421 narrows renderer unit coverage as recorded in coverageNotes. Prior oracle descriptions are historical for the changed suite. The retained unchanged-source receipts are the only current execution evidence; reduced-source assertions await validation. Historical oracle account (not a current claim for changed sources): Prepare a page for one renderer and require authority lookup and registration by a sibling renderer to fail; reject owner replacement while the generation is active or retiring, then lose the owning renderer before guest registration and require only its prepared pages to retire. Pause partition setup, lose the owner, and require its waiter to fail without authority; add a live sibling waiter to the same pending setup and require only that waiter to admit; exceed the configured waiter cap and require immediate refusal. Make policy cleanup throw in the first of two owned partitions and require the sweep to retire both without restoring admission. Through the production executor, retain one exact route, prepare its partition, mount blank on one current renderer, register and grant the exact guest in order, then load only its normalized HTTP(S) URL. Queue renderer requests before subscription, replace one subscriber, overflow both request and page budgets, race attachment with retirement, delay guest identity until DOM readiness, lose the guest renderer, and require exact bounded settlement without reparenting or cross-partition collision. Under real Electron, require the main bridge to accept only the actual main-frame reply, match the positive renderer WebContents ID to did-attach-webview, destroy it on retirement, and reject and remove a denied unprepared guest. Reject a mismatched route, stale renderer or page generation, and file URL without touching Chromium. Abort or fail registration after mount and require exact guest, renderer, Session, and route cleanup in that order; make renderer cleanup reject but require destruction before later release, and keep the generation fenced from replacement. Make guest retirement fail or mount outcome ambiguous and require every safe cleanup while Session and route remain retained. Destroy a guest spontaneously before command cleanup, reuse its WebContents identity, and require the old opaque claim not to retire the replacement while the replacement claim still can. Attach a blank route guest and require nonblank navigation plus every popup to be denied. Reject a wrong renderer, wrong page generation, nonblank initial document, wrong WebContents type, destroyed guest, and excess attachment; delay or fail its close and require navigation and popups to remain denied. Register the exact prepared tuple and prove navigation remains denied until a second grant; then allow repeated HTTP(S) navigation while continuing to deny file navigation and popups. Release logical page authority with delayed guest close; require immediate navigation revocation, one exact close, no partition admission, no policy cleanup, and same-tuple preparation refusal until destroyed acknowledgement. Make destroyed inspection throw and require retirement plus navigation to remain fail-closed until the explicit destroyed event. Acknowledge destruction, require one policy cleanup, reprepare the tuple, replay stale acknowledgement, and prove the replacement remains admitted. Make retirement startup throw and require policy plus capacity to remain fail-closed. Retire two pages sharing one partition and require cleanup only after both exact acknowledgements. Emit guest render-process-gone and destroyed, and emit owning-renderer process loss through the main-window boundary; require exact logical retirement, close, and grant revocation while unrelated renderer guests and prepared pages survive. Reject retirement for the wrong opaque authority. Reprepare after ordinary release, require a new opaque authority, deny the stale guest, and admit an exact replacement. Destroy a registered guest under real destroyed state, verify best-effort listener release, replay stale cleanup, and prove its replacement remains grantable. Mutate caller input after registration and prove main-owned authority is unchanged. Attach a normal browser Session and require no route-registry mutation.", - "commands": [ - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/preload/browser-client-page-renderer-requests.test.ts src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", - "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts" - ], - "testFiles": [ - "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", - "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts", - "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", - "src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts", - "src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts", - "src/main/browser/routing/sessions/browser-route-session-registry.test.ts", - "src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", - "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts", - "src/preload/browser-client-page-renderer-requests.test.ts", - "src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts", - "src/main/window/createMainWindow.test.ts", - "src/main/window/renderer-document-navigation.test.ts" - ], - "assertionRefs": [ - { - "file": "src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts", - "assertions": [ - "exact execution route and trusted renderer precede blank guest registration and grant", - "navigation targets only the retained opaque guest incarnation and exact generation and rejects local files", - "abort, failed registration, ambiguous mount, and retirement attempt every safe exact cleanup without releasing network resources before destruction proof or admitting a replacement after failure", - "close racing creation cannot retain a late page, cleanly absent creates remain forgettable, and unresolved cleanup stays generation-fenced", - "navigation fencing revokes retained exact claims once and rejects late in-flight creation before guest registration or grant" - ] - }, - { - "file": "src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts", - "assertions": [ - "a fresh new-authority dispatcher reclaims an old-authority executor page while real route Session and WebContents registries preserve exact cleanup" - ] - }, - { - "file": "src/main/browser/client-pages/lifecycle/browser-client-page-reconciliation-adapters.test.ts", - "assertions": [ - "exact reclaim preserves the guest while rekeying renderer, Session, lifecycle claim, and navigation authority", - "rekey uncertainty retires both possible renderer identities and failed restore navigation destroys the affected guest before releasing retained resources" - ] - }, - { - "file": "src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts", - "assertions": [ - "mount requests carry only the main-approved partition and exact page generation to the exact current main-frame document", - "sender spoofing, subframe replies, stale document frames, malformed replies, renderer replacement, WebContents-ID reuse, abort, and late replies fail closed", - "timeout, send failure, and request-ID collision release only their exact admission", - "pending mount and retirement requests share one bounded admission ledger and release it exactly once" - ] - }, - { - "file": "src/main/browser/client-pages/renderer/browser-client-page-renderer-lifecycle.electron.test.ts", - "assertions": [ - "real Electron binds replies to the current main frame and matches the renderer guest ID to did-attach-webview", - "a document-owned blank webview survives attachment and is destroyed without reparenting on retirement", - "an unprepared partition is denied and its renderer host settles and disappears" - ] - }, - { - "file": "src/preload/browser-client-page-renderer-requests.test.ts", - "assertions": [ - "top-frame-only requests queue before subscription and fail overflow or missing subscribers within bounded limits", - "latest-subscriber replacement fences prior callbacks and outcomes cannot spoof request identity or operation" - ] - }, - { - "file": "src/renderer/src/components/browser-pane/browser-client-page-retained-registry.test.ts", - "assertions": [ - "holds an attached generation until destruction and ignores wrong-generation retirement" - ] - }, - { - "file": "src/main/browser/routing/sessions/browser-route-session-registry.test.ts", - "assertions": [ - "a prepared Electron Session remains recognizable for late-attachment quarantine", - "prepared authority is bound to one renderer and owner loss retires unregistered pages", - "page release removes logical authority and tuple reuse receives a new opaque token", - "route policy stays installed and tuple reuse stays blocked until delayed exact-guest destruction settles" - ] - }, - { - "file": "src/main/browser/routing/sessions/browser-route-prepared-page-rekey.test.ts", - "assertions": [ - "prepared authority moves only across an exact same-page same-renderer generation change", - "rekey preserves the opaque authority and leaves stale or conflicting input unchanged" - ] - }, - { - "file": "src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts", - "assertions": [ - "route guests remain blank and popup-denied before exact registration and grant", - "guest, renderer, partition, and logical page generation must all match", - "later navigation rechecks live page authority and invalid schemes remain denied", - "only the exact opaque guest lifecycle claim can revoke navigation without destroying the guest", - "late, excess, and close-failed attachments remain navigation- and popup-denied", - "opaque authority replacement, page conflicts, mutable inputs, and stale cleanup fail closed", - "exact page retirement revokes and closes only the authority-matched guest", - "guest process loss and owning-renderer retirement end the exact authority while unrelated guests survive", - "normal browser Sessions remain outside the route registry" - ] - }, - { - "file": "src/main/window/createMainWindow.test.ts", - "assertions": [ - "generic guest policy installs before route lockdown can override popup behavior", - "every attached webview is offered to the route registry without changing normal guests", - "main-renderer process loss retires every route guest owned by that renderer", - "process loss and renderer-document replacement retire the exact client-page renderer generation, while blocked external, failed provisional, and same-document navigation preserve or restore only the surviving document" - ] - }, - { - "file": "src/main/window/renderer-document-navigation.test.ts", - "assertions": [ - "only packaged or same-origin development renderer-document replacement starts a lifecycle fence", - "failed, cancelled, and blocked provisional navigation restore the surviving document without clearing a committed fence", - "a delayed failure from a committed attempt cannot cancel a live same-URL replacement while its main frame is still loading", - "concurrent failure plus blocked replacement converges when the unchanged document becomes idle" - ] - } - ], - "evidenceRuns": [ - { - "date": "2026-08-14", - "runner": "local", - "platform": "macos", - "command": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/browser-client-page-command-executor.test.ts src/main/browser/browser-client-page-command-integration.test.ts src/main/browser/browser-client-page-renderer-bridge.test.ts src/main/browser/browser-client-page-renderer-runtime.test.ts src/main/browser/browser-route-session-registry.test.ts src/main/browser/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts", - "result": "passed", - "durationSeconds": 0.8, - "summary": "Eight files and 174 tests passed deterministic route retention, trusted-renderer create ordering, exact renderer WebContents and main-frame-document fencing, subframe and stale-frame rejection, wrong-page and wrong-operation rejection, timeout/send/collision settlement, renderer-document replacement retirement, blocked external and same-document preservation, failed provisional restoration, stale same-URL failure rejection during a live replacement, concurrent failure plus blocked replacement convergence, production IPC wiring, composed real Session/WebContents registry lifecycle, abort and cleanup fencing, Session-index and prepared-owner fencing, bounded pending waiters, late/rejected route-WebContents quarantine, opaque-authority and process-loss fencing, fail-closed shared-partition release barriers, exact registration and navigation, popup denial, and main-window ordering tests." - }, - { - "date": "2026-11-04", - "runner": "local", - "platform": "linux", - "command": "pnpm --config.verifyDepsBeforeRun=false exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts --maxWorkers=2", - "result": "passed", - "durationSeconds": 5.51, - "summary": "Test Files 7 passed (7); Tests 116 passed (116). Source head 8880357cb420c45f1b808ae545a5bc609324624d. Headless main-only unchanged-source command. No renderer installation replacement or actual WebContents/provider execution claim. Node24.22.0 with ORCA_BACKGROUND_LAUNCH=1 and an isolated Xvfb display.", - "currentCommand": "pnpm exec vitest run --config config/vitest.config.ts src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts src/main/browser/client-pages/execution/browser-client-page-command-integration.test.ts src/main/browser/client-pages/renderer/browser-client-page-renderer-bridge.test.ts src/main/browser/routing/sessions/browser-route-session-registry.test.ts src/main/browser/routing/guest-authority/browser-route-webcontents-registry.test.ts src/main/window/createMainWindow.test.ts src/main/window/renderer-document-navigation.test.ts" - } - ], + "commands": [], + "testFiles": [], + "assertionRefs": [], + "evidenceRuns": [], "runtimeBudget": { "p95Seconds": 15, "scope": "Historical pre-audit selector budget; changed selectors have no new runtime measurement. Unchanged receipts remain scoped to their own commands." @@ -7178,6 +6858,7 @@ "Implement bounded generation-scoped popup reservations without any shell.openExternal or native-window fallback." ], "knownGaps": [ + "Audit1559 removes mocked host/lease/reconciliation, event/flag/counter, forwarding, inventory and retry-budget alarms without equivalent replacement coverage. Retained cases establish owned promise, registry, rollback, admission and cleanup boundaries with injected Electron/renderer/host inputs; actual local sockets, file staging and Buffer collection are scoped in the PR. Receipts selecting modified tests are retired; unaffected exact-selector receipts remain historical evidence only. No live paired runtime, rendered browser/profile/TLS or device claim.", "The production host lifecycle, route resolver, and retained renderer surface are active for eligible paired Electron clients; headed and headless paired-runtime product journeys cover the normal creation path on macOS.", "Real Electron main-frame reply, delayed guest-ID readiness, denial, destruction, and retained visible attachment are covered locally; process swaps, traffic isolation, and physical-platform behavior remain unvalidated.", "Guest and owning-renderer process-loss fencing is deterministic only; real Electron crash/reload ordering and WebContents process recovery remain unvalidated.", diff --git a/config/scripts/ci/sharding/ci-shard-timings.json b/config/scripts/ci/sharding/ci-shard-timings.json index b294c61cb78..4d79e5e961a 100644 --- a/config/scripts/ci/sharding/ci-shard-timings.json +++ b/config/scripts/ci/sharding/ci-shard-timings.json @@ -1132,8 +1132,6 @@ "src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts": 156, "src/main/browser/client-hosts/commands/browser-client-host-command-retention.test.ts": 799, "src/main/browser/client-hosts/lifecycle/browser-client-host-id.test.ts": 82, - "src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts": 161, - "src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts": 169, "src/main/browser/network/client-routes/browser-client-network-route-registry.test.ts": 286, "src/main/browser/client-pages/execution/browser-client-page-automation-runtime.test.ts": 53, "src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts": 319, @@ -1243,7 +1241,6 @@ "src/main/browser/cdp/commands/cdp-print-to-pdf.test.ts": 68, "src/main/browser/cdp/commands/cdp-screenshot.test.ts": 415, "src/main/browser/cdp/transport/cdp-ws-proxy-first-paint.test.ts": 366, - "src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts": 489, "src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts": 576, "src/main/browser/cdp/transport/cdp-ws-proxy-input-focus.test.ts": 360, "src/main/browser/cdp/transport/cdp-ws-proxy-malformed-messages.test.ts": 305, @@ -1361,11 +1358,8 @@ "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-reconnect.test.ts": 568, "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts": 53, "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts": 1404, - "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts": 370, "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-command-admission.test.ts": 213, - "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts": 945, "src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts": 973, - "src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts": 269, "src/main/browser/network/execution-routes/paired-runtime-browser-network-route.test.ts": 1150, "src/main/browser/guest-lifecycle/popups/popup-identity-electron-probe.test.ts": 144, "src/main/browser/guest-lifecycle/popups/popup-origin-bar-window.test.ts": 118, diff --git a/src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts deleted file mode 100644 index a04478466da..00000000000 --- a/src/main/browser/cdp/transport/cdp-ws-proxy-focus-replay.test.ts +++ /dev/null @@ -1,366 +0,0 @@ -import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' -import { CdpWsProxy } from './cdp-ws-proxy' -import { - connect, - createMockWebContents, - getSendCommandCalls, - getSendCommandMethods, - sendAndReceive, - mockAsWebContents, - type MockWebContents -} from './cdp-ws-proxy-test-harness' - -vi.mock('electron', () => ({ - webContents: { fromId: vi.fn() } -})) - -// Native focus before insertion can blur the DOM.focus target; replay restores it. -describe('CdpWsProxy DOM.focus replay', () => { - let mock: MockWebContents - let proxy: CdpWsProxy - let endpoint: string - - beforeEach(async () => { - mock = createMockWebContents() - proxy = new CdpWsProxy(mockAsWebContents(mock), () => () => {}) - endpoint = await proxy.start() - }) - - afterEach(async () => { - await proxy.stop() - }) - - it('replays DOM.focus before Input.insertText in the root session', async () => { - const client = await connect(endpoint) - - const focusResponse = await sendAndReceive(client, { - id: 14, - method: 'DOM.focus', - params: { backendNodeId: 99 } - }) - const insertResponse = await sendAndReceive(client, { - id: 15, - method: 'Input.insertText', - params: { text: 'hello' } - }) - - expect(focusResponse.id).toBe(14) - expect(insertResponse.id).toBe(15) - expect(insertResponse.result).toEqual({}) - expect(mock.webContents.focus).toHaveBeenCalledTimes(1) - expect(getSendCommandCalls(mock)).toEqual([ - ['Page.enable', {}], - ['DOM.focus', { backendNodeId: 99 }], - ['DOM.focus', { backendNodeId: 99 }], - ['Input.insertText', { text: 'hello' }] - ]) - client.close() - }) - - it('replays DOM.focus before Input.insertText for OOPIF sessions', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 16, - method: 'DOM.focus', - params: { backendNodeId: 123 }, - sessionId: 'oopif-session-123' - }) - const insertResponse = await sendAndReceive(client, { - id: 17, - method: 'Input.insertText', - params: { text: 'frame text' }, - sessionId: 'oopif-session-123' - }) - - expect(insertResponse.id).toBe(17) - expect(insertResponse.result).toEqual({}) - expect(getSendCommandCalls(mock)).toEqual([ - ['Page.enable', {}], - ['DOM.focus', { backendNodeId: 123 }, 'oopif-session-123'], - ['DOM.focus', { backendNodeId: 123 }, 'oopif-session-123'], - ['Input.insertText', { text: 'frame text' }, 'oopif-session-123'] - ]) - client.close() - }) - - it('does not replay DOM.focus after adjacent eval traffic', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 18, - method: 'DOM.focus', - params: { backendNodeId: 44 } - }) - await sendAndReceive(client, { - id: 19, - method: 'Runtime.callFunctionOn', - params: { functionDeclaration: '() => document.activeElement?.id' } - }) - const insertResponse = await sendAndReceive(client, { - id: 20, - method: 'Input.insertText', - params: { text: 'after eval' } - }) - - expect(insertResponse.id).toBe(20) - expect(insertResponse.result).toEqual({}) - expect(mock.webContents.focus).toHaveBeenCalledTimes(1) - expect(getSendCommandCalls(mock)).toEqual([ - ['Page.enable', {}], - ['DOM.focus', { backendNodeId: 44 }], - ['Runtime.callFunctionOn', { functionDeclaration: '() => document.activeElement?.id' }], - ['Input.insertText', { text: 'after eval' }] - ]) - client.close() - }) - - it('does not replay a failed DOM.focus on the next Input.insertText', async () => { - let domFocusAttempt = 0 - mock.webContents.debugger.sendCommand.mockImplementation(async (...args: unknown[]) => { - const [method] = args as [string] - if (method === 'DOM.focus') { - domFocusAttempt += 1 - if (domFocusAttempt === 1) { - throw new Error('Node not found') - } - } - return {} - }) - - const client = await connect(endpoint) - - const focusResponse = await sendAndReceive(client, { - id: 21, - method: 'DOM.focus', - params: { backendNodeId: 55 } - }) - const insertResponse = await sendAndReceive(client, { - id: 22, - method: 'Input.insertText', - params: { text: 'fallback' } - }) - - expect(focusResponse).toEqual({ - id: 21, - error: { code: -32000, message: 'Node not found' } - }) - expect(insertResponse.id).toBe(22) - expect(insertResponse.result).toEqual({}) - expect(mock.webContents.focus).toHaveBeenCalledTimes(1) - expect(getSendCommandCalls(mock)).toEqual([ - ['Page.enable', {}], - ['DOM.focus', { backendNodeId: 55 }], - ['Input.insertText', { text: 'fallback' }] - ]) - client.close() - }) - - it('returns the replay error when the stored DOM.focus fails before Input.insertText', async () => { - let domFocusAttempt = 0 - mock.webContents.debugger.sendCommand.mockImplementation(async (...args: unknown[]) => { - const [method] = args as [string] - if (method === 'DOM.focus') { - domFocusAttempt += 1 - if (domFocusAttempt === 2) { - throw new Error('Focus target went stale') - } - } - return {} - }) - - const client = await connect(endpoint) - - const focusResponse = await sendAndReceive(client, { - id: 23, - method: 'DOM.focus', - params: { backendNodeId: 77 } - }) - const insertResponse = await sendAndReceive(client, { - id: 24, - method: 'Input.insertText', - params: { text: 'blocked' } - }) - - expect(focusResponse.id).toBe(23) - expect(focusResponse.result).toEqual({}) - expect(insertResponse).toEqual({ - id: 24, - error: { code: -32000, message: 'Focus target went stale' } - }) - expect(mock.webContents.focus).toHaveBeenCalledTimes(1) - expect(getSendCommandCalls(mock)).toEqual([ - ['Page.enable', {}], - ['DOM.focus', { backendNodeId: 77 }], - ['DOM.focus', { backendNodeId: 77 }] - ]) - client.close() - }) - - it('still replays DOM.focus when Input.insertText is dispatched while DOM.focus is still in flight', async () => { - let resolveFocus: (v: Record) => void - const focusPromise = new Promise>((r) => { - resolveFocus = r - }) - mock.webContents.debugger.sendCommand.mockImplementation(async (...args: unknown[]) => { - const [method] = args as [string] - if (method === 'DOM.focus') { - return focusPromise - } - return {} - }) - - const client = await connect(endpoint) - const responses: Record[] = [] - client.on('message', (data) => { - responses.push(JSON.parse(data.toString())) - }) - - client.send(JSON.stringify({ id: 25, method: 'DOM.focus', params: { backendNodeId: 66 } })) - await new Promise((r) => setTimeout(r, 10)) - client.send( - JSON.stringify({ id: 26, method: 'Input.insertText', params: { text: 'pipelined' } }) - ) - - await new Promise((r) => setTimeout(r, 20)) - resolveFocus!({}) - await new Promise((r) => setTimeout(r, 20)) - - expect(responses).toHaveLength(2) - const focusResponse = responses.find((r) => r.id === 25) - const insertResponse = responses.find((r) => r.id === 26) - expect(focusResponse?.result).toEqual({}) - expect(insertResponse?.result).toEqual({}) - expect(getSendCommandMethods(mock)).toEqual([ - 'Page.enable', - 'DOM.focus', - 'DOM.focus', - 'Input.insertText' - ]) - client.close() - }) - - it('clears the pending DOM.focus replay when Page.bringToFront intervenes', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 27, - method: 'DOM.focus', - params: { backendNodeId: 88 } - }) - await sendAndReceive(client, { id: 28, method: 'Page.bringToFront', params: {} }) - const insertResponse = await sendAndReceive(client, { - id: 29, - method: 'Input.insertText', - params: { text: 'no replay' } - }) - - expect(insertResponse.id).toBe(29) - expect(insertResponse.result).toEqual({}) - // Only insertText focuses natively; bringToFront is a no-op. - expect(mock.webContents.focus).toHaveBeenCalledTimes(1) - expect(getSendCommandMethods(mock)).toEqual(['Page.enable', 'DOM.focus', 'Input.insertText']) - client.close() - }) - - it('clears the pending DOM.focus replay when Page.captureScreenshot intervenes', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 30, - method: 'DOM.focus', - params: { backendNodeId: 91 } - }) - await sendAndReceive(client, { id: 31, method: 'Page.captureScreenshot', params: {} }) - const insertResponse = await sendAndReceive(client, { - id: 32, - method: 'Input.insertText', - params: { text: 'no replay after screenshot' } - }) - - expect(insertResponse.id).toBe(32) - expect(insertResponse.result).toEqual({}) - expect(getSendCommandMethods(mock)).toEqual([ - 'Page.enable', - 'DOM.focus', - 'Page.captureScreenshot', - 'Input.insertText' - ]) - client.close() - }) - - it('does not replay a pending DOM.focus across a client reconnect', async () => { - const first = await connect(endpoint) - await sendAndReceive(first, { id: 33, method: 'DOM.focus', params: { backendNodeId: 12 } }) - first.close() - - const second = await connect(endpoint) - const insertResponse = await sendAndReceive(second, { - id: 34, - method: 'Input.insertText', - params: { text: 'fresh client' } - }) - - expect(insertResponse.id).toBe(34) - expect(insertResponse.result).toEqual({}) - expect(getSendCommandMethods(mock)).toEqual(['Page.enable', 'DOM.focus', 'Input.insertText']) - second.close() - }) - - it('does not replay or insert once the client disconnects mid-DOM.focus', async () => { - let resolveFocus: (v: Record) => void = () => {} - mock.webContents.debugger.sendCommand.mockImplementation(async (...args: unknown[]) => { - const [method] = args as [string] - if (method === 'DOM.focus') { - return new Promise>((resolve) => { - resolveFocus = resolve - }) - } - return {} - }) - - const client = await connect(endpoint) - client.send(JSON.stringify({ id: 35, method: 'DOM.focus', params: { backendNodeId: 7 } })) - await new Promise((r) => setTimeout(r, 10)) - client.send(JSON.stringify({ id: 36, method: 'Input.insertText', params: { text: 'gone' } })) - await new Promise((r) => setTimeout(r, 10)) - client.close() - await new Promise((r) => setTimeout(r, 10)) - - resolveFocus({}) - await new Promise((r) => setTimeout(r, 20)) - - const methods = getSendCommandMethods(mock) - expect(methods.filter((m) => m === 'DOM.focus')).toHaveLength(1) - expect(methods).not.toContain('Input.insertText') - }) - - it('does not insert once the client disconnects during the DOM.focus replay', async () => { - let domFocusCalls = 0 - let resolveReplay: (v: Record) => void = () => {} - mock.webContents.debugger.sendCommand.mockImplementation(async (...args: unknown[]) => { - const [method] = args as [string] - if (method === 'DOM.focus') { - domFocusCalls += 1 - // Stall the replay, after the initial focus succeeds, to disconnect during it. - if (domFocusCalls === 2) { - return new Promise>((resolve) => { - resolveReplay = resolve - }) - } - } - return {} - }) - - const client = await connect(endpoint) - await sendAndReceive(client, { id: 37, method: 'DOM.focus', params: { backendNodeId: 9 } }) - client.send(JSON.stringify({ id: 38, method: 'Input.insertText', params: { text: 'late' } })) - await new Promise((r) => setTimeout(r, 10)) - client.close() - await new Promise((r) => setTimeout(r, 10)) - resolveReplay({}) - await new Promise((r) => setTimeout(r, 20)) - - expect(getSendCommandMethods(mock)).not.toContain('Input.insertText') - }) -}) diff --git a/src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts index a8a920ca219..0414c275a4c 100644 --- a/src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts +++ b/src/main/browser/cdp/transport/cdp-ws-proxy-host-admission.test.ts @@ -1,7 +1,6 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' import { CdpWsProxy } from './cdp-ws-proxy' import { runWithRemoteCliPageAdmission } from '../../routing/input-ownership/remote-cli-page-admission' -import { sendGuestCdpCommand } from '../debugger/guest-cdp-command' import { releaseHeldPageInput } from '../input/guest-direct-key-input' import { connect, @@ -19,15 +18,6 @@ vi.mock('electron', () => ({ const PAGE_ID = 7 const REVOKED = 'The Orca desktop stopped sharing its browser before this command ran.' -function keyUps(mock: MockWebContents): string[] { - return [ - ...mock.webContents.sendInputEvent.mock.calls.map((call) => call[0].type), - ...mock.webContents.debugger.sendCommand.mock.calls - .filter((call) => call[0] === 'Input.dispatchKeyEvent') - .map((call) => String(call[1]?.type)) - ].filter((type) => type === 'keyUp') -} - function mouseEvents(mock: MockWebContents): string[] { return mock.webContents.debugger.sendCommand.mock.calls .filter((call) => call[0] === 'Input.dispatchMouseEvent') @@ -55,67 +45,6 @@ describe('CdpWsProxy under a host command', () => { await proxy.stop() }) - it('refuses every helper step after the host is revoked, without sending it to the page', async () => { - let revoked = false - let finish = (): void => {} - const held = runWithRemoteCliPageAdmission( - PAGE_ID, - () => { - if (revoked) { - throw new Error(REVOKED) - } - }, - () => new Promise((resolve) => (finish = resolve)) - ) - const client = await connect(endpoint) - const press = { type: 'mouseMoved', x: 1, y: 1 } - - const allowed = await sendAndReceive(client, { - id: 1, - method: 'Input.dispatchMouseEvent', - params: press - }) - revoked = true - const refused = await sendAndReceive(client, { - id: 2, - method: 'Input.dispatchMouseEvent', - params: press - }) - - expect(allowed.error).toBeUndefined() - expect(refused).toMatchObject({ id: 2, error: { message: REVOKED } }) - expect(mouseEvents(mock)).toEqual(['mouseMoved']) - finish() - await held - client.close() - }) - - it('refuses a helper the PDF of a page that moved to a desktop file while it printed', async () => { - let movedToFile = false - let finish = (): void => {} - const held = runWithRemoteCliPageAdmission( - PAGE_ID, - () => { - if (movedToFile) { - throw new Error('not browsing through the host') - } - }, - () => new Promise((resolve) => (finish = resolve)) - ) - mock.webContents.printToPDF.mockImplementation(async () => { - movedToFile = true - return Buffer.from('%PDF-private') - }) - const client = await connect(endpoint) - - const printed = await sendAndReceive(client, { id: 1, method: 'Page.printToPDF', params: {} }) - - expect(printed).toMatchObject({ id: 1, error: { message: 'not browsing through the host' } }) - finish() - await held - client.close() - }) - function holdPage(): { revoke: () => void; release: () => Promise } { const page = mockAsWebContents(mock, PAGE_ID) let revoked = false @@ -140,103 +69,7 @@ describe('CdpWsProxy under a host command', () => { } const MOUSE = 'Input.dispatchMouseEvent' - const KEY = 'Input.dispatchKeyEvent' const pressed = { type: 'mousePressed', x: 1, y: 1, button: 'left', clickCount: 1 } - const released = { type: 'mouseReleased', x: 1, y: 1, button: 'left', clickCount: 1 } - const shiftDown = { type: 'rawKeyDown', key: 'Shift', code: 'ShiftLeft', modifiers: 8 } - const shiftUp = { type: 'keyUp', key: 'Shift', code: 'ShiftLeft' } - - it.each(['window', 'webview'])( - 'refuses a revoked release, then lets go of the button and key itself (%s page)', - async (pageType) => { - mock.webContents.getType.mockReturnValue(pageType) - const page = holdPage() - const client = await connect(endpoint) - - await sendAndReceive(client, { id: 5, method: MOUSE, params: pressed }) - await sendAndReceive(client, { id: 6, method: KEY, params: shiftDown }) - page.revoke() - const mouseUp = await sendAndReceive(client, { id: 7, method: MOUSE, params: released }) - const keyUp = await sendAndReceive(client, { id: 8, method: KEY, params: shiftUp }) - - expect(mouseUp).toMatchObject({ error: { message: REVOKED } }) - expect(keyUp).toMatchObject({ error: { message: REVOKED } }) - expect(mouseEvents(mock)).toEqual(['mousePressed']) - expect(keyUps(mock)).toHaveLength(0) - await page.release() - // Release off-page to avoid completing the revoked click. - expect(mock.webContents.debugger.sendCommand).toHaveBeenCalledWith( - MOUSE, - expect.objectContaining({ type: 'mouseReleased', x: -1, y: -1 }) - ) - expect(mouseEvents(mock)).toEqual(['mousePressed', 'mouseReleased']) - expect(keyUps(mock)).toHaveLength(1) - client.close() - } - ) - - it('lets go of nothing when the command released what it pressed before the revocation', async () => { - const page = holdPage() - const client = await connect(endpoint) - - await sendAndReceive(client, { id: 11, method: MOUSE, params: pressed }) - await sendAndReceive(client, { id: 12, method: MOUSE, params: released }) - page.revoke() - await page.release() - - expect(mouseEvents(mock)).toEqual(['mousePressed', 'mouseReleased']) - client.close() - }) - - it('refuses a release of something the revoked command never pressed', async () => { - const page = holdPage() - const client = await connect(endpoint) - page.revoke() - - const mouseUp = await sendAndReceive(client, { id: 9, method: MOUSE, params: released }) - const keyUp = await sendAndReceive(client, { id: 10, method: KEY, params: shiftUp }) - - expect(mouseUp).toMatchObject({ error: { message: REVOKED } }) - expect(keyUp).toMatchObject({ error: { message: REVOKED } }) - expect(mouseEvents(mock)).toEqual([]) - await page.release() - client.close() - }) - - it('drops a press it accepted before the revocation but had not delivered yet', async () => { - mock.webContents.getType.mockReturnValue('webview') - let grantFocus = (): void => {} - guardFocus = () => new Promise((resolve) => (grantFocus = () => resolve(() => {}))) - let revoked = false - let finish = (): void => {} - const held = runWithRemoteCliPageAdmission( - PAGE_ID, - () => { - if (revoked) { - throw new Error(REVOKED) - } - }, - () => new Promise((resolve) => (finish = resolve)) - ) - const client = await connect(endpoint) - - const reply = sendAndReceive(client, { - id: 3, - method: 'Input.dispatchMouseEvent', - params: { type: 'mousePressed', x: 1, y: 1, button: 'left', clickCount: 1 } - }) - await vi.waitFor(() => - expect(getSendCommandMethods(mock)).toContain('Emulation.setFocusEmulationEnabled') - ) - revoked = true - grantFocus() - - await expect(reply).resolves.toMatchObject({ id: 3, error: { message: REVOKED } }) - expect(mouseEvents(mock)).toEqual([]) - finish() - await held - client.close() - }) it('still refuses a deferred press after the revoked command let go of the page', async () => { mock.webContents.getType.mockReturnValue('webview') @@ -257,76 +90,4 @@ describe('CdpWsProxy under a host command', () => { expect(mouseEvents(mock)).toEqual([]) client.close() }) - - it('lets go of a button whose own release failed to land', async () => { - const page = holdPage() - const client = await connect(endpoint) - const send = mock.webContents.debugger.sendCommand.getMockImplementation() - mock.webContents.debugger.sendCommand.mockImplementationOnce(async () => ({})) - mock.webContents.debugger.sendCommand.mockImplementationOnce(async () => { - throw new Error('target closed') - }) - - await sendAndReceive(client, { id: 14, method: MOUSE, params: pressed }) - const failed = await sendAndReceive(client, { id: 15, method: MOUSE, params: released }) - if (send) { - mock.webContents.debugger.sendCommand.mockImplementation(send) - } - page.revoke() - await page.release() - - expect(failed.error).toBeDefined() - expect(mock.webContents.debugger.sendCommand).toHaveBeenCalledWith( - MOUSE, - expect.objectContaining({ type: 'mouseReleased', x: -1, y: -1 }) - ) - client.close() - }) - - it('forwards commands again once the host command ends', async () => { - await runWithRemoteCliPageAdmission( - PAGE_ID, - () => { - throw new Error(REVOKED) - }, - async () => {} - ) - const client = await connect(endpoint) - - const response = await sendAndReceive(client, { - id: 4, - method: 'Accessibility.getFullAXTree', - params: {} - }) - - expect(response.error).toBeUndefined() - expect(getSendCommandMethods(mock)).toContain('Accessibility.getFullAXTree') - client.close() - }) - - it('never refuses the desktop its own page commands while a revoked host command unwinds', async () => { - let finish = (): void => {} - const held = runWithRemoteCliPageAdmission( - PAGE_ID, - () => { - throw new Error(REVOKED) - }, - () => new Promise((resolve) => (finish = resolve)) - ) - - await expect( - sendGuestCdpCommand( - { ...mock.webContents, id: PAGE_ID }, - 'Emulation.setDeviceMetricsOverride', - { - width: 400, - height: 300, - deviceScaleFactor: 1, - mobile: false - } - ) - ).resolves.toEqual({}) - finish() - await held - }) }) diff --git a/src/main/browser/cdp/transport/cdp-ws-proxy.test.ts b/src/main/browser/cdp/transport/cdp-ws-proxy.test.ts index f94e9f8fdb4..a58008336fc 100644 --- a/src/main/browser/cdp/transport/cdp-ws-proxy.test.ts +++ b/src/main/browser/cdp/transport/cdp-ws-proxy.test.ts @@ -1,11 +1,8 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' -import WebSocket from 'ws' import { CdpWsProxy } from './cdp-ws-proxy' import { connect, createMockWebContents, - getSendCommandCalls, - getSendCommandMethods, sendAndReceive, mockAsWebContents, type MockWebContents @@ -37,715 +34,6 @@ describe('CdpWsProxy', () => { return result.stream as string } - const defaultPdfMarginInches = 1 / 2.54 - - it('starts on a random port and returns ws:// URL', () => { - expect(endpoint).toMatch(/^ws:\/\/127\.0\.0\.1:\d+$/) - expect(proxy.getPort()).toBeGreaterThan(0) - }) - - it('does not retain an extra startup server error listener after binding', () => { - const server = ( - proxy as unknown as { httpServer: { listenerCount: (event: string) => number } } - ).httpServer - - expect(server.listenerCount('error')).toBeLessThanOrEqual(1) - }) - - it('attaches debugger on start', () => { - expect(mock.webContents.debugger.attach).toHaveBeenCalledWith('1.3') - }) - - it('correlates CDP request/response IDs', async () => { - mock.webContents.debugger.sendCommand.mockResolvedValueOnce({ tree: 'nodes' }) - - const ws = connect(endpoint) - const client = await ws - const response = await sendAndReceive(client, { - id: 42, - method: 'Accessibility.getFullAXTree', - params: {} - }) - - expect(response.id).toBe(42) - expect(response.result).toEqual({ tree: 'nodes' }) - client.close() - }) - - it('returns error response when sendCommand fails', async () => { - mock.webContents.debugger.sendCommand.mockRejectedValueOnce(new Error('Node not found')) - - const client = await connect(endpoint) - const response = await sendAndReceive(client, { - id: 7, - method: 'DOM.describeNode', - params: { nodeId: 999 } - }) - - expect(response.id).toBe(7) - expect(response.error).toEqual({ code: -32000, message: 'Node not found' }) - client.close() - }) - - it('routes Playwright nested browser and page sessions on the proxy path', async () => { - const client = await connect(endpoint) - - const primaryPageAttachResponse = await sendAndReceive(client, { - id: 31, - method: 'Target.attachToTarget', - params: { targetId: 'orca-proxy-target', flatten: true } - }) - - expect(primaryPageAttachResponse).toEqual({ - id: 31, - result: { sessionId: 'orca-proxy-session' } - }) - - const attachResponse = await sendAndReceive(client, { - id: 32, - method: 'Target.attachToBrowserTarget', - params: {} - }) - - expect(attachResponse).toEqual({ - id: 32, - result: { sessionId: 'orca-proxy-browser-session' } - }) - expect(getSendCommandMethods(mock)).not.toContain('Target.attachToBrowserTarget') - - const pageAttachResponse = await sendAndReceive(client, { - id: 33, - method: 'Target.attachToTarget', - params: { targetId: 'orca-proxy-target', flatten: true }, - sessionId: 'orca-proxy-browser-session' - }) - - expect(pageAttachResponse).toEqual({ - id: 33, - result: { sessionId: 'orca-proxy-session-2' }, - sessionId: 'orca-proxy-browser-session' - }) - - const sessionResponse = await sendAndReceive(client, { - id: 34, - method: 'Runtime.evaluate', - params: { expression: 'document.title' }, - sessionId: 'orca-proxy-session-2' - }) - - expect(sessionResponse).toEqual({ - id: 34, - result: {}, - sessionId: 'orca-proxy-session-2' - }) - expect(getSendCommandCalls(mock)).toContainEqual([ - 'Runtime.evaluate', - { expression: 'document.title' } - ]) - - const detachResponse = await sendAndReceive(client, { - id: 35, - method: 'Target.detachFromTarget', - params: { sessionId: 'orca-proxy-session-2' }, - sessionId: 'orca-proxy-browser-session' - }) - - expect(detachResponse).toEqual({ - id: 35, - result: {}, - sessionId: 'orca-proxy-browser-session' - }) - - const primaryPageResponse = await sendAndReceive(client, { - id: 36, - method: 'Runtime.evaluate', - params: { expression: 'document.URL' }, - sessionId: 'orca-proxy-session' - }) - - expect(primaryPageResponse).toEqual({ - id: 36, - result: {}, - sessionId: 'orca-proxy-session' - }) - - const browserSessionResponse = await sendAndReceive(client, { - id: 37, - method: 'Target.getTargets', - params: {}, - sessionId: 'orca-proxy-browser-session' - }) - - expect(browserSessionResponse).toMatchObject({ - id: 37, - sessionId: 'orca-proxy-browser-session' - }) - client.close() - }) - - it('preserves Target.attachToTarget and clears the synthetic session on Target.detachFromTarget', async () => { - const client = await connect(endpoint) - - const attachResponse = await sendAndReceive(client, { - id: 33, - method: 'Target.attachToTarget', - params: { targetId: 'orca-proxy-target', flatten: true } - }) - - expect(attachResponse).toEqual({ - id: 33, - result: { sessionId: 'orca-proxy-session' } - }) - - const detachResponse = await sendAndReceive(client, { - id: 34, - method: 'Target.detachFromTarget', - params: { sessionId: 'orca-proxy-session' } - }) - - expect(detachResponse).toEqual({ id: 34, result: {} }) - - const rootEventPromise = new Promise>((resolve) => { - client.once('message', (data) => resolve(JSON.parse(data.toString()))) - }) - mock.emit('message', {}, 'Runtime.executionContextCreated', { context: { id: 1 } }) - - const rootEvent = await rootEventPromise - expect(rootEvent).toEqual({ - method: 'Runtime.executionContextCreated', - params: { context: { id: 1 } } - }) - - const reattachResponse = await sendAndReceive(client, { - id: 35, - method: 'Target.attachToTarget', - params: { targetId: 'orca-proxy-target', flatten: true } - }) - - expect(reattachResponse).toEqual({ - id: 35, - result: { sessionId: 'orca-proxy-session-2' } - }) - client.close() - }) - - it('returns an error instead of crashing when a command arrives after tab destruction', async () => { - const client = await connect(endpoint) - mock.destroy() - - const response = await sendAndReceive(client, { - id: 8, - method: 'Runtime.evaluate', - params: { expression: 'location.href' } - }) - - expect(response.id).toBe(8) - expect(response.error).toEqual({ - code: -32000, - message: 'Browser tab is no longer available' - }) - expect(mock.webContents.debugger.sendCommand).not.toHaveBeenCalledWith( - 'Runtime.evaluate', - expect.anything(), - expect.anything() - ) - client.close() - }) - - it('handles concurrent requests with correct correlation', async () => { - let resolveFirst: (v: unknown) => void - const firstPromise = new Promise((r) => { - resolveFirst = r - }) - - mock.webContents.debugger.sendCommand - .mockImplementationOnce(async () => { - await firstPromise - return { result: 'slow' } - }) - .mockResolvedValueOnce({ result: 'fast' }) - - const client = await connect(endpoint) - - const responses: Record[] = [] - client.on('message', (data) => { - responses.push(JSON.parse(data.toString())) - }) - - client.send(JSON.stringify({ id: 1, method: 'DOM.enable', params: {} })) - await new Promise((r) => setTimeout(r, 10)) - client.send(JSON.stringify({ id: 2, method: 'Page.enable', params: {} })) - - await new Promise((r) => setTimeout(r, 20)) - resolveFirst!(undefined) - await new Promise((r) => setTimeout(r, 20)) - - expect(responses).toHaveLength(2) - const resp1 = responses.find((r) => r.id === 1) - const resp2 = responses.find((r) => r.id === 2) - expect(resp1?.result).toEqual({ result: 'slow' }) - expect(resp2?.result).toEqual({ result: 'fast' }) - - client.close() - }) - - it('does not deliver a late response from a closed client to a newer websocket', async () => { - let resolveSlowCommand: ((value: { result: string }) => void) | null = null - mock.webContents.debugger.sendCommand - .mockImplementationOnce( - () => - new Promise((resolve) => { - resolveSlowCommand = resolve - }) - ) - .mockResolvedValueOnce({ result: 'new-client' }) - - const firstClient = await connect(endpoint) - firstClient.send(JSON.stringify({ id: 1, method: 'DOM.enable', params: {} })) - await new Promise((resolve) => setTimeout(resolve, 10)) - - const secondClient = await connect(endpoint) - const responses: Record[] = [] - secondClient.on('message', (data) => { - responses.push(JSON.parse(data.toString())) - }) - - secondClient.send(JSON.stringify({ id: 2, method: 'Page.enable', params: {} })) - await new Promise((resolve) => setTimeout(resolve, 20)) - - resolveSlowCommand!({ result: 'old-client' }) - await new Promise((resolve) => setTimeout(resolve, 20)) - - expect(responses).toEqual([{ id: 2, result: { result: 'new-client' } }]) - - secondClient.close() - }) - - it('forwards sessionId to sendCommand for OOPIF support', async () => { - mock.webContents.debugger.sendCommand.mockResolvedValueOnce({}) - - const client = await connect(endpoint) - await sendAndReceive(client, { - id: 1, - method: 'DOM.enable', - params: {}, - sessionId: 'oopif-session-123' - }) - - expect(mock.webContents.debugger.sendCommand).toHaveBeenCalledWith( - 'DOM.enable', - {}, - 'oopif-session-123' - ) - client.close() - }) - - it('never leaves auto-attached workers and frames waiting on a client that may leave', async () => { - mock.webContents.debugger.sendCommand.mockResolvedValueOnce({}) - - const client = await connect(endpoint) - // agent-browser 0.39 asks child targets to wait for it; the shared guest debugger outlives it. - await sendAndReceive(client, { - id: 1, - method: 'Target.setAutoAttach', - params: { autoAttach: true, waitForDebuggerOnStart: true, flatten: true }, - sessionId: 'oopif-session-123' - }) - - expect(mock.webContents.debugger.sendCommand).toHaveBeenCalledWith( - 'Target.setAutoAttach', - { autoAttach: true, waitForDebuggerOnStart: false, flatten: true }, - 'oopif-session-123' - ) - client.close() - }) - - it('forwards CDP events from debugger to client', async () => { - const client = await connect(endpoint) - - const eventPromise = new Promise>((resolve) => { - client.on('message', (data) => resolve(JSON.parse(data.toString()))) - }) - - mock.emit('message', {}, 'Console.messageAdded', { entry: { text: 'hello' } }) - - const event = await eventPromise - expect(event.method).toBe('Console.messageAdded') - expect(event.params).toEqual({ entry: { text: 'hello' } }) - client.close() - }) - - it('forwards sessionId in events when present', async () => { - const client = await connect(endpoint) - - const eventPromise = new Promise>((resolve) => { - client.on('message', (data) => resolve(JSON.parse(data.toString()))) - }) - - mock.emit('message', {}, 'DOM.nodeInserted', { node: {} }, 'iframe-session-456') - - const event = await eventPromise - expect(event.sessionId).toBe('iframe-session-456') - client.close() - }) - - it('does not focus the guest for Runtime.evaluate polling commands', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 9, - method: 'Runtime.evaluate', - params: { expression: 'document.readyState' } - }) - - expect(mock.webContents.focus).not.toHaveBeenCalled() - client.close() - }) - - it.each(['Page.bringToFront', 'Target.activateTarget'])( - 'answers %s without focusing or forwarding it', - async (method) => { - const client = await connect(endpoint) - - const response = await sendAndReceive(client, { id: 9, method, params: {} }) - - expect(response.result).toEqual({}) - expect(mock.webContents.focus).not.toHaveBeenCalled() - expect(getSendCommandMethods(mock)).toEqual(['Page.enable']) - client.close() - } - ) - - it('types root-session keys and text into an embedded guest without focusing it', async () => { - mock.webContents.getType.mockReturnValue('webview') - const client = await connect(endpoint) - - await sendAndReceive(client, { id: 11, method: 'DOM.focus', params: { backendNodeId: 5 } }) - const insert = await sendAndReceive(client, { - id: 12, - method: 'Input.insertText', - params: { text: 'hi' } - }) - const key = await sendAndReceive(client, { - id: 13, - method: 'Input.dispatchKeyEvent', - params: { type: 'keyDown', key: 'Enter', text: '\r' } - }) - - expect(insert.result).toEqual({}) - expect(key.result).toEqual({}) - expect(mock.webContents.focus).not.toHaveBeenCalled() - // Each delivery probes focus, then waits for page input handling. - expect(getSendCommandMethods(mock)).toEqual([ - 'Page.enable', - 'DOM.focus', - 'Runtime.evaluate', - 'DOM.focus', - 'Runtime.evaluate', - 'Runtime.evaluate', - 'Runtime.evaluate' - ]) - expect(mock.webContents.sendInputEvent.mock.calls.map(([event]) => event)).toEqual([ - { type: 'char', keyCode: 'h', modifiers: [], skipIfUnhandled: true }, - { type: 'char', keyCode: 'i', modifiers: [], skipIfUnhandled: true }, - { type: 'keyDown', keyCode: 'Enter', modifiers: [], skipIfUnhandled: true }, - { type: 'char', keyCode: '\r', modifiers: [], skipIfUnhandled: true } - ]) - client.close() - }) - - it('keeps pipelined root-session keys in order', async () => { - mock.webContents.getType.mockReturnValue('webview') - const client = await connect(endpoint) - const replies: unknown[] = [] - const allReplied = new Promise((resolve) => { - client.on('message', (data) => { - replies.push(JSON.parse(data.toString()).id) - if (replies.length === 3) { - resolve() - } - }) - }) - - for (const [id, type] of [ - [21, 'rawKeyDown'], - [22, 'keyUp'], - [23, 'rawKeyDown'] - ] as const) { - client.send( - JSON.stringify({ id, method: 'Input.dispatchKeyEvent', params: { type, key: 'Tab' } }) - ) - } - await allReplied - - expect(replies).toEqual([21, 22, 23]) - expect(mock.webContents.sendInputEvent.mock.calls.map(([event]) => event.type)).toEqual([ - 'keyDown', - 'keyUp', - 'keyDown' - ]) - client.close() - }) - - it('forwards child-frame session input unchanged and without focusing', async () => { - mock.webContents.getType.mockReturnValue('webview') - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 31, - method: 'Input.dispatchKeyEvent', - params: { type: 'keyDown', key: 'a', text: 'a' }, - sessionId: 'oopif-session' - }) - await sendAndReceive(client, { - id: 32, - method: 'Input.insertText', - params: { text: 'a' }, - sessionId: 'oopif-session' - }) - - expect(mock.webContents.focus).not.toHaveBeenCalled() - expect(mock.webContents.sendInputEvent).not.toHaveBeenCalled() - expect(getSendCommandCalls(mock).slice(1)).toEqual([ - ['Input.dispatchKeyEvent', { type: 'keyDown', key: 'a', text: 'a' }, 'oopif-session'], - ['Input.insertText', { text: 'a' }, 'oopif-session'] - ]) - client.close() - }) - - it('still focuses the guest for Input.insertText', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 10, - method: 'Input.insertText', - params: { text: 'hello' } - }) - - expect(mock.webContents.focus).toHaveBeenCalledTimes(1) - expect(getSendCommandMethods(mock)).toEqual(['Page.enable', 'Input.insertText']) - client.close() - }) - - it('primes lifecycle events for Page.navigate', async () => { - const client = await connect(endpoint) - - const response = await sendAndReceive(client, { - id: 11, - method: 'Page.navigate', - params: { url: 'https://example.com/next' } - }) - - expect(response.id).toBe(11) - expect(response.result).toEqual({}) - expect(getSendCommandMethods(mock)).toEqual([ - 'Page.enable', - 'Network.enable', - 'Page.enable', - 'Page.setLifecycleEventsEnabled', - 'Page.navigate' - ]) - client.close() - }) - - it('primes lifecycle events for Page.reload and preserves response id', async () => { - const client = await connect(endpoint) - - const response = await sendAndReceive(client, { - id: 12, - method: 'Page.reload' - }) - - expect(response.id).toBe(12) - expect(response.result).toEqual({}) - expect(getSendCommandMethods(mock)).toEqual([ - 'Page.enable', - 'Network.enable', - 'Page.enable', - 'Page.setLifecycleEventsEnabled' - ]) - expect(mock.webContents.reload).toHaveBeenCalledTimes(1) - expect(getSendCommandMethods(mock)).not.toContain('Page.reload') - client.close() - }) - - it('preserves explicit Page.navigate session during lifecycle priming', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 14, - method: 'Page.navigate', - params: { url: 'https://example.com/frame' }, - sessionId: 'iframe-session-123' - }) - - expect(getSendCommandCalls(mock).slice(1)).toEqual([ - ['Network.enable', {}, 'iframe-session-123'], - ['Page.enable', {}, 'iframe-session-123'], - ['Page.setLifecycleEventsEnabled', { enabled: true }, 'iframe-session-123'], - ['Page.navigate', { url: 'https://example.com/frame' }, 'iframe-session-123'] - ]) - client.close() - }) - - it('forwards explicit Page.reload session after lifecycle priming', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 15, - method: 'Page.reload', - params: { ignoreCache: true }, - sessionId: 'iframe-session-123' - }) - - expect(getSendCommandCalls(mock).slice(1)).toEqual([ - ['Network.enable', {}, 'iframe-session-123'], - ['Page.enable', {}, 'iframe-session-123'], - ['Page.setLifecycleEventsEnabled', { enabled: true }, 'iframe-session-123'], - ['Page.reload', { ignoreCache: true }, 'iframe-session-123'] - ]) - expect(mock.webContents.reloadIgnoringCache).not.toHaveBeenCalled() - expect(mock.webContents.reload).not.toHaveBeenCalled() - client.close() - }) - - it('rejects root Page.reload params that direct webContents reload cannot honor', async () => { - const client = await connect(endpoint) - - const response = await sendAndReceive(client, { - id: 16, - method: 'Page.reload', - params: { loaderId: 'stale-loader' } - }) - - expect(response).toEqual({ - id: 16, - error: { - code: -32000, - message: 'Page.reload parameter "loaderId" is not supported for Orca tab reloads' - } - }) - expect(mock.webContents.reload).not.toHaveBeenCalled() - expect(mock.webContents.reloadIgnoringCache).not.toHaveBeenCalled() - expect(getSendCommandMethods(mock)).not.toContain('Network.enable') - client.close() - }) - - it('still reloads when lifecycle priming stalls', async () => { - const client = await connect(endpoint) - mock.webContents.debugger.sendCommand.mockImplementation((method?: string) => { - if (method === 'Network.enable') { - return new Promise(() => {}) - } - return Promise.resolve({}) - }) - - const responsePromise = sendAndReceive(client, { - id: 17, - method: 'Page.reload' - }) - - await expect(responsePromise).resolves.toEqual({ id: 17, result: {} }) - expect(mock.webContents.reload).toHaveBeenCalledTimes(1) - client.close() - }) - - it('does not reload after the requesting client disconnects during priming', async () => { - const client = await connect(endpoint) - mock.webContents.debugger.sendCommand.mockImplementation((method?: string) => { - if (method === 'Network.enable') { - return new Promise(() => {}) - } - return Promise.resolve({}) - }) - - client.send(JSON.stringify({ id: 18, method: 'Page.reload' })) - client.close() - - await new Promise((resolve) => setTimeout(resolve, 1_100)) - - expect(mock.webContents.reload).not.toHaveBeenCalled() - expect(mock.webContents.reloadIgnoringCache).not.toHaveBeenCalled() - }) - - it('forwards Runtime.evaluate without lifecycle priming', async () => { - const client = await connect(endpoint) - - const response = await sendAndReceive(client, { - id: 13, - method: 'Runtime.evaluate', - params: { expression: 'document.readyState' } - }) - - expect(response.id).toBe(13) - expect(response.result).toEqual({}) - expect(getSendCommandMethods(mock)).toEqual(['Page.enable', 'Runtime.evaluate']) - client.close() - }) - - it('prints PDF data through native webContents printToPDF', async () => { - const client = await connect(endpoint) - - const response = await sendAndReceive(client, { - id: 19, - method: 'Page.printToPDF', - params: { - landscape: true, - printBackground: true, - paperWidth: 8.5, - paperHeight: 11, - marginTop: 0.25, - marginBottom: 0.5, - marginLeft: 0.75, - marginRight: 1, - pageRanges: '1-2', - preferCSSPageSize: true - } - }) - - expect(response).toEqual({ - id: 19, - result: { data: Buffer.from('%PDF-test').toString('base64') } - }) - expect(mock.webContents.printToPDF).toHaveBeenCalledWith({ - landscape: true, - printBackground: true, - pageSize: { width: 8.5, height: 11 }, - margins: { - top: 0.25, - bottom: 0.5, - left: 0.75, - right: 1 - }, - pageRanges: '1-2', - preferCSSPageSize: true - }) - expect(getSendCommandMethods(mock)).not.toContain('Page.printToPDF') - client.close() - }) - - it('keeps default PDF margins for omitted sides', async () => { - const client = await connect(endpoint) - - await sendAndReceive(client, { - id: 20, - method: 'Page.printToPDF', - params: { - marginTop: 0.25 - } - }) - - expect(mock.webContents.printToPDF).toHaveBeenCalledWith({ - margins: { - top: 0.25, - bottom: defaultPdfMarginInches, - left: defaultPdfMarginInches, - right: defaultPdfMarginInches - } - }) - client.close() - }) - it('supports streamed Page.printToPDF results for Playwright page.pdf', async () => { mock.webContents.printToPDF.mockResolvedValueOnce(Buffer.from('abcdef')) const client = await connect(endpoint) @@ -794,131 +82,4 @@ describe('CdpWsProxy', () => { }) client.close() }) - - it('clears streamed PDF data when the client disconnects', async () => { - mock.webContents.printToPDF.mockResolvedValueOnce(Buffer.from('abcdef')) - const client = await connect(endpoint) - - const printResponse = await sendAndReceive(client, { - id: 26, - method: 'Page.printToPDF', - params: { transferMode: 'ReturnAsStream' } - }) - const handle = expectPdfStreamHandle(printResponse) - - expect(printResponse.id).toBe(26) - client.close() - await new Promise((resolve) => setTimeout(resolve, 10)) - - const nextClient = await connect(endpoint) - const staleRead = await sendAndReceive(nextClient, { - id: 27, - method: 'IO.read', - params: { handle } - }) - - expect(staleRead).toEqual({ - id: 27, - error: { code: -32000, message: 'Invalid stream handle' } - }) - nextClient.close() - }) - - it('does not register a PDF stream when the client disconnects mid-print', async () => { - let resolvePrint: (buf: Buffer) => void = () => {} - mock.webContents.printToPDF.mockImplementationOnce( - () => - new Promise>((resolve) => { - resolvePrint = resolve - }) - ) - const store = ( - proxy as unknown as { pageCapture: { pdfStreams: { create: (b: Buffer) => string } } } - ).pageCapture.pdfStreams - const createSpy = vi.spyOn(store, 'create') - - const client = await connect(endpoint) - client.send( - JSON.stringify({ - id: 30, - method: 'Page.printToPDF', - params: { transferMode: 'ReturnAsStream' } - }) - ) - await new Promise((resolve) => setTimeout(resolve, 10)) - client.close() - await new Promise((resolve) => setTimeout(resolve, 10)) - - resolvePrint(Buffer.from('%PDF-late')) - await new Promise((resolve) => setTimeout(resolve, 10)) - - expect(createSpy).not.toHaveBeenCalled() - createSpy.mockRestore() - }) - - it('forwards non-PDF IO streams to the debugger', async () => { - mock.webContents.debugger.sendCommand - .mockResolvedValueOnce({ data: 'trace-data', eof: false }) - .mockResolvedValueOnce({}) - const client = await connect(endpoint) - - const readResponse = await sendAndReceive(client, { - id: 28, - method: 'IO.read', - params: { handle: 'trace-stream', size: 64 } - }) - const closeResponse = await sendAndReceive(client, { - id: 29, - method: 'IO.close', - params: { handle: 'trace-stream' } - }) - - expect(readResponse).toEqual({ id: 28, result: { data: 'trace-data', eof: false } }) - expect(closeResponse).toEqual({ id: 29, result: {} }) - expect(mock.webContents.debugger.sendCommand).toHaveBeenCalledWith('IO.read', { - handle: 'trace-stream', - size: 64 - }) - expect(mock.webContents.debugger.sendCommand).toHaveBeenCalledWith('IO.close', { - handle: 'trace-stream' - }) - client.close() - }) - - it('detaches debugger and closes server on stop', async () => { - const client = await connect(endpoint) - await proxy.stop() - - expect(mock.webContents.debugger.detach).toHaveBeenCalled() - expect(proxy.getPort()).toBeGreaterThan(0) - - await new Promise((resolve) => { - client.on('close', () => resolve()) - if (client.readyState === WebSocket.CLOSED) { - resolve() - } - }) - }) - - it('detaches client websocket listeners after client close', async () => { - const client = await connect(endpoint) - const serverClient = (proxy as unknown as { client: WebSocket | null }).client - expect(serverClient).toBeTruthy() - const offSpy = vi.spyOn(serverClient!, 'off') - - client.close() - - const start = Date.now() - while ( - (proxy as unknown as { client: WebSocket | null }).client && - Date.now() - start < 2_000 - ) { - await new Promise((resolve) => setTimeout(resolve, 20)) - } - - expect((proxy as unknown as { client: WebSocket | null }).client).toBeNull() - const removedEvents = offSpy.mock.calls.map(([event]) => event) - expect(removedEvents).toEqual(expect.arrayContaining(['message', 'close'])) - offSpy.mockRestore() - }) }) diff --git a/src/main/browser/certificate-trust/browser-certificate-trust-controller.test.ts b/src/main/browser/certificate-trust/browser-certificate-trust-controller.test.ts index 97a5bee94db..edf10dbb57c 100644 --- a/src/main/browser/certificate-trust/browser-certificate-trust-controller.test.ts +++ b/src/main/browser/certificate-trust/browser-certificate-trust-controller.test.ts @@ -1,13 +1,9 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { BrowserCertificateTrustController } from './browser-certificate-trust-controller' -import { - applyProxySettingsToSession, - resetSessionProxyApplicationForTests -} from '../../network/proxy-settings' +import { resetSessionProxyApplicationForTests } from '../../network/proxy-settings' const FIRST_CERTIFICATE = certificate('first certificate') -const SECOND_CERTIFICATE = certificate('replacement certificate') let beforeRequestListener: | (( details: Electron.OnBeforeRequestListenerDetails, @@ -146,91 +142,6 @@ describe('BrowserCertificateTrustController', () => { controller.installSessionRequestGuard(browserSession) }) - it('holds requests until proxy readiness settles', async () => { - let finishWrite: (() => void) | undefined - vi.mocked(browserSession.setProxy).mockImplementationOnce( - () => new Promise((resolve) => (finishWrite = resolve)) - ) - const applying = applyProxySettingsToSession( - browserSession, - { httpProxyUrl: 'http://proxy.example:8080' }, - { env: {} } - ) - const callback = beforeRequest({ url: 'http://proxy-only.invalid/', webContentsId: guest.id }) - - await vi.waitFor(() => expect(browserSession.setProxy).toHaveBeenCalledOnce()) - expect(callback).not.toHaveBeenCalled() - finishWrite?.() - await applying - - await vi.waitFor(() => expect(callback).toHaveBeenCalledWith({})) - }) - - it('cancels requests after proxy readiness fails', async () => { - vi.mocked(browserSession.setProxy).mockRejectedValue(new Error('proxy apply failed')) - await expect( - applyProxySettingsToSession( - browserSession, - { httpProxyUrl: 'http://proxy.example:8080' }, - { env: {} } - ) - ).rejects.toThrow('proxy apply failed') - - expect( - beforeRequest({ url: 'http://proxy-only.invalid/', webContentsId: guest.id }) - ).toHaveBeenCalledWith({ cancel: true }) - }) - - it('rejects first, then trusts only the approved guest, endpoint, certificate, and error', () => { - controller.onMainFrameNavigationStarted(guest.id) - const first = certificateEvent({ controller, guest }) - - expect(first.callback).toHaveBeenCalledOnce() - expect(first.callback).toHaveBeenCalledWith(false) - expect(first.preventDefault).not.toHaveBeenCalled() - expect(controller.getFailure('page-1')).toMatchObject({ - challengeId: 'challenge-1', - browserPageId: 'page-1', - origin: 'https://localhost:3443', - displayHost: 'localhost:3443', - errorCode: -202, - canProceed: true - }) - - expect(controller.proceed('page-1', 'challenge-1')).toEqual({ ok: true }) - expect(guest.loadURL).toHaveBeenCalledWith('https://localhost:3443/app') - expect(onFailureChanged).toHaveBeenLastCalledWith(guest.id, null) - - const sameEndpoint = certificateEvent({ - controller, - guest, - url: 'wss://localhost:3443/socket' - }) - expect(sameEndpoint.preventDefault).toHaveBeenCalledOnce() - expect(sameEndpoint.callback).toHaveBeenCalledOnce() - expect(sameEndpoint.callback).toHaveBeenCalledWith(true) - - const otherTab = certificateEvent({ controller, guest: otherGuest }) - expect(otherTab.callback).toHaveBeenCalledWith(false) - expect(otherTab.preventDefault).not.toHaveBeenCalled() - - const otherPort = certificateEvent({ - controller, - guest, - url: 'https://localhost:3444/' - }) - expect(otherPort.callback).toHaveBeenCalledWith(false) - expect(otherPort.preventDefault).not.toHaveBeenCalled() - - const otherCertificate = certificateEvent({ - controller, - guest, - certificate: SECOND_CERTIFICATE - }) - expect(otherCertificate.callback).toHaveBeenCalledWith(false) - expect(otherCertificate.preventDefault).not.toHaveBeenCalled() - }) - it('blocks a session-cached certificate for sibling requests until that guest approves it', () => { certificateEvent({ controller, guest }) expect(controller.proceed('page-1', 'challenge-1')).toEqual({ ok: true }) @@ -257,120 +168,4 @@ describe('BrowserCertificateTrustController', () => { expect(controller.proceed('page-2', 'challenge-2')).toEqual({ ok: true }) expect(beforeRequest({ webContentsId: otherGuest.id })).toHaveBeenCalledWith({}) }) - - it('fails closed when an accepted endpoint presents a replacement bad certificate', () => { - certificateEvent({ controller, guest }) - expect(controller.proceed('page-1', 'challenge-1')).toEqual({ ok: true }) - expect(certificateEvent({ controller, guest }).callback).toHaveBeenCalledWith(true) - - controller.onMainFrameNavigationStarted(guest.id) - const replacement = certificateEvent({ controller, guest, certificate: SECOND_CERTIFICATE }) - - expect(replacement.callback).toHaveBeenCalledWith(false) - expect(replacement.preventDefault).not.toHaveBeenCalled() - expect(controller.getFailure('page-1')).toBeNull() - }) - - it('rejects proceed for a second tab whose pending leaf conflicts with an accepted identity', () => { - certificateEvent({ controller, guest }) - certificateEvent({ controller, guest: otherGuest, certificate: SECOND_CERTIFICATE }) - expect(controller.getFailure('page-1')?.challengeId).toBe('challenge-1') - expect(controller.getFailure('page-2')?.challengeId).toBe('challenge-2') - - expect(controller.proceed('page-1', 'challenge-1')).toEqual({ ok: true }) - expect(controller.proceed('page-2', 'challenge-2')).toEqual({ - ok: false, - reason: 'ineligible' - }) - expect(otherGuest.loadURL).not.toHaveBeenCalled() - }) - - it('never offers approval for public hosts, non-authority failures, or subframes', () => { - for (const event of [ - certificateEvent({ controller, guest, url: 'https://example.com/' }), - certificateEvent({ controller, guest, error: 'ERR_CERT_DATE_INVALID' }), - certificateEvent({ controller, guest, isMainFrame: false }) - ]) { - expect(event.callback).toHaveBeenCalledOnce() - expect(event.callback).toHaveBeenCalledWith(false) - expect(event.preventDefault).not.toHaveBeenCalled() - } - expect(controller.getFailure('page-1')).toBeNull() - expect(onFailureChanged).not.toHaveBeenCalled() - }) - - it('queues an early challenge until the guest receives its browser page identity', () => { - pageByGuestId.set(guest.id, null) - certificateEvent({ controller, guest }) - - expect(onFailureChanged).not.toHaveBeenCalled() - expect(controller.getFailure('page-1')).toBeNull() - - pageByGuestId.set(guest.id, 'page-1') - controller.onGuestRegistered(guest.id, 'page-1') - - expect(onFailureChanged).toHaveBeenCalledWith( - guest.id, - expect.objectContaining({ challengeId: 'challenge-1', browserPageId: 'page-1' }), - 'https://localhost:3443/app' - ) - }) - - it('rejects stale, expired, destroyed, and mismatched approval attempts', () => { - certificateEvent({ controller, guest }) - - expect(controller.proceed('page-1', 'wrong-challenge')).toEqual({ - ok: false, - reason: 'changed' - }) - now += 5 * 60_000 - expect(controller.proceed('page-1', 'challenge-1')).toEqual({ - ok: false, - reason: 'expired' - }) - - certificateEvent({ controller, guest }) - vi.mocked(guest.isDestroyed).mockReturnValue(true) - expect(controller.proceed('page-1', 'challenge-2')).toEqual({ - ok: false, - reason: 'missing' - }) - expect(guest.loadURL).not.toHaveBeenCalled() - }) - - it('clears pending approval and grants when navigation or guest ownership changes', () => { - certificateEvent({ controller, guest }) - controller.onMainFrameNavigationStarted(guest.id) - expect(controller.getFailure('page-1')).toBeNull() - expect(controller.proceed('page-1', 'challenge-1')).toEqual({ - ok: false, - reason: 'missing' - }) - - certificateEvent({ controller, guest }) - expect(controller.proceed('page-1', 'challenge-2')).toEqual({ ok: true }) - controller.onMainFrameNavigationCommitted(guest.id, 'https://example.com/') - const afterCommit = certificateEvent({ controller, guest }) - expect(afterCommit.callback).toHaveBeenCalledWith(false) - - controller.onGuestRetired(guest.id) - expect(controller.getFailure('page-1')).toBeNull() - }) - - it('answers malformed and unmanaged events exactly once without overriding Electron', () => { - pageByGuestId.delete(guest.id) - const unmanaged = certificateEvent({ controller, guest }) - const malformedUrl = certificateEvent({ controller, guest: otherGuest, url: 'not a URL' }) - const malformedCertificate = certificateEvent({ - controller, - guest: otherGuest, - certificate: { data: 'not a PEM certificate' } as Electron.Certificate - }) - - for (const event of [unmanaged, malformedUrl, malformedCertificate]) { - expect(event.callback).toHaveBeenCalledOnce() - expect(event.callback).toHaveBeenCalledWith(false) - expect(event.preventDefault).not.toHaveBeenCalled() - } - }) }) diff --git a/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts b/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts index 0eb31e22308..1ff864d3832 100644 --- a/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts +++ b/src/main/browser/client-hosts/commands/browser-client-host-command-dispatcher.test.ts @@ -20,191 +20,6 @@ afterEach(() => { }) describe('BrowserClientHostCommandDispatcher', () => { - it('executes one FIFO command per page and replays duplicates exactly', async () => { - const create = deferred() - const navigate = deferred() - const handler = vi - .fn() - .mockReturnValueOnce(create.promise) - .mockReturnValueOnce(navigate.promise) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - const createCommand = command(1, 'create-a') - const navigateCommand = command(2, 'navigate-a', 'navigate') - - const creating = dispatcher.dispatch(createCommand) - const duplicateCreating = dispatcher.dispatch(createCommand) - const navigating = dispatcher.dispatch(navigateCommand) - expect(handler).toHaveBeenCalledOnce() - expect(Object.isFrozen(handler.mock.calls[0]?.[0])).toBe(true) - expect(Object.isFrozen(handler.mock.calls[0]?.[0].command)).toBe(true) - - create.resolve({ status: 'completed' }) - await expect(creating).resolves.toEqual({ status: 'completed' }) - await expect(duplicateCreating).resolves.toEqual({ status: 'completed' }) - expect(Object.isFrozen(await creating)).toBe(true) - await vi.waitFor(() => expect(handler).toHaveBeenCalledTimes(2)) - navigate.resolve({ status: 'completed' }) - await expect(navigating).resolves.toEqual({ status: 'completed' }) - await expect(dispatcher.dispatch(navigateCommand)).resolves.toEqual({ status: 'completed' }) - expect(handler).toHaveBeenCalledTimes(2) - expect(() => - dispatcher.dispatch({ - ...createCommand, - command: { - type: 'createPage', - browserProfileId: 'default', - executionHostKey: 'host-key-b' - } - }) - ).toThrow('browser_host_command_sequence_conflict') - expect(() => - dispatcher.dispatch({ - ...navigateCommand, - command: { type: 'navigate', url: 'https://different.internal' } - }) - ).toThrow('browser_host_command_sequence_conflict') - }) - - it('rejects stale authority, sequence gaps, conflicts, and non-create first commands', () => { - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler: vi.fn().mockResolvedValue({ status: 'completed' }) - }) - expect(() => - dispatcher.dispatch({ ...command(1, 'create-a'), authorityEpoch: 'epoch-b' }) - ).toThrow('browser_host_command_authority_stale') - expect(() => dispatcher.dispatch(command(1, 'navigate-a', 'navigate'))).toThrow( - 'browser_host_command_create_required' - ) - dispatcher.dispatch(command(1, 'create-a')) - expect(() => dispatcher.dispatch(command(3, 'navigate-b', 'navigate'))).toThrow( - 'browser_host_command_sequence_gap' - ) - expect(() => dispatcher.dispatch(command(1, 'different-id'))).toThrow( - 'browser_host_command_sequence_conflict' - ) - expect(() => dispatcher.dispatch(command(2, 'create-b'))).toThrow( - 'browser_host_command_create_repeated' - ) - }) - - it('snapshots lease authority instead of following caller mutation', async () => { - const mutableAuthority = { ...authority } - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority: mutableAuthority, - handler: vi.fn().mockResolvedValue({ status: 'completed' }) - }) - mutableAuthority.authorityEpoch = 'epoch-b' - - await expect(dispatcher.dispatch(command(1, 'create-a'))).resolves.toEqual({ - status: 'completed' - }) - expect(() => - dispatcher.dispatch({ ...command(2, 'navigate-a', 'navigate'), authorityEpoch: 'epoch-b' }) - ).toThrow('browser_host_command_authority_stale') - }) - - it('bounds pages, active commands, and cross-page handler concurrency', async () => { - const first = deferred() - const second = deferred() - const handler = vi.fn().mockReturnValueOnce(first.promise).mockReturnValueOnce(second.promise) - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - maxPages: 2, - maxActiveCommands: 2, - maxConcurrentHandlers: 1 - }) - const pageA = dispatcher.dispatch(command(1, 'create-a')) - const pageB = dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-b')) - - expect(handler).toHaveBeenCalledOnce() - expect(() => dispatcher.dispatch(command(2, 'navigate-b', 'navigate', 'page-b'))).toThrow( - 'browser_host_command_capacity' - ) - expect(() => dispatcher.dispatch(command(1, 'create-c', 'createPage', 'page-c'))).toThrow( - 'browser_host_page_capacity' - ) - first.resolve({ status: 'completed' }) - await pageA - await vi.waitFor(() => expect(handler).toHaveBeenCalledTimes(2)) - second.resolve({ status: 'completed' }) - await pageB - }) - - it('aborts and joins exact page retirement before admitting a new generation', async () => { - const handler = vi - .fn() - .mockImplementationOnce((_event: BrowserClientHostCommandEvent, signal: AbortSignal) => { - return new Promise((resolve) => { - signal.addEventListener('abort', () => resolve({ status: 'completed' }), { once: true }) - }) - }) - .mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - const running = dispatcher.dispatch(command(1, 'create-a')) - const retirement = dispatcher.retirePage('page-a', 1) - - await expect(running).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_host_command_cancelled' - }) - await expect(retirement).resolves.toBe(true) - expect(() => dispatcher.dispatch(command(1, 'stale-a'))).toThrow( - 'browser_host_page_generation_stale' - ) - await dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-a', 2)) - expect(handler).toHaveBeenCalledTimes(2) - }) - - it('does not consume page authority when admission fails', async () => { - const first = deferred() - const handler = vi.fn().mockReturnValueOnce(first.promise).mockResolvedValue({ - status: 'completed' - }) - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - maxPages: 2, - maxActiveCommands: 1 - }) - - expect(() => dispatcher.dispatch(command(1, 'invalid-a', 'navigate', 'page-a'))).toThrow( - 'browser_host_command_create_required' - ) - const running = dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-b')) - expect(() => dispatcher.dispatch(command(1, 'create-c', 'createPage', 'page-c'))).toThrow( - 'browser_host_command_capacity' - ) - first.resolve({ status: 'completed' }) - await running - await expect( - dispatcher.dispatch(command(1, 'create-c', 'createPage', 'page-c')) - ).resolves.toEqual({ status: 'completed' }) - }) - - it('fails a create dependency once and never runs later page commands', async () => { - const handler = vi.fn().mockImplementationOnce(() => { - throw new Error('create failed') - }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - const create = dispatcher.dispatch(command(1, 'create-a')) - const navigate = dispatcher.dispatch(command(2, 'navigate-a', 'navigate')) - - await expect(create).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_host_command_failed' - }) - await expect(navigate).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_host_command_dependency_failed' - }) - expect(() => dispatcher.dispatch(command(3, 'navigate-b', 'navigate'))).toThrow( - 'browser_host_command_dependency_failed' - ) - expect(handler).toHaveBeenCalledOnce() - }) - it('keeps a timed-out retirement fenced until its handler actually settles', async () => { vi.useFakeTimers() const stuck = deferred() @@ -231,161 +46,6 @@ describe('BrowserClientHostCommandDispatcher', () => { await dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-a', 2)) }) - it('installs the retirement join before synchronously entering the handler', async () => { - vi.useFakeTimers() - const stuck = deferred() - let retirement: Promise | undefined - let dispatcher: BrowserClientHostCommandDispatcher - const handler = vi.fn(() => { - retirement = dispatcher.retirePage('page-a', 1) - return stuck.promise - }) - dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - joinTimeoutMs: 50 - }) - const running = dispatcher.dispatch(command(1, 'create-a')) - await vi.advanceTimersByTimeAsync(50) - - await expect(retirement).resolves.toBe(false) - await expect(running).resolves.toMatchObject({ errorCode: 'browser_host_command_cancelled' }) - expect(() => dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-a', 2))).toThrow( - 'browser_host_page_retirement_pending' - ) - stuck.resolve({ status: 'completed' }) - await vi.runAllTimersAsync() - }) - - it('publishes one shared retirement before an abort listener can reenter', async () => { - vi.useFakeTimers() - const stuck = deferred() - let reentrantRetirement: Promise | undefined - let dispatcher: BrowserClientHostCommandDispatcher - const handler = vi.fn((_event: BrowserClientHostCommandEvent, signal: AbortSignal) => { - signal.addEventListener( - 'abort', - () => { - reentrantRetirement = dispatcher.retirePage('page-a', 1) - }, - { once: true } - ) - return stuck.promise - }) - dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - joinTimeoutMs: 50 - }) - const running = dispatcher.dispatch(command(1, 'create-a')) - const retirement = dispatcher.retirePage('page-a', 1) - - expect(reentrantRetirement).toBeDefined() - expect(vi.getTimerCount()).toBe(1) - await vi.advanceTimersByTimeAsync(50) - await expect(retirement).resolves.toBe(false) - await expect(reentrantRetirement).resolves.toBe(false) - await expect(running).resolves.toMatchObject({ errorCode: 'browser_host_command_cancelled' }) - stuck.resolve({ status: 'completed' }) - await vi.runAllTimersAsync() - }) - - it('removes a retired queued generation before scheduling its replacement', async () => { - const first = deferred() - const handler = vi.fn().mockReturnValueOnce(first.promise).mockResolvedValue({ - status: 'completed' - }) - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - maxConcurrentHandlers: 1 - }) - const pageA = dispatcher.dispatch(command(1, 'create-a')) - const oldPageB = dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-b')) - - await expect(dispatcher.retirePage('page-b', 1)).resolves.toBe(true) - await expect(oldPageB).resolves.toMatchObject({ errorCode: 'browser_host_command_cancelled' }) - const newPageB = dispatcher.dispatch(command(1, 'create-c', 'createPage', 'page-b', 2)) - first.resolve({ status: 'completed' }) - - await pageA - await expect(newPageB).resolves.toEqual({ status: 'completed' }) - expect(handler).toHaveBeenCalledTimes(2) - }) - - it('retains a global stale-generation floor after forgetting retired page state', async () => { - const handler = vi.fn().mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - await dispatcher.dispatch(command(1, 'create-a')) - await dispatcher.retirePage('page-a', 1) - expect(dispatcher.forgetPage('page-a', 1)).toBe(true) - - expect(() => dispatcher.dispatch(command(1, 'replayed-a'))).toThrow( - 'browser_host_page_generation_stale' - ) - await expect( - dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-b', 2)) - ).resolves.toEqual({ status: 'completed' }) - expect(handler).toHaveBeenCalledTimes(2) - }) - - it('expires old cached results instead of replaying unknown side effects', async () => { - const handler = vi.fn().mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - maxCachedResultsPerPage: 1 - }) - const create = command(1, 'create-a') - const firstNavigation = command(2, 'navigate-a', 'navigate') - const secondNavigation = command(3, 'navigate-b', 'navigate') - await dispatcher.dispatch(create) - await dispatcher.dispatch(firstNavigation) - await dispatcher.dispatch(secondNavigation) - - await expect(dispatcher.dispatch(secondNavigation)).resolves.toEqual({ status: 'completed' }) - expect(() => dispatcher.dispatch(firstNavigation)).toThrow( - 'browser_host_command_result_expired' - ) - expect(handler).toHaveBeenCalledTimes(3) - }) - - it('bounds cached results across pages, not only within each page', async () => { - const handler = vi.fn().mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - maxCachedResultsPerPage: 2, - maxCachedCommandResults: 2 - }) - const createA = command(1, 'create-a') - const navigateA = command(2, 'navigate-a', 'navigate') - await dispatcher.dispatch(createA) - await dispatcher.dispatch(navigateA) - await dispatcher.dispatch(command(1, 'create-b', 'createPage', 'page-b')) - - await expect(dispatcher.dispatch(navigateA)).resolves.toEqual({ status: 'completed' }) - expect(() => dispatcher.dispatch(createA)).toThrow('browser_host_command_result_expired') - expect(handler).toHaveBeenCalledTimes(3) - }) - - it('releases a retired generation cache before charging its replacement', async () => { - const handler = vi.fn().mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler, - maxCachedCommandResults: 2 - }) - const pageB = command(1, 'create-b', 'createPage', 'page-b') - await dispatcher.dispatch(pageB) - await dispatcher.dispatch(command(1, 'create-a')) - await dispatcher.retirePage('page-a', 1) - await dispatcher.dispatch(command(1, 'create-c', 'createPage', 'page-a', 2)) - - await expect(dispatcher.dispatch(pageB)).resolves.toEqual({ status: 'completed' }) - expect(handler).toHaveBeenCalledTimes(3) - }) - it('bounds close while canceling queued and non-cooperative handlers', async () => { vi.useFakeTimers() const stuck = deferred() diff --git a/src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts index 74662abe21d..6506994f0e3 100644 --- a/src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-buffer-retention.test.ts @@ -11,7 +11,6 @@ import { createCommand, createHarness } from '../../client-pages/execution/browser-client-page-command-executor-test-harness' -import { executeBrowserClientUploadCommand } from './browser-client-upload-command' import { BrowserClientUploadStaging } from './browser-client-upload-staging' import { BROWSER_CLIENT_FILE_CHANNEL_READ_METHOD, @@ -190,27 +189,3 @@ it.each(['resolve', 'reject', 'page-release'] as const)( } } ) - -it('keeps the original guest error and caller paths when a staged upload fails', async () => { - const services = fileServices(stagingRoot) - const params = { element: '#upload', files: [...remotePaths] } - const failure = new Error('controlled guest failure') - await expect( - executeBrowserClientUploadCommand({ - event: createCommand('createPage', { - command: { type: 'automation', method: 'browser.upload', params } - }), - params, - fileChannel: services.transport, - staging: services.staging, - run: async (rewritten) => { - expect(rewritten).not.toBe(params) - await expectStagedBytes(readBrowserClientUploadPaths(rewritten)) - throw failure - } - }) - ).rejects.toBe(failure) - expect(params).toEqual({ element: '#upload', files: remotePaths }) - expect(services.staging.activeStagingCount()).toBe(0) - expect(await readdir(stagingRoot)).toHaveLength(0) -}) diff --git a/src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.test.ts b/src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.test.ts index ff71dab3de1..0dc2a2fa29a 100644 --- a/src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.test.ts +++ b/src/main/browser/client-hosts/file-transfers/browser-client-upload-staging.test.ts @@ -1,14 +1,9 @@ import { existsSync } from 'node:fs' -import { mkdir, mkdtemp, readFile, readdir, realpath, rm, writeFile } from 'node:fs/promises' +import { mkdir, mkdtemp, realpath, rm, writeFile } from 'node:fs/promises' import { tmpdir } from 'node:os' import path from 'node:path' import { afterEach, beforeEach, describe, expect, it } from 'vitest' - -import { - BROWSER_CLIENT_UPLOAD_STAGING_MAX_BYTES_PER_PAGE, - BROWSER_CLIENT_UPLOAD_STAGING_MAX_COMMANDS_PER_PAGE, - BrowserClientUploadStaging -} from './browser-client-upload-staging' +import { BrowserClientUploadStaging } from './browser-client-upload-staging' let stagingRoot = '' @@ -21,186 +16,7 @@ afterEach(async () => { await rm(stagingRoot, { recursive: true, force: true }) }) -async function releaseFailures(release: Promise): Promise { - const failure = await release.catch((error: unknown) => error) - expect(failure).toBeInstanceOf(AggregateError) - return (failure as AggregateError).errors.map((error: Error) => error.message) -} - describe('BrowserClientUploadStaging', () => { - it('writes remote bytes under main-owned directories and keeps the remote basename', async () => { - const staging = new BrowserClientUploadStaging(stagingRoot) - - const staged = await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 3, - files: [ - { remotePath: 'docs/report.pdf', contents: Buffer.from('one') }, - { remotePath: 'notes.txt', contents: Buffer.from('two') } - ] - }) - - expect(staged.localFilePaths.map((file) => path.basename(file))).toEqual([ - 'report.pdf', - 'notes.txt' - ]) - for (const file of staged.localFilePaths) { - expect(await realpath(file)).toContain(stagingRoot) - } - expect(await readFile(staged.localFilePaths[0], 'utf8')).toBe('one') - expect(await readFile(staged.localFilePaths[1], 'utf8')).toBe('two') - }) - - it('never lets a remote path escape the staging root', async () => { - const staging = new BrowserClientUploadStaging(stagingRoot) - - const staged = await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: '../../../etc/passwd', contents: Buffer.from('x') }] - }) - - expect(path.basename(staged.localFilePaths[0])).toBe('passwd') - expect(path.resolve(staged.localFilePaths[0]).startsWith(stagingRoot)).toBe(true) - }) - - it('removes the staged directory when the page is released', async () => { - const staging = new BrowserClientUploadStaging(stagingRoot) - const staged = await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 4, - files: [{ remotePath: 'a.txt', contents: Buffer.from('a') }] - }) - - expect(await staging.releasePage('page-2')).toBe(0) - expect(await readdir(stagingRoot)).toHaveLength(1) - - expect(await staging.releasePage('page-1')).toBe(1) - expect(await readdir(stagingRoot)).toHaveLength(0) - expect(staging.stagedDirectory(staged.stagingId)).toBeUndefined() - }) - - it('releases only the matching page generation when one is named', async () => { - const staging = new BrowserClientUploadStaging(stagingRoot) - await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'a.txt', contents: Buffer.from('a') }] - }) - await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 2, - files: [{ remotePath: 'b.txt', contents: Buffer.from('b') }] - }) - - expect(await staging.releasePage('page-1', 1)).toBe(1) - expect(staging.activeStagingCount()).toBe(1) - }) - - it('evicts a page oldest-first once its staged bytes exceed the budget', async () => { - const removed: string[] = [] - const staging = new BrowserClientUploadStaging(stagingRoot, { - mkdir: async () => {}, - writeFile: async () => {}, - removeDirectorySync: () => {}, - removeDirectory: async (directory) => { - removed.push(directory) - } - }) - const half = BROWSER_CLIENT_UPLOAD_STAGING_MAX_BYTES_PER_PAGE / 2 - const first = await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'a.bin', contents: Buffer.alloc(half) }] - }) - const firstDirectory = staging.stagedDirectory(first.stagingId) - await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'b.bin', contents: Buffer.alloc(half) }] - }) - expect(staging.activeStagingCount()).toBe(2) - - await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'c.bin', contents: Buffer.alloc(1) }] - }) - - expect(staging.activeStagingCount()).toBe(2) - expect(removed).toEqual([firstDirectory]) - }) - - it("leaves another page's staged copies alone when one page overflows", async () => { - const staging = new BrowserClientUploadStaging(stagingRoot) - await staging.stage({ - browserPageId: 'page-2', - pageHostGeneration: 1, - files: [{ remotePath: 'keep.txt', contents: Buffer.from('keep') }] - }) - for (let index = 0; index <= BROWSER_CLIENT_UPLOAD_STAGING_MAX_COMMANDS_PER_PAGE; index += 1) { - await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: `${index}.txt`, contents: Buffer.from('x') }] - }) - } - - expect(staging.activeStagingCount()).toBe( - BROWSER_CLIENT_UPLOAD_STAGING_MAX_COMMANDS_PER_PAGE + 1 - ) - expect(await staging.releasePage('page-2')).toBe(1) - }) - - it('cleans up the partial directory when a write fails', async () => { - let writes = 0 - const staging = new BrowserClientUploadStaging(stagingRoot, { - mkdir: async () => {}, - writeFile: async () => { - writes += 1 - throw new Error('disk full') - }, - removeDirectorySync: () => {}, - removeDirectory: async () => {} - }) - - await expect( - staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'a.txt', contents: Buffer.from('a') }] - }) - ).rejects.toThrow('disk full') - expect(writes).toBe(1) - expect(staging.activeStagingCount()).toBe(0) - }) - - it('rejects an oversized or over-counted staging request before touching disk', async () => { - const staging = new BrowserClientUploadStaging(stagingRoot) - - await expect( - staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: Array.from({ length: 17 }, (_unused, index) => ({ - remotePath: `${index}.txt`, - contents: Buffer.alloc(1) - })) - }) - ).rejects.toThrow('browser_client_upload_file_count_exceeded') - - await expect( - staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'big.bin', contents: Buffer.alloc(64 * 1024 * 1024 + 1) }] - }) - ).rejects.toThrow('browser_client_upload_too_large') - - expect(staging.activeStagingCount()).toBe(0) - expect(existsSync(stagingRoot)).toBe(false) - }) - it('sweeps staged bytes an abnormal exit left in the root', async () => { const orphan = path.join(stagingRoot, 'abandoned', '0') await mkdir(orphan, { recursive: true }) @@ -210,88 +26,4 @@ describe('BrowserClientUploadStaging', () => { expect(existsSync(path.join(stagingRoot, 'abandoned'))).toBe(false) }) - - it('keeps the staged record when its removal fails so a later release retries it', async () => { - const attempts: string[] = [] - const staging = new BrowserClientUploadStaging(stagingRoot, { - mkdir: async () => {}, - writeFile: async () => {}, - removeDirectorySync: () => {}, - removeDirectory: async (directory) => { - attempts.push(directory) - if (attempts.length === 1) { - throw new Error('EBUSY: resource busy or locked') - } - } - }) - const staged = await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'a.txt', contents: Buffer.from('a') }] - }) - const directory = staging.stagedDirectory(staged.stagingId) - - expect(await releaseFailures(staging.releasePage('page-1'))).toEqual([ - expect.stringContaining('EBUSY') - ]) - expect(staging.activeStagingCount()).toBe(1) - - expect(await staging.releasePage('page-1')).toBe(1) - expect(staging.activeStagingCount()).toBe(0) - expect(attempts).toEqual([directory, directory]) - }) - - it('attempts every staged record even when one removal fails', async () => { - const attempts: string[] = [] - const staging = new BrowserClientUploadStaging(stagingRoot, { - mkdir: async () => {}, - writeFile: async () => {}, - removeDirectorySync: () => {}, - removeDirectory: async (directory) => { - attempts.push(directory) - if (attempts.length === 1) { - throw new Error('EBUSY: resource busy or locked') - } - } - }) - const first = await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'a.txt', contents: Buffer.from('a') }] - }) - const second = await staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'b.txt', contents: Buffer.from('b') }] - }) - const directories = [first, second].map((staged) => staging.stagedDirectory(staged.stagingId)) - - expect(await releaseFailures(staging.releasePage('page-1'))).toHaveLength(1) - - expect(attempts).toEqual(directories) - expect(staging.activeStagingCount()).toBe(1) - }) - - it('reports the staging failure, not the cleanup failure, when both fail', async () => { - const staging = new BrowserClientUploadStaging(stagingRoot, { - mkdir: async () => {}, - writeFile: async () => { - throw new Error('disk full') - }, - removeDirectorySync: () => {}, - removeDirectory: async () => { - throw new Error('EBUSY: resource busy or locked') - } - }) - - await expect( - staging.stage({ - browserPageId: 'page-1', - pageHostGeneration: 1, - files: [{ remotePath: 'a.txt', contents: Buffer.from('a') }] - }) - ).rejects.toThrow('disk full') - // A later release needs the retained directory record to retry cleanup. - expect(staging.activeStagingCount()).toBe(1) - }) }) diff --git a/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts deleted file mode 100644 index 6148fe6d3b4..00000000000 --- a/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease-reconnect.test.ts +++ /dev/null @@ -1,537 +0,0 @@ -import { pairedRuntimeConnectionFromOffer } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' -import { afterEach, describe, expect, it, vi } from 'vitest' -import type { PairingOffer } from '../../../../shared/remote-runtime/pairing/mobile-relay-pairing-offer' -import type { - RemoteRuntimeSubscription, - RemoteRuntimeSubscriptionCallbacks -} from '../../../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' -import type { BrowserClientAutomationResult as BrowserClientHostCommandResult } from '../../../../shared/browser/client-hosting/browser-client-automation-protocol' - -const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ - subscribeRemoteRuntimeRequestMock: vi.fn() -})) - -vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ - subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock -})) - -import { PairedRuntimeBrowserHostLease } from './paired-runtime-browser-host-lease' -import type { PairedRuntimeBrowserHostLeaseOptions } from './paired-runtime-browser-host-lease-options' - -const pairing = { - v: 2, - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'device-token', - publicKeyB64: 'public-key', - pairedDeviceId: 'device-a', - scope: 'runtime' -} as PairingOffer - -afterEach(() => { - subscribeRemoteRuntimeRequestMock.mockReset() - vi.restoreAllMocks() - vi.useRealTimers() -}) - -describe('PairedRuntimeBrowserHostLease reconnect', () => { - it('retries initial runtime_busy admission and attaches when capacity returns', async () => { - vi.useFakeTimers() - const attempts = mockAttempts() - const onError = vi.fn() - const onReconnected = vi.fn() - const onTransportLost = vi.fn() - const lease = createReconnectLease({ - timeoutMs: 500, - reconnectRetryDelayMs: 50, - onError, - onReconnected, - onTransportLost - }) - const starting = lease.start() - void starting.catch(() => undefined) - await Promise.resolve() - - attempts[0]!.callbacks.onError(capacityError()) - await vi.advanceTimersByTimeAsync(50) - expect(attempts).toHaveLength(2) - attempts[1]!.callbacks.onResponse(readyResponse(true)) - - await expect(starting).resolves.toMatchObject({ browserHostGeneration: 4 }) - expect(attempts[0]!.close).toHaveBeenCalledOnce() - expect(onTransportLost).not.toHaveBeenCalled() - expect(onReconnected).not.toHaveBeenCalled() - expect(onError).not.toHaveBeenCalled() - await lease.close() - expect(attempts[1]!.close).toHaveBeenCalledOnce() - expect(vi.getTimerCount()).toBe(0) - }) - - it('bounds initial runtime_busy retries and releases every attempt', async () => { - vi.useFakeTimers() - const closes: ReturnType[] = [] - subscribeRemoteRuntimeRequestMock.mockImplementation( - async (...args: unknown[]): Promise => { - const callbacks = args[4] as RemoteRuntimeSubscriptionCallbacks - const close = vi.fn() - closes.push(close) - queueMicrotask(() => callbacks.onError(capacityError())) - return { - requestId: `browser-host-${closes.length}`, - close, - sendBinary: () => false - } - } - ) - const onError = vi.fn() - const lease = createReconnectLease({ - timeoutMs: 250, - reconnectRetryDelayMs: 50, - onError - }) - const starting = lease.start() - void starting.catch(() => undefined) - - await vi.advanceTimersByTimeAsync(300) - - await expect(starting).rejects.toThrow('attach capacity retry expired') - expect(closes.length).toBeGreaterThan(1) - expect(closes.every((close) => close.mock.calls.length === 1)).toBe(true) - expect(onError).toHaveBeenCalledOnce() - expect(vi.getTimerCount()).toBe(0) - }) - - it('cancels initial admission backoff without retaining a subscription', async () => { - vi.useFakeTimers() - const attempts = mockAttempts() - const onError = vi.fn() - const lease = createReconnectLease({ - timeoutMs: 500, - reconnectRetryDelayMs: 50, - onError - }) - const starting = lease.start() - void starting.catch(() => undefined) - await Promise.resolve() - - attempts[0]!.callbacks.onError(capacityError()) - await vi.advanceTimersByTimeAsync(0) - await lease.close() - - await expect(starting).rejects.toThrow('Browser host lease is closed') - await vi.advanceTimersByTimeAsync(500) - expect(attempts).toHaveLength(1) - expect(attempts[0]!.close).toHaveBeenCalledOnce() - expect(onError).not.toHaveBeenCalled() - expect(vi.getTimerCount()).toBe(0) - }) - - it('restores exact authority across repeated loss and ignores stale callbacks', async () => { - const attempts = mockAttempts() - const onTransportLost = vi.fn() - const onReconnected = vi.fn() - const onError = vi.fn() - const lease = createReconnectLease({ onTransportLost, onReconnected, onError }) - const starting = lease.start() - await vi.waitFor(() => expect(attempts).toHaveLength(1)) - attempts[0]!.callbacks.onResponse(readyResponse(true)) - const authority = await starting - - attempts[0]!.callbacks.onError(recoverableError()) - attempts[0]!.callbacks.onClose?.() - await vi.waitFor(() => expect(attempts).toHaveLength(2)) - attempts[1]!.callbacks.onResponse(readyResponse(true)) - await vi.waitFor(() => expect(onReconnected).toHaveBeenCalledOnce()) - - attempts[0]!.callbacks.onResponse(readyResponse(true, 9)) - attempts[0]!.callbacks.onError(recoverableError()) - attempts[1]!.callbacks.onError(recoverableError()) - await vi.waitFor(() => expect(attempts).toHaveLength(3)) - attempts[2]!.callbacks.onResponse(readyResponse(true)) - await vi.waitFor(() => expect(onReconnected).toHaveBeenCalledTimes(2)) - - expect(onTransportLost).toHaveBeenCalledTimes(2) - expect(onReconnected).toHaveBeenCalledWith(authority) - expect(onError).not.toHaveBeenCalled() - expect(attempts[0]!.close).toHaveBeenCalledOnce() - await lease.close() - expect(attempts[1]!.close).toHaveBeenCalledOnce() - expect(attempts[2]!.close).toHaveBeenCalledOnce() - }) - - it('retries runtime_busy during reconnect grace without replacing authority', async () => { - vi.useFakeTimers() - const attempts = mockAttempts() - const onError = vi.fn() - const onReconnected = vi.fn() - const lease = createReconnectLease({ - reconnectGraceMs: 500, - reconnectRetryDelayMs: 50, - timeoutMs: 100, - onError, - onReconnected - }) - const starting = lease.start() - await Promise.resolve() - attempts[0]!.callbacks.onResponse(readyResponse(true)) - const authority = await starting - - attempts[0]!.callbacks.onError(recoverableError()) - await vi.advanceTimersByTimeAsync(50) - expect(attempts).toHaveLength(2) - attempts[1]!.callbacks.onError(capacityError()) - await vi.advanceTimersByTimeAsync(100) - expect(attempts).toHaveLength(3) - attempts[2]!.callbacks.onResponse(readyResponse(true)) - await vi.advanceTimersByTimeAsync(0) - - expect(onReconnected).toHaveBeenCalledWith(authority) - expect(onError).not.toHaveBeenCalled() - await lease.close() - expect(attempts.every((attempt) => attempt.close.mock.calls.length === 1)).toBe(true) - expect(vi.getTimerCount()).toBe(0) - }) - - it('does not double-charge result capacity when outstanding commands replay', async () => { - const attempts = mockAttempts() - const results = new Map([ - ['page-a', deferredCommandResult()], - ['page-b', deferredCommandResult()] - ]) - const onPageCommand = vi.fn( - (command) => - results.get(command.browserPageId)?.promise ?? Promise.reject(new Error('unknown')) - ) - const onError = vi.fn() - const lease = createReconnectLease({ - maxConcurrentCommandResults: 1, - maxUnsettledCommandResults: 2, - onPageCommand, - onError - }) - const starting = lease.start() - await vi.waitFor(() => expect(attempts).toHaveLength(1)) - attempts[0]!.callbacks.onResponse(readyResponse(true)) - await starting - - const commands = [ - commandResponse({ browserPageId: 'page-a', commandId: 'shared-command' }), - commandResponse({ - browserPageId: 'page-b', - pageHostGeneration: 2, - commandId: 'shared-command' - }) - ] - for (const command of commands) { - attempts[0]!.callbacks.onResponse(command) - } - await vi.waitFor(() => expect(onPageCommand).toHaveBeenCalledTimes(2)) - - attempts[0]!.callbacks.onError(recoverableError()) - await vi.waitFor(() => expect(attempts).toHaveLength(2)) - attempts[1]!.callbacks.onResponse(readyResponse(true)) - for (const command of commands) { - attempts[1]!.callbacks.onResponse(command) - } - await vi.waitFor(() => expect(onPageCommand).toHaveBeenCalledTimes(4)) - expect(onError).not.toHaveBeenCalled() - - results.get('page-a')!.resolve({ status: 'completed' }) - results.get('page-b')!.resolve({ status: 'completed' }) - await vi.waitFor(() => expect(attempts[1]!.sendRequest).toHaveBeenCalledTimes(2)) - expect(onError).not.toHaveBeenCalled() - await lease.close() - }) - - it('keeps missing reconnect echo on legacy immediate teardown semantics', async () => { - const attempts = mockAttempts() - const onTransportLost = vi.fn() - const onError = vi.fn() - const lease = createReconnectLease({ onTransportLost, onError }) - const starting = lease.start() - await vi.waitFor(() => expect(attempts).toHaveLength(1)) - attempts[0]!.callbacks.onResponse(readyResponse(false)) - await starting - - attempts[0]!.callbacks.onError(recoverableError()) - attempts[0]!.callbacks.onClose?.() - await vi.waitFor(() => expect(onError).toHaveBeenCalledOnce()) - - expect(onTransportLost).not.toHaveBeenCalled() - expect(attempts).toHaveLength(1) - expect(attempts[0]!.close).toHaveBeenCalledOnce() - }) - - it('rejects malformed or unsolicited reconnect echoes', async () => { - const malformedAttempts = mockAttempts() - const malformedError = vi.fn() - const malformed = createReconnectLease({ onError: malformedError }) - const malformedStart = malformed.start() - await vi.waitFor(() => expect(malformedAttempts).toHaveLength(1)) - malformedAttempts[0]!.callbacks.onResponse({ - ...readyResponse(true), - result: { - ...readyResponse(true).result, - pageInventoryProtocolVersion: undefined - } - }) - await expect(malformedStart).rejects.toThrow('Invalid browser host lease response') - - subscribeRemoteRuntimeRequestMock.mockReset() - const unsolicitedAttempts = mockAttempts() - const unsolicited = new PairedRuntimeBrowserHostLease({ - connection: pairedRuntimeConnectionFromOffer(pairing), - authorityRuntimeId: 'runtime-a', - browserHostClientId: 'host-a', - hostCapabilities: ['webview'] - }) - const unsolicitedStart = unsolicited.start() - await vi.waitFor(() => expect(unsolicitedAttempts).toHaveLength(1)) - unsolicitedAttempts[0]!.callbacks.onResponse(readyResponse(true)) - - await expect(unsolicitedStart).rejects.toThrow('Invalid browser host lease response') - }) - - it('fails terminally when a reconnect cannot encode a complete inventory', async () => { - const attempts = mockAttempts() - const getPageInventory = vi - .fn() - .mockReturnValueOnce([]) - .mockReturnValueOnce([ - { - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'host-a', - browserHostGeneration: 4, - browserPageId: 'page-a', - pageHostGeneration: 1, - browserProfileId: 'x'.repeat(400), - executionHostKey: 'native:runtime-a:1', - state: 'active' - } - ]) - const onError = vi.fn() - const lease = createReconnectLease({ getPageInventory, onError }) - const starting = lease.start() - await vi.waitFor(() => expect(attempts).toHaveLength(1)) - attempts[0]!.callbacks.onResponse(readyResponse(true)) - await starting - - attempts[0]!.callbacks.onError(recoverableError()) - await vi.waitFor(() => expect(attempts).toHaveLength(2)) - expect(attempts[1]!.params).not.toHaveProperty('pageInventoryProtocolVersion') - expect(attempts[1]!.params).not.toHaveProperty('leaseReconnectProtocolVersion') - attempts[1]!.callbacks.onResponse(readyResponse(false, 5)) - await vi.waitFor(() => expect(onError).toHaveBeenCalledOnce()) - - expect(attempts).toHaveLength(2) - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Invalid browser host lease response' }) - ) - }) - - it('rejects a reconnect that changes the exact authority', async () => { - const attempts = mockAttempts() - const onError = vi.fn() - const lease = createReconnectLease({ onError }) - const starting = lease.start() - await vi.waitFor(() => expect(attempts).toHaveLength(1)) - attempts[0]!.callbacks.onResponse(readyResponse(true)) - await starting - - attempts[0]!.callbacks.onError(recoverableError()) - await vi.waitFor(() => expect(attempts).toHaveLength(2)) - attempts[1]!.callbacks.onResponse(readyResponse(true, 5)) - await vi.waitFor(() => expect(onError).toHaveBeenCalledOnce()) - - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Browser host lease authority changed in place' }) - ) - expect(attempts[1]!.close).toHaveBeenCalledOnce() - }) - - it('treats an explicit revocation during reconnect as terminal', async () => { - const attempts = mockAttempts() - const onError = vi.fn() - const lease = createReconnectLease({ onError }) - const starting = lease.start() - await vi.waitFor(() => expect(attempts).toHaveLength(1)) - attempts[0]!.callbacks.onResponse(readyResponse(true)) - await starting - - attempts[0]!.callbacks.onError(recoverableError()) - await vi.waitFor(() => expect(attempts).toHaveLength(2)) - attempts[1]!.callbacks.onResponse({ - id: 'browser-host', - ok: true, - result: { - type: 'revoked', - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - reason: 'released' - }, - _meta: { runtimeId: 'runtime-a' } - }) - await vi.waitFor(() => expect(onError).toHaveBeenCalledOnce()) - - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Browser host lease revoked: released' }) - ) - expect(attempts[1]!.close).toHaveBeenCalledOnce() - }) - - it('expires bounded reconnect attempts without retaining timers or subscriptions', async () => { - vi.useFakeTimers() - const attempts = mockAttempts() - const onTransportLost = vi.fn() - const onError = vi.fn() - const lease = createReconnectLease({ - reconnectGraceMs: 250, - reconnectRetryDelayMs: 50, - timeoutMs: 100, - onTransportLost, - onError - }) - const starting = lease.start() - await Promise.resolve() - attempts[0]!.callbacks.onResponse(readyResponse(true)) - await starting - - attempts[0]!.callbacks.onError(recoverableError()) - await vi.advanceTimersByTimeAsync(300) - - expect(attempts).toHaveLength(3) - expect(onTransportLost).toHaveBeenCalledOnce() - expect(onError).toHaveBeenCalledOnce() - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: expect.stringContaining('reconnect grace expired') }) - ) - expect(attempts.every((attempt) => attempt.close.mock.calls.length === 1)).toBe(true) - expect(vi.getTimerCount()).toBe(0) - }) -}) - -function createReconnectLease( - overrides: Partial -): PairedRuntimeBrowserHostLease { - return new PairedRuntimeBrowserHostLease({ - connection: pairedRuntimeConnectionFromOffer(pairing), - authorityRuntimeId: 'runtime-a', - browserHostClientId: 'host-a', - hostCapabilities: ['webview'], - pageCommandProtocolVersion: 1, - pageInventoryProtocolVersion: 1, - leaseReconnectProtocolVersion: 1, - getPageInventory: () => [], - onPageCommand: () => ({ status: 'completed' }), - ...overrides - }) -} - -function mockAttempts(): { - callbacks: RemoteRuntimeSubscriptionCallbacks - close: ReturnType - params: Record - sendRequest: ReturnType -}[] { - const attempts: { - callbacks: RemoteRuntimeSubscriptionCallbacks - close: ReturnType - params: Record - sendRequest: ReturnType - }[] = [] - subscribeRemoteRuntimeRequestMock.mockImplementation( - async (...args: unknown[]): Promise => { - const close = vi.fn() - const sendRequest = vi.fn().mockResolvedValue({ - id: 'command-result', - ok: true, - result: { accepted: true }, - _meta: { runtimeId: 'runtime-a' } - }) - attempts.push({ - callbacks: args[4] as RemoteRuntimeSubscriptionCallbacks, - close, - params: args[2] as Record, - sendRequest - }) - return { - requestId: `browser-host-${attempts.length}`, - close, - sendBinary: () => false, - sendRequest - } - } - ) - return attempts -} - -function readyResponse(reconnect: boolean, browserHostGeneration = 4) { - return { - id: 'browser-host', - ok: true as const, - result: { - type: 'ready' as const, - authorityEpoch: 'epoch-a', - browserHostGeneration, - pageCommandProtocolVersion: 1 as const, - pageInventoryProtocolVersion: 1 as const, - ...(reconnect ? { leaseReconnectProtocolVersion: 1 as const } : {}) - }, - _meta: { runtimeId: 'runtime-a' } - } -} - -function recoverableError(): RemoteRuntimeClientError { - return new RemoteRuntimeClientError('remote_runtime_unavailable', 'transport failed') -} - -function capacityError(): RemoteRuntimeClientError { - return new RemoteRuntimeClientError( - 'runtime_busy', - 'browser-host capacity reached; retry with backoff' - ) -} - -function deferredCommandResult(): { - promise: Promise - resolve: (result: BrowserClientHostCommandResult) => void -} { - let resolve = (_result: BrowserClientHostCommandResult): void => {} - const promise = new Promise((innerResolve) => { - resolve = innerResolve - }) - return { promise, resolve } -} - -function commandResponse( - overrides: { - browserPageId?: string - pageHostGeneration?: number - commandId?: string - } = {} -) { - return { - id: 'browser-host', - ok: true as const, - result: { - type: 'command' as const, - pageCommandProtocolVersion: 1 as const, - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'host-a', - browserHostGeneration: 4, - browserPageId: 'page-a', - pageHostGeneration: 1, - commandSequence: 1, - commandId: 'command-a', - command: { - type: 'createPage' as const, - browserProfileId: 'default', - executionHostKey: 'native:runtime-a:1' - }, - ...overrides - }, - _meta: { runtimeId: 'runtime-a' } - } -} diff --git a/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts index 6d9985614ac..20b41ec0c35 100644 --- a/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts +++ b/src/main/browser/client-hosts/leases/paired-runtime-browser-host-lease.test.ts @@ -2,20 +2,11 @@ import { pairedRuntimeConnectionFromOffer } from '../../../../shared/remote-runt import { afterEach, describe, expect, it, vi } from 'vitest' import type { BrowserClientAutomationResult as BrowserClientHostCommandResult } from '../../../../shared/browser/client-hosting/browser-client-automation-protocol' -import { - type BrowserClientHostedPageInventory, - type BrowserClientHostCommandEvent, - BROWSER_CLIENT_HOST_PAGE_INVENTORY_MAX_BYTES, - browserClientHostedPageInventoryByteLength -} from '../../../../shared/browser/client-hosting/browser-client-host-protocol' -import { - BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, - BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY -} from '../../../../shared/browser-runtime-capabilities' import type { - RemoteRuntimeSubscription, - RemoteRuntimeSubscriptionCallbacks -} from '../../../../shared/remote-runtime/remote-runtime-client' + BrowserClientHostedPageInventory, + BrowserClientHostCommandEvent +} from '../../../../shared/browser/client-hosting/browser-client-host-protocol' +import type { RemoteRuntimeSubscription } from '../../../../shared/remote-runtime/remote-runtime-client' const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ subscribeRemoteRuntimeRequestMock: vi.fn() @@ -40,481 +31,6 @@ afterEach(() => { }) describe('PairedRuntimeBrowserHostLease', () => { - it.each([ - [{ maxConcurrentCommandResults: 17 }, 'limit is invalid'], - [{ maxUnsettledCommandResults: 257 }, 'limit is invalid'], - [{ maxConcurrentCommandResults: 2, maxUnsettledCommandResults: 1 }, 'limits are inconsistent'], - [{ getPageInventory: () => [] }, 'inventory negotiation is incomplete'], - [{ pageInventoryProtocolVersion: 1 as const }, 'inventory negotiation is incomplete'] - ])('rejects unsafe command-result limits', (limits, expectedMessage) => { - expect(() => createLease(limits)).toThrow(expectedMessage) - }) - - it('returns only the runtime-issued epoch and generation', async () => { - let callbacks: RemoteRuntimeSubscriptionCallbacks | undefined - const close = vi.fn() - subscribeRemoteRuntimeRequestMock.mockImplementationOnce( - async (...args: unknown[]): Promise => { - callbacks = args[4] as RemoteRuntimeSubscriptionCallbacks - return { requestId: 'browser-host', close, sendBinary: () => false } - } - ) - const lease = createLease() - const starting = lease.start() - await vi.waitFor(() => expect(callbacks).toBeDefined()) - callbacks!.onResponse({ - id: 'browser-host', - ok: true, - result: { type: 'ready', authorityEpoch: 'epoch-a', browserHostGeneration: 4 }, - _meta: { runtimeId: 'runtime-a' } - }) - - await expect(starting).resolves.toEqual({ - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'host-a', - browserHostGeneration: 4 - }) - expect(subscribeRemoteRuntimeRequestMock).toHaveBeenCalledWith( - pairing, - 'browser.clientHost.attach', - { - authorityRuntimeId: 'runtime-a', - browserHostClientId: 'host-a', - hostCapabilities: ['webview'] - }, - expect.any(Number), - expect.any(Object), - expect.objectContaining({ - clientCapabilities: [ - BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, - BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY - ] - }) - ) - expectInitialAttachTimeout() - await lease.close() - expect(close).toHaveBeenCalledOnce() - }) - - it('sends page metadata over its own attached connection', async () => { - const sendRequest = vi.fn().mockResolvedValue({ - ok: true, - result: { accepted: true }, - _meta: { runtimeId: 'runtime-a' } - }) - const { callbacks } = await subscribeLease({ sendRequest }) - const lease = createLease() - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - await starting - - await expect(lease.sendPageMetadataRequest({ revision: 2 }, 1_000)).resolves.toMatchObject({ - ok: true - }) - expect(sendRequest).toHaveBeenCalledWith( - 'browser.clientHost.pageMetadata', - { revision: 2 }, - 1_000 - ) - - await lease.close() - expect(() => lease.sendPageMetadataRequest({ revision: 3 }, 1_000)).toThrow( - 'Remote runtime browser host lease is unavailable.' - ) - }) - - it('uses page commands only after the host echoes the requested protocol', async () => { - const { callbacks, close, sendRequest } = await subscribeLease() - const onPageCommand = vi.fn(() => ({ status: 'completed' as const })) - const lease = createLease({ pageCommandProtocolVersion: 1, onPageCommand }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse({ - id: 'browser-host', - ok: true, - result: { - type: 'ready', - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - pageCommandProtocolVersion: 1 - }, - _meta: { runtimeId: 'runtime-a' } - }) - - await expect(starting).resolves.toMatchObject({ pageCommandProtocolVersion: 1 }) - expect(subscribeRemoteRuntimeRequestMock).toHaveBeenCalledWith( - pairing, - 'browser.clientHost.attach', - expect.objectContaining({ pageCommandProtocolVersion: 1 }), - expect.any(Number), - expect.any(Object), - expect.any(Object) - ) - expectInitialAttachTimeout() - callbacks.current!.onResponse(commandResponse()) - - expect(onPageCommand).toHaveBeenCalledOnce() - await vi.waitFor(() => expect(sendRequest).toHaveBeenCalledOnce()) - expect(sendRequest).toHaveBeenCalledWith( - 'browser.clientHost.commandResult', - { - pageCommandProtocolVersion: 1, - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'host-a', - browserHostGeneration: 4, - browserPageId: 'page-a', - pageHostGeneration: 1, - commandSequence: 1, - commandId: 'command-a', - result: { status: 'completed' } - }, - 15_000 - ) - expect(close).not.toHaveBeenCalled() - await lease.close() - }) - - it('sends one complete inventory snapshot and activates it only after the echo', async () => { - const { callbacks } = await subscribeLease() - const page = inventoryPage() - const getPageInventory = vi.fn(() => [page]) - const lease = createLease({ - pageInventoryProtocolVersion: 1, - getPageInventory - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - - expect(getPageInventory).toHaveBeenCalledOnce() - expect(subscribeRemoteRuntimeRequestMock).toHaveBeenCalledWith( - pairing, - 'browser.clientHost.attach', - expect.objectContaining({ - pageInventoryProtocolVersion: 1, - pageInventory: [page] - }), - expect.any(Number), - expect.any(Object), - expect.any(Object) - ) - expectInitialAttachTimeout() - callbacks.current!.onResponse(readyResponse({ pageInventoryProtocolVersion: 1 })) - - await expect(starting).resolves.toMatchObject({ pageInventoryProtocolVersion: 1 }) - await lease.close() - }) - - it('omits optional URLs deterministically to keep every page identity within budget', async () => { - const { callbacks } = await subscribeLease() - const inventory = Array.from({ length: 256 }, (_, index) => ({ - ...inventoryPage(), - browserPageId: `page-${index.toString().padStart(3, '0')}`, - currentUrl: `https://remote.internal/${index}/${'x'.repeat(4096)}` - })) - const lease = createLease({ - pageInventoryProtocolVersion: 1, - getPageInventory: () => inventory - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - const attach = subscribeRemoteRuntimeRequestMock.mock.calls[0]?.[2] as { - pageInventory: BrowserClientHostedPageInventory[] - } - - expect(attach.pageInventory).toHaveLength(256) - expect(browserClientHostedPageInventoryByteLength(attach.pageInventory)).toBeLessThanOrEqual( - BROWSER_CLIENT_HOST_PAGE_INVENTORY_MAX_BYTES - ) - expect(attach.pageInventory.some((page) => page.currentUrl === undefined)).toBe(true) - expect(new Set(attach.pageInventory.map((page) => page.browserPageId)).size).toBe(256) - callbacks.current!.onResponse(readyResponse({ pageInventoryProtocolVersion: 1 })) - await starting - await lease.close() - }) - - it('treats a missing inventory echo as unsupported rather than accepted empty state', async () => { - const { callbacks } = await subscribeLease() - const lease = createLease({ - pageInventoryProtocolVersion: 1, - getPageInventory: () => [] - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - - await expect(starting).resolves.not.toHaveProperty('pageInventoryProtocolVersion') - expect(subscribeRemoteRuntimeRequestMock).toHaveBeenCalledWith( - pairing, - 'browser.clientHost.attach', - expect.objectContaining({ pageInventoryProtocolVersion: 1, pageInventory: [] }), - expect.any(Number), - expect.any(Object), - expect.any(Object) - ) - expectInitialAttachTimeout() - await lease.close() - }) - - it('rejects an unsolicited inventory echo', async () => { - const { callbacks } = await subscribeLease() - const lease = createLease() - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageInventoryProtocolVersion: 1 })) - - await expect(starting).rejects.toThrow('Invalid browser host lease response') - await lease.close() - }) - - it.each([ - ['completed', { status: 'completed' } as const], - ['failed', { status: 'failed', errorCode: 'navigation_failed' } as const] - ])('submits a validated %s page command result', async (_caseName, result) => { - const { callbacks, close, sendRequest } = await subscribeLease() - const lease = createLease({ - pageCommandProtocolVersion: 1, - onPageCommand: () => result - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageCommandProtocolVersion: 1 })) - await starting - - callbacks.current!.onResponse(commandResponse()) - - await vi.waitFor(() => - expect(sendRequest).toHaveBeenCalledWith( - 'browser.clientHost.commandResult', - expect.objectContaining({ result }), - 15_000 - ) - ) - expect(close).not.toHaveBeenCalled() - await lease.close() - }) - - it('accepts exact duplicate result acknowledgement without fencing the lease', async () => { - const { callbacks, close, sendRequest } = await subscribeLease() - sendRequest - .mockResolvedValueOnce(commandResultAck(true)) - .mockResolvedValueOnce(commandResultAck(false)) - const lease = createLease({ - pageCommandProtocolVersion: 1, - onPageCommand: () => ({ status: 'completed' }) - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageCommandProtocolVersion: 1 })) - await starting - - callbacks.current!.onResponse(commandResponse()) - await vi.waitFor(() => expect(sendRequest).toHaveBeenCalledTimes(1)) - callbacks.current!.onResponse(commandResponse()) - - await vi.waitFor(() => expect(sendRequest).toHaveBeenCalledTimes(2)) - expect(close).not.toHaveBeenCalled() - await lease.close() - }) - - it('bounds concurrent command-result requests below the subscription request ceiling', async () => { - const acknowledgements = Array.from({ length: 8 }, () => deferredCommandResultAck()) - let active = 0 - let peak = 0 - const sendRequest = vi.fn().mockImplementation(() => { - const acknowledgement = acknowledgements[sendRequest.mock.calls.length - 1] - active += 1 - peak = Math.max(peak, active) - return acknowledgement.promise.finally(() => { - active -= 1 - }) - }) - const { callbacks } = await subscribeLease({ sendRequest }) - const lease = createLease({ - maxConcurrentCommandResults: 4, - pageCommandProtocolVersion: 1, - onPageCommand: () => ({ status: 'completed' }) - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageCommandProtocolVersion: 1 })) - await starting - - for (let index = 0; index < acknowledgements.length; index += 1) { - callbacks.current!.onResponse( - commandResponse({ - browserPageId: `page-${index}`, - pageHostGeneration: index + 1, - commandId: `command-${index}` - }) - ) - } - - await vi.waitFor(() => expect(sendRequest).toHaveBeenCalledTimes(4)) - expect(peak).toBe(4) - acknowledgements[0].resolve(commandResultAck(true)) - await vi.waitFor(() => expect(sendRequest).toHaveBeenCalledTimes(5)) - expect(peak).toBe(4) - await lease.close() - }) - - it('fails closed when unsettled command results exceed the explicit lease bound', async () => { - const never = new Promise(() => {}) - const { callbacks, close } = await subscribeLease({ - sendRequest: vi.fn(() => never) - }) - const onError = vi.fn() - const lease = createLease({ - maxConcurrentCommandResults: 1, - maxUnsettledCommandResults: 2, - pageCommandProtocolVersion: 1, - onPageCommand: () => ({ status: 'completed' }), - onError - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageCommandProtocolVersion: 1 })) - await starting - - for (let index = 0; index < 3; index += 1) { - callbacks.current!.onResponse( - commandResponse({ - browserPageId: `page-${index}`, - pageHostGeneration: index + 1, - commandId: `command-${index}` - }) - ) - } - - await vi.waitFor(() => expect(close).toHaveBeenCalledOnce()) - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Browser host command result capacity reached' }) - ) - }) - - it.each([ - [ - 'server rejection', - vi.fn().mockResolvedValue({ - id: 'command-result', - ok: false, - error: { code: 'runtime_error', message: 'command result rejected' }, - _meta: { runtimeId: 'runtime-a' } - }), - 'command result rejected' - ], - [ - 'transport timeout', - vi.fn().mockRejectedValue(new Error('command result timed out')), - 'command result timed out' - ], - [ - 'malformed acknowledgement', - vi.fn().mockResolvedValue({ - id: 'command-result', - ok: true, - result: { accepted: 'yes' }, - _meta: { runtimeId: 'runtime-a' } - }), - 'Invalid browser host command result acknowledgement' - ], - [ - 'wrong runtime acknowledgement', - vi.fn().mockResolvedValue(commandResultAck(true, 'runtime-b')), - 'Invalid browser host command result acknowledgement' - ] - ])('fails closed on %s', async (_caseName, sendRequest, expectedMessage) => { - const { callbacks, close } = await subscribeLease({ sendRequest }) - const onError = vi.fn() - const lease = createLease({ - pageCommandProtocolVersion: 1, - onPageCommand: () => ({ status: 'completed' }), - onError - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageCommandProtocolVersion: 1 })) - await starting - - callbacks.current!.onResponse(commandResponse()) - - await vi.waitFor(() => expect(close).toHaveBeenCalledOnce()) - expect(onError).toHaveBeenCalledWith(expect.objectContaining({ message: expectedMessage })) - }) - - it('fails closed when a v1 subscription lacks the same-socket request sender', async () => { - const { callbacks, close } = await subscribeLease({ sendRequest: undefined }) - const onError = vi.fn() - const lease = createLease({ - pageCommandProtocolVersion: 1, - onPageCommand: () => ({ status: 'completed' }), - onError - }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageCommandProtocolVersion: 1 })) - - await expect(starting).rejects.toThrow('Browser host command result transport unavailable') - await vi.waitFor(() => expect(close).toHaveBeenCalledOnce()) - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Browser host command result transport unavailable' }) - ) - }) - - it.each([ - [ - 'throws', - 'command handler threw', - () => { - throw new Error('command handler threw') - } - ], - [ - 'rejects', - 'command handler rejected', - () => Promise.reject(new Error('command handler rejected')) - ] - ])('fails closed when the page command handler %s', async (_caseName, message, onPageCommand) => { - const { callbacks, close, sendRequest } = await subscribeLease() - const onError = vi.fn() - const lease = createLease({ pageCommandProtocolVersion: 1, onPageCommand, onError }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageCommandProtocolVersion: 1 })) - await starting - - callbacks.current!.onResponse(commandResponse()) - - await vi.waitFor(() => expect(close).toHaveBeenCalledOnce()) - expect(sendRequest).not.toHaveBeenCalled() - expect(onError).toHaveBeenCalledWith(expect.objectContaining({ message })) - }) - - it('rejects malformed lease authority instead of adopting it', async () => { - let callbacks: RemoteRuntimeSubscriptionCallbacks | undefined - const close = vi.fn() - subscribeRemoteRuntimeRequestMock.mockImplementationOnce( - async (...args: unknown[]): Promise => { - callbacks = args[4] as RemoteRuntimeSubscriptionCallbacks - return { requestId: 'browser-host', close, sendBinary: () => false } - } - ) - const lease = createLease() - const starting = lease.start() - await vi.waitFor(() => expect(callbacks).toBeDefined()) - callbacks!.onResponse({ - id: 'browser-host', - ok: true, - result: { type: 'ready', authorityEpoch: '', browserHostGeneration: 0 }, - _meta: { runtimeId: 'runtime-a' } - }) - - await expect(starting).rejects.toThrow('Invalid browser host lease response') - expect(close).toHaveBeenCalledOnce() - }) - it('closes a subscription acquired after local teardown', async () => { let resolveSubscription = (_subscription: RemoteRuntimeSubscription): void => {} const close = vi.fn() @@ -531,160 +47,8 @@ describe('PairedRuntimeBrowserHostLease', () => { await expect(starting).rejects.toThrow('closed during startup') expect(close).toHaveBeenCalledOnce() }) - - it('closes and reports an exact server revocation after readiness', async () => { - let callbacks: RemoteRuntimeSubscriptionCallbacks | undefined - const close = vi.fn() - const onError = vi.fn() - subscribeRemoteRuntimeRequestMock.mockImplementationOnce( - async (...args: unknown[]): Promise => { - callbacks = args[4] as RemoteRuntimeSubscriptionCallbacks - return { requestId: 'browser-host', close, sendBinary: () => false } - } - ) - const lease = createLease({ onError }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks).toBeDefined()) - callbacks!.onResponse({ - id: 'browser-host', - ok: true, - result: { type: 'ready', authorityEpoch: 'epoch-a', browserHostGeneration: 4 }, - _meta: { runtimeId: 'runtime-a' } - }) - await starting - - callbacks!.onResponse({ - id: 'browser-host', - ok: true, - result: { - type: 'revoked', - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - reason: 'replaced' - }, - _meta: { runtimeId: 'runtime-a' } - }) - - await vi.waitFor(() => expect(close).toHaveBeenCalledOnce()) - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Browser host lease revoked: replaced' }) - ) - }) - - it('rejects revocation before adopting lease authority', async () => { - const { callbacks, close } = await subscribeLease() - const lease = createLease() - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - - callbacks.current!.onResponse({ - id: 'browser-host', - ok: true, - result: { - type: 'revoked', - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - reason: 'released' - }, - _meta: { runtimeId: 'runtime-a' } - }) - - await expect(starting).rejects.toThrow('Invalid browser host lease revocation') - expect(close).toHaveBeenCalledOnce() - }) - - it.each([ - ['wrong epoch', 'epoch-b', 4, 'replaced', 'Invalid browser host lease revocation'], - ['wrong generation', 'epoch-a', 5, 'released', 'Invalid browser host lease revocation'], - ['malformed reason', 'epoch-a', 4, 'unknown', 'Invalid browser host lease response'] - ])( - 'fails closed on %s after readiness', - async (_caseName, authorityEpoch, browserHostGeneration, reason, expectedError) => { - const { callbacks, close } = await subscribeLease() - const onError = vi.fn() - const lease = createLease({ onError }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse({ - id: 'browser-host', - ok: true, - result: { type: 'ready', authorityEpoch: 'epoch-a', browserHostGeneration: 4 }, - _meta: { runtimeId: 'runtime-a' } - }) - await starting - - callbacks.current!.onResponse({ - id: 'browser-host', - ok: true, - result: { type: 'revoked', authorityEpoch, browserHostGeneration, reason }, - _meta: { runtimeId: 'runtime-a' } - }) - - await vi.waitFor(() => expect(close).toHaveBeenCalledOnce()) - expect(onError).toHaveBeenCalledWith(expect.objectContaining({ message: expectedError })) - } - ) - - it('keeps duplicate readiness and events after local close idempotent', async () => { - const { callbacks, close } = await subscribeLease() - const onError = vi.fn() - const lease = createLease({ onError }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - const ready = { - id: 'browser-host', - ok: true as const, - result: { type: 'ready', authorityEpoch: 'epoch-a', browserHostGeneration: 4 }, - _meta: { runtimeId: 'runtime-a' } - } - callbacks.current!.onResponse(ready) - await starting - callbacks.current!.onResponse(ready) - await lease.close() - callbacks.current!.onClose?.() - - expect(close).toHaveBeenCalledOnce() - expect(onError).not.toHaveBeenCalled() - }) }) -function expectInitialAttachTimeout(): void { - const timeoutMs = subscribeRemoteRuntimeRequestMock.mock.calls[0]?.[3] - expect(timeoutMs).toEqual(expect.any(Number)) - expect(timeoutMs).toBeGreaterThan(0) - expect(timeoutMs).toBeLessThanOrEqual(15_000) -} - -async function subscribeLease(options?: { sendRequest?: ReturnType }): Promise<{ - callbacks: { current?: RemoteRuntimeSubscriptionCallbacks } - close: ReturnType - sendRequest: ReturnType -}> { - const callbacks: { current?: RemoteRuntimeSubscriptionCallbacks } = {} - const close = vi.fn() - const sendRequest = - options && 'sendRequest' in options - ? options.sendRequest - : vi.fn().mockResolvedValue(commandResultAck(true)) - subscribeRemoteRuntimeRequestMock.mockImplementationOnce( - async (...args: unknown[]): Promise => { - callbacks.current = args[4] as RemoteRuntimeSubscriptionCallbacks - const subscription: RemoteRuntimeSubscription = { - requestId: 'browser-host', - close, - sendBinary: () => false, - ...(sendRequest - ? { - sendRequest: sendRequest as unknown as RemoteRuntimeSubscription['sendRequest'] - } - : {}) - } - return subscription - } - ) - return { callbacks, close, sendRequest: sendRequest ?? vi.fn() } -} - function createLease( overrides: { getPageInventory?: () => readonly BrowserClientHostedPageInventory[] @@ -706,86 +70,3 @@ function createLease( ...overrides }) } - -function inventoryPage(): BrowserClientHostedPageInventory { - return { - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-old', - browserHostClientId: 'host-a', - browserHostGeneration: 2, - browserPageId: 'page-a', - pageHostGeneration: 3, - browserProfileId: 'profile-a', - executionHostKey: 'native:runtime-a:1', - state: 'active', - currentUrl: 'https://remote.internal/' - } -} - -function readyResponse( - overrides: { pageCommandProtocolVersion?: 1; pageInventoryProtocolVersion?: 1 } = {} -) { - return { - id: 'browser-host', - ok: true as const, - result: { - type: 'ready' as const, - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - ...overrides - }, - _meta: { runtimeId: 'runtime-a' } - } -} - -function commandResponse( - overrides: { - browserPageId?: string - pageHostGeneration?: number - commandId?: string - } = {} -) { - return { - id: 'browser-host', - ok: true as const, - result: { - type: 'command' as const, - pageCommandProtocolVersion: 1 as const, - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'host-a', - browserHostGeneration: 4, - browserPageId: 'page-a', - pageHostGeneration: 1, - commandSequence: 1, - commandId: 'command-a', - command: { - type: 'createPage' as const, - browserProfileId: 'default', - executionHostKey: 'native:runtime-a:1' - }, - ...overrides - }, - _meta: { runtimeId: 'runtime-a' } - } -} - -function deferredCommandResultAck(): { - promise: Promise> - resolve: (value: ReturnType) => void -} { - let resolve = (_value: ReturnType): void => {} - const promise = new Promise>((innerResolve) => { - resolve = innerResolve - }) - return { promise, resolve } -} - -function commandResultAck(accepted: boolean, runtimeId = 'runtime-a') { - return { - id: 'command-result', - ok: true as const, - result: { accepted }, - _meta: { runtimeId } - } -} diff --git a/src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts deleted file mode 100644 index 5e608588131..00000000000 --- a/src/main/browser/client-hosts/lifecycle/browser-client-host-placement-preparation.test.ts +++ /dev/null @@ -1,231 +0,0 @@ -import { describe, expect, it, vi } from 'vitest' -import { - BROWSER_CLIENT_AUTOMATION_RUNTIME_CAPABILITY, - BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, - BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY, - BROWSER_NETWORK_EXECUTION_HOSTS_RUNTIME_CAPABILITY, - BROWSER_NETWORK_TUNNEL_RUNTIME_CAPABILITY, - BROWSER_SCREENCAST_RUNTIME_CAPABILITY -} from '../../../../shared/browser-runtime-capabilities' -import type { KnownRuntimeEnvironment } from '../../../../shared/remote-runtime/host-catalog/runtime-environments' -import type { RuntimeRpcResponse } from '../../../../shared/runtime-rpc-envelope' -import type { RuntimeStatus } from '../../../../shared/runtime-session-contracts' -import { prepareBrowserClientHostPlacement } from './browser-client-host-placement-preparation' - -const REQUIRED_CAPABILITIES = [ - BROWSER_CLIENT_HOST_RUNTIME_CAPABILITY, - BROWSER_CLIENT_PAGE_METADATA_RUNTIME_CAPABILITY, - BROWSER_CLIENT_AUTOMATION_RUNTIME_CAPABILITY, - BROWSER_NETWORK_TUNNEL_RUNTIME_CAPABILITY, - BROWSER_NETWORK_EXECUTION_HOSTS_RUNTIME_CAPABILITY -] as const - -describe('browser client host placement preparation', () => { - it('starts the exact capable paired host and returns its client identity', async () => { - const harness = createHarness() - - await expect(harness.prepare()).resolves.toEqual({ - kind: 'client', - browserHostClientId: 'browser-client-a' - }) - expect(harness.getStatus).toHaveBeenCalledWith('environment-a') - expect(harness.startHost).toHaveBeenCalledWith({ - environment: expect.objectContaining({ id: 'environment-a', pairingRevision: 7 }), - authorityRuntimeId: 'runtime-a' - }) - expect(harness.closeHost).not.toHaveBeenCalled() - }) - - it('keeps explicit server placement on the server without probing or starting a client host', async () => { - const harness = createHarness() - - await expect(harness.prepare({ preference: 'server' })).resolves.toEqual({ kind: 'server' }) - expect(harness.getStatus).not.toHaveBeenCalled() - expect(harness.startHost).not.toHaveBeenCalled() - }) - - it('renders on the server when the setting asks for it and the server can stream', async () => { - const harness = createHarness({ - status: runtimeStatus({ - capabilities: [...REQUIRED_CAPABILITIES, BROWSER_SCREENCAST_RUNTIME_CAPABILITY] - }) - }) - - await expect(harness.prepare({ enabled: false })).resolves.toEqual({ kind: 'server' }) - expect(harness.startHost).not.toHaveBeenCalled() - }) - - it('hosts on this desktop when the setting asks for the server but the server cannot stream', async () => { - const harness = createHarness() - - await expect(harness.prepare({ enabled: false })).resolves.toEqual({ - kind: 'client', - browserHostClientId: 'browser-client-a' - }) - }) - - it('keeps an older host on the server when any required capability is absent', async () => { - const harness = createHarness({ - status: runtimeStatus({ capabilities: REQUIRED_CAPABILITIES.slice(0, 2) }) - }) - - await expect(harness.prepare()).resolves.toEqual({ kind: 'server' }) - expect(harness.startHost).not.toHaveBeenCalled() - }) - - it('keeps a mobile-scoped pairing on the server even when capabilities are advertised', async () => { - const harness = createHarness({ - status: runtimeStatus({ deviceScope: 'mobile' }) - }) - - await expect(harness.prepare()).resolves.toEqual({ kind: 'server' }) - expect(harness.startHost).not.toHaveBeenCalled() - }) - - it('surfaces a capable host start failure without falling back to server placement', async () => { - const harness = createHarness() - harness.startHost.mockRejectedValueOnce(new Error('attach failed')) - - await expect(harness.prepare()).rejects.toThrow('attach failed') - expect(harness.startHost).toHaveBeenCalledTimes(1) - }) - - it('rejects a runtime identity mismatch before starting a client host', async () => { - const harness = createHarness({ - status: runtimeStatus({}, { responseRuntimeId: 'runtime-b' }) - }) - - await expect(harness.prepare()).rejects.toThrow('browser_client_host_runtime_identity_changed') - expect(harness.startHost).not.toHaveBeenCalled() - }) - - it('rejects a non-ready capable runtime instead of changing placement', async () => { - const harness = createHarness({ status: runtimeStatus({ graphStatus: 'reloading' }) }) - - await expect(harness.prepare()).rejects.toThrow('browser_client_host_runtime_not_ready') - expect(harness.startHost).not.toHaveBeenCalled() - }) - - it('rejects a pairing change observed after status without starting either identity', async () => { - const harness = createHarness({ - environments: [environment(7), environment(8)] - }) - - await expect(harness.prepare()).rejects.toThrow('browser_client_host_pairing_changed') - expect(harness.startHost).not.toHaveBeenCalled() - }) - - it('retires the attached host when its pairing changes before placement is returned', async () => { - const harness = createHarness({ - environments: [environment(7), environment(7), environment(8)] - }) - - await expect(harness.prepare()).rejects.toThrow('browser_client_host_pairing_changed') - expect(harness.startHost).toHaveBeenCalledTimes(1) - expect(harness.closeHost).toHaveBeenCalledWith( - 'environment-a', - expect.objectContaining({ message: 'browser_client_host_pairing_changed' }) - ) - }) - - it.each([ - ['an offline host', 'runtime_unavailable', 'offline'], - ['a timed-out probe', 'timeout', 'status.get timed out'] - ])('keeps %s on the server instead of failing the create', async (_label, code, message) => { - const harness = createHarness({ - status: { - id: 'status.get', - ok: false, - error: { code, message }, - _meta: { runtimeId: 'runtime-a' } - } - }) - - await expect(harness.prepare()).resolves.toEqual({ kind: 'server' }) - expect(harness.startHost).not.toHaveBeenCalled() - expect(harness.closeHost).not.toHaveBeenCalled() - }) -}) - -function createHarness(options?: { - environments?: KnownRuntimeEnvironment[] - status?: RuntimeRpcResponse -}) { - const environments = options?.environments ?? [environment(7), environment(7), environment(7)] - let environmentIndex = 0 - const resolveEnvironment = vi.fn(() => { - const resolved = environments[Math.min(environmentIndex, environments.length - 1)]! - environmentIndex += 1 - return resolved - }) - const getStatus = vi.fn(async () => options?.status ?? runtimeStatus()) - const startHost = vi.fn(async () => ({ - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'browser-client-a', - browserHostGeneration: 1 - })) - const closeHost = vi.fn(async () => true) - return { - getStatus, - startHost, - closeHost, - prepare: (overrides?: { preference?: 'auto' | 'server'; enabled?: boolean }) => - prepareBrowserClientHostPlacement({ - selector: 'environment-a', - expectedPairingRevision: 7, - preference: overrides?.preference ?? 'auto', - enabled: overrides?.enabled ?? true, - resolveEnvironment, - getStatus, - startHost, - closeHost - }) - } -} - -function environment(pairingRevision: number): KnownRuntimeEnvironment { - return { - id: 'environment-a', - name: 'Environment A', - createdAt: 1, - updatedAt: pairingRevision, - pairingRevision, - pairedDeviceId: 'device-a', - lastUsedAt: null, - runtimeId: 'runtime-a', - endpoints: [ - { - id: 'endpoint-a', - kind: 'websocket', - label: 'WebSocket', - endpoint: 'ws://runtime-a.test', - deviceToken: 'token-a', - publicKeyB64: 'key-a' - } - ], - preferredEndpointId: 'endpoint-a' - } -} - -function runtimeStatus( - overrides: Partial = {}, - options?: { responseRuntimeId?: string } -): RuntimeRpcResponse { - const runtimeId = overrides.runtimeId ?? 'runtime-a' - return { - id: 'status.get', - ok: true, - result: { - runtimeId, - rendererGraphEpoch: 1, - graphStatus: 'ready', - authoritativeWindowId: 1, - liveTabCount: 0, - liveLeafCount: 0, - capabilities: [...REQUIRED_CAPABILITIES], - ...overrides - }, - _meta: { runtimeId: options?.responseRuntimeId ?? runtimeId } - } -} diff --git a/src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts b/src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts deleted file mode 100644 index 6c449e4d143..00000000000 --- a/src/main/browser/client-hosts/lifecycle/browser-client-host-reconciliation-command-order.test.ts +++ /dev/null @@ -1,278 +0,0 @@ -import type { - BrowserClientHostCommandEvent, - BrowserClientHostLeaseAuthority -} from '../../../../shared/browser/client-hosting/browser-client-host-protocol' -import { describe, expect, it, vi } from 'vitest' -import { BrowserHostCommandLedger } from '../../../runtime/browser-host/commands/browser-host-command-ledger' -import { BrowserClientHostCommandDispatcher } from '../commands/browser-client-host-command-dispatcher' - -const authority: BrowserClientHostLeaseAuthority & { - pageCommandProtocolVersion: 1 - pageReconciliationProtocolVersion: 1 -} = { - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-new', - browserHostClientId: 'host-a', - browserHostGeneration: 3, - pageCommandProtocolVersion: 1, - pageReconciliationProtocolVersion: 1 -} - -const previousAuthority = { - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-old', - browserHostClientId: 'host-a', - browserHostGeneration: 2, - pageHostGeneration: 7 -} - -function event( - command: BrowserClientHostCommandEvent['command'], - overrides: Partial = {} -): BrowserClientHostCommandEvent { - return { - type: 'command', - ...authority, - browserPageId: 'page-a', - pageHostGeneration: command.type === 'closePage' ? 7 : 8, - commandSequence: 1, - commandId: `${command.type}-a`, - command, - ...overrides - } -} - -describe('browser reconciliation command ordering', () => { - it.each([ - { - type: 'reclaimPage' as const, - previousAuthority, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - }, - { - type: 'restorePage' as const, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - }, - { type: 'closePage' as const, targetAuthority: previousAuthority } - ])('admits $type as an authenticated first client-dispatch command', async (command) => { - const handler = vi.fn().mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - - await expect(dispatcher.dispatch(event(command))).resolves.toEqual({ status: 'completed' }) - expect(handler).toHaveBeenCalledOnce() - }) - - it('deduplicates exact reclaim bootstrap and rejects changed prior authority', async () => { - const handler = vi.fn().mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - const reclaim = event({ - type: 'reclaimPage', - previousAuthority, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - }) - - const first = dispatcher.dispatch(reclaim) - const duplicate = dispatcher.dispatch(reclaim) - await expect(first).resolves.toEqual({ status: 'completed' }) - await expect(duplicate).resolves.toEqual({ status: 'completed' }) - expect(handler).toHaveBeenCalledOnce() - expect(() => - dispatcher.dispatch({ - ...reclaim, - command: { - ...reclaim.command, - previousAuthority: { ...previousAuthority, authorityEpoch: 'different' } - } - } as BrowserClientHostCommandEvent) - ).toThrow('browser_host_command_sequence_conflict') - }) - - it('snapshots nested reconciliation authority on both sides of dispatch', async () => { - const handler = vi.fn().mockResolvedValue({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - const clientAuthority = { ...previousAuthority } - const clientEvent = event({ - type: 'reclaimPage', - previousAuthority: clientAuthority, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - }) - - const dispatched = dispatcher.dispatch(clientEvent) - clientAuthority.authorityEpoch = 'mutated-client' - await dispatched - const accepted = handler.mock.calls[0]?.[0] as BrowserClientHostCommandEvent - expect(accepted.command).toMatchObject({ - previousAuthority: expect.objectContaining({ authorityEpoch: 'epoch-old' }) - }) - expect( - Object.isFrozen(accepted.command.type === 'reclaimPage' && accepted.command.previousAuthority) - ).toBe(true) - - const delivery = vi.fn() - const ledger = new BrowserHostCommandLedger({ authority }) - ledger.attach(delivery) - const serverAuthority = { ...previousAuthority } - ledger.issue({ - browserPageId: 'page-b', - pageHostGeneration: 8, - command: { - type: 'reclaimPage', - previousAuthority: serverAuthority, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - } - }) - serverAuthority.authorityEpoch = 'mutated-server' - const emitted = delivery.mock.calls[0]?.[0] as BrowserClientHostCommandEvent - expect(emitted.command).toMatchObject({ - previousAuthority: expect.objectContaining({ authorityEpoch: 'epoch-old' }) - }) - expect( - Object.isFrozen(emitted.command.type === 'reclaimPage' && emitted.command.previousAuthority) - ).toBe(true) - }) - - it.each(['reclaimPage', 'restorePage'] as const)( - 'cancels navigation when %s bootstrap fails', - async (type) => { - const handler = vi - .fn() - .mockResolvedValueOnce({ status: 'failed', errorCode: 'bootstrap_failed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - const bootstrap = - type === 'reclaimPage' - ? { - type, - previousAuthority, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - } - : { - type, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - } - const first = dispatcher.dispatch(event(bootstrap)) - const navigate = dispatcher.dispatch( - event( - { type: 'navigate', url: 'https://remote.internal/' }, - { commandSequence: 2, commandId: `${type}-navigate` } - ) - ) - - await expect(first).resolves.toEqual({ - status: 'failed', - errorCode: 'bootstrap_failed' - }) - await expect(navigate).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_host_command_dependency_failed' - }) - expect(handler).toHaveBeenCalledOnce() - } - ) - - it('makes an exact close terminal while allowing navigate after reclaim', async () => { - const dispatcher = new BrowserClientHostCommandDispatcher({ - authority, - handler: vi.fn().mockResolvedValue({ status: 'completed' }) - }) - await dispatcher.dispatch( - event({ - type: 'reclaimPage', - previousAuthority, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - }) - ) - await expect( - dispatcher.dispatch( - event( - { type: 'navigate', url: 'https://remote.internal/' }, - { commandSequence: 2, commandId: 'navigate-a' } - ) - ) - ).resolves.toEqual({ status: 'completed' }) - - const closing = new BrowserClientHostCommandDispatcher({ - authority, - handler: vi.fn().mockResolvedValue({ status: 'completed' }) - }) - await closing.dispatch(event({ type: 'closePage', targetAuthority: previousAuthority })) - expect(() => - closing.dispatch( - event( - { type: 'navigate', url: 'https://remote.internal/' }, - { commandSequence: 2, commandId: 'navigate-after-close', pageHostGeneration: 7 } - ) - ) - ).toThrow('browser_host_page_generation_stale') - }) - - it('allows the same generation to continue after a failed close', async () => { - const handler = vi - .fn() - .mockResolvedValueOnce({ status: 'failed', errorCode: 'authority_stale' }) - .mockResolvedValueOnce({ status: 'completed' }) - const dispatcher = new BrowserClientHostCommandDispatcher({ authority, handler }) - - await expect( - dispatcher.dispatch(event({ type: 'closePage', targetAuthority: previousAuthority })) - ).resolves.toEqual({ status: 'failed', errorCode: 'authority_stale' }) - await expect( - dispatcher.dispatch( - event( - { type: 'navigate', url: 'https://remote.internal/' }, - { commandSequence: 2, commandId: 'navigate-after-failed-close', pageHostGeneration: 7 } - ) - ) - ).resolves.toEqual({ status: 'completed' }) - }) - - it('issues reconciliation bootstrap commands from the server ledger without create', () => { - const delivery = vi.fn() - const ledger = new BrowserHostCommandLedger({ authority }) - ledger.attach(delivery) - - const reclaim = ledger.issue({ - browserPageId: 'page-a', - pageHostGeneration: 8, - command: { - type: 'reclaimPage', - previousAuthority, - browserProfileId: 'profile-a', - executionHostKey: 'host-key-a' - } - }) - const navigate = ledger.issue({ - browserPageId: 'page-a', - pageHostGeneration: 8, - command: { type: 'navigate', url: 'https://remote.internal/' } - }) - const close = ledger.issue({ - browserPageId: 'page-b', - pageHostGeneration: 9, - resultAdmission: 'reconciliation', - command: { - type: 'closePage', - targetAuthority: { ...previousAuthority, pageHostGeneration: 9 } - } - }) - - expect(reclaim.event.commandSequence).toBe(1) - expect(navigate.event.commandSequence).toBe(2) - expect(close.event.commandSequence).toBe(1) - expect(delivery).toHaveBeenCalledTimes(3) - expect(() => - ledger.issue({ - browserPageId: 'page-b', - pageHostGeneration: 9, - command: { type: 'navigate', url: 'https://after-close.invalid/' } - }) - ).toThrow('browser_host_command_page_terminal') - }) -}) diff --git a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts index e10ea38cc41..9d0fe1d60aa 100644 --- a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-composition.test.ts @@ -1,11 +1,10 @@ import { describe, expect, it, vi } from 'vitest' import { BrowserClientHostAuthorityReplacementWait } from './browser-client-host-authority-replacement-wait' -import { - type BrowserClientHostedPageInventory, - type BrowserClientHostCommandEvent, - type BrowserClientHostLeaseAuthority, - BROWSER_CLIENT_HOST_AUTHORITY_MISMATCH_CODE +import type { + BrowserClientHostedPageInventory, + BrowserClientHostCommandEvent, + BrowserClientHostLeaseAuthority } from '../../../../shared/browser/client-hosting/browser-client-host-protocol' import { PairedRuntimeBrowserClientHostComposition } from './paired-runtime-browser-client-host-composition' @@ -38,119 +37,6 @@ const replacementInput = { } describe('PairedRuntimeBrowserClientHostComposition', () => { - it('activates exact route authority before admitting page commands', async () => { - const rig = createRig() - const composition = rig.createComposition() - - await expect(composition.start()).resolves.toEqual(authority) - await rig.hostOptions.handler?.(command(), new AbortController().signal) - - expect(rig.order).toEqual(['activate-routes', 'handle-command']) - }) - - it('provides the exact executor inventory to the host attach', () => { - const rig = createRig() - rig.createComposition() - - expect(rig.hostOptions.getPageInventory?.()).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'active' }) - ]) - expect(rig.executor.snapshotPageInventory).toHaveBeenCalledOnce() - }) - - it('publishes a fresh inventory snapshot for every reconnect attach', () => { - const rig = createRig({ pageInventory: [] }) - rig.executor.snapshotPageInventory - .mockReturnValueOnce([]) - .mockReturnValueOnce([retainedPageInventory()]) - rig.createComposition() - - expect(rig.hostOptions.getPageInventory?.()).toEqual([]) - expect(rig.hostOptions.getPageInventory?.()).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'active' }) - ]) - expect(rig.executor.snapshotPageInventory).toHaveBeenCalledTimes(2) - }) - - it('coalesces page availability losses into one inventory refresh', async () => { - const rig = createRig() - rig.createComposition() - - rig.reportPageUnavailable() - rig.reportPageUnavailable() - - expect(rig.host.refreshPageInventory).toHaveBeenCalledOnce() - await Promise.resolve() - await Promise.resolve() - rig.reportPageUnavailable() - expect(rig.host.refreshPageInventory).toHaveBeenCalledTimes(2) - }) - - it('preserves inventory while replacing authority with fresh routes', async () => { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - - await expect(composition.replaceAuthority(replacementInput)).resolves.toEqual( - replacementAuthority - ) - - expect(rig.replacementInventory).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', authorityRuntimeId: 'runtime-a' }) - ]) - expect(rig.executor.close).not.toHaveBeenCalled() - expect(rig.routes.close).not.toHaveBeenCalled() - expect(rig.order).toEqual([ - 'activate-routes', - 'retire-routes', - 'fence-authority-transition', - 'close-host', - 'complete-authority-transition', - 'attach-replacement-inventory', - 'activate-replacement-routes' - ]) - }) - - it('rejects retained inventory when replacement cannot reconcile it', async () => { - const rig = createRig({ - replacementAuthority: { - ...replacementAuthority, - pageInventoryProtocolVersion: undefined, - pageReconciliationProtocolVersion: undefined - } - }) - const composition = rig.createComposition() - await composition.start() - - await expect(composition.replaceAuthority(replacementInput)).rejects.toThrow( - 'browser_client_page_reconciliation_unsupported' - ) - - expect(rig.replacementInventory).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', authorityRuntimeId: 'runtime-a' }) - ]) - expect(rig.replacementRoutes.close).not.toHaveBeenCalled() - expect(rig.order).not.toContain('activate-replacement-routes') - await composition.close() - }) - - it('allows a legacy replacement when there is no retained inventory', async () => { - const legacyAuthority = { - ...replacementAuthority, - pageInventoryProtocolVersion: undefined, - pageReconciliationProtocolVersion: undefined - } - const rig = createRig({ pageInventory: [], replacementAuthority: legacyAuthority }) - const composition = rig.createComposition() - await composition.start() - - await expect(composition.replaceAuthority(replacementInput)).resolves.toEqual(legacyAuthority) - - expect(rig.replacementInventory).toEqual([]) - expect(rig.order).toContain('activate-replacement-routes') - await composition.close() - }) - it('waits for old handlers and ignores their late callbacks before replacement', async () => { const rig = createRig({ hostSettled: false }) const composition = rig.createComposition() @@ -172,41 +58,6 @@ describe('PairedRuntimeBrowserClientHostComposition', () => { expect(rig.onError).not.toHaveBeenCalled() }) - it('fails closed when retired routes reject during replacement', async () => { - const routeRetireError = new Error('route retirement failed') - const rig = createRig({ routeRetireError }) - const composition = rig.createComposition() - await composition.start() - - await expect(composition.replaceAuthority(replacementInput)).rejects.toThrow( - 'paired_runtime_browser_client_host_composition_closed' - ) - await composition.whenClosed() - - expect(rig.onError).toHaveBeenCalledWith(routeRetireError) - expect(rig.executor.close).toHaveBeenCalledOnce() - expect(rig.routes.close).toHaveBeenCalledOnce() - expect(rig.order).not.toContain('activate-replacement-routes') - }) - - it('suspends routes without closing pages and gates commands through recovery', async () => { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - - rig.hostOptions.onTransportLost?.(new Error('transport lost')) - const handling = rig.hostOptions.handler?.(command(), new AbortController().signal) - await Promise.resolve() - expect(rig.routes.suspend).toHaveBeenCalledOnce() - expect(rig.executor.handle).not.toHaveBeenCalled() - expect(rig.executor.close).not.toHaveBeenCalled() - - rig.hostOptions.onReconnected?.(authority) - await expect(handling).resolves.toEqual({ status: 'completed' }) - expect(rig.routes.reconnect).toHaveBeenCalledOnce() - expect(rig.executor.handle).toHaveBeenCalledOnce() - }) - it('keeps one command gate across repeated loss while fencing stale route recovery', async () => { const firstRecovery = deferred() const secondRecovery = deferred() @@ -234,171 +85,6 @@ describe('PairedRuntimeBrowserClientHostComposition', () => { expect(rig.executor.handle).toHaveBeenCalledOnce() }) - it('settles dispatcher retirement before destroying and forgetting the page', async () => { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - - await expect(composition.retirePage('page-a', 7)).resolves.toBe(true) - - expect(rig.order).toEqual([ - 'activate-routes', - 'retire-dispatcher-page', - 'retire-executor-page', - 'forget-dispatcher-page' - ]) - }) - - it('closes control transport before executor pages and routes', async () => { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - - await expect(composition.close()).resolves.toBe(true) - - expect(rig.order).toEqual([ - 'activate-routes', - 'closing', - 'suspend-routes', - 'fence-navigation', - 'close-host', - 'close-executor', - 'close-routes' - ]) - }) - - it('fences navigation and routes before terminal host cleanup can wait', async () => { - const rig = createRig() - const composition = rig.createComposition() - const error = new Error('terminal authority loss') - await composition.start() - - rig.hostOptions.onError?.(error) - - expect(rig.routes.suspend).toHaveBeenCalledWith(error) - expect(rig.executor.fenceNavigation).toHaveBeenCalledOnce() - expect(rig.order.slice(0, 5)).toEqual([ - 'activate-routes', - 'closing', - 'suspend-routes', - 'fence-navigation', - 'close-host' - ]) - await composition.whenClosed() - }) - - it('waits out the grace instead of tearing down when the authority was replaced', async () => { - vi.useFakeTimers() - try { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - - rig.hostOptions.onError?.(authorityReplacedError()) - - expect(rig.authorityReplacementWait.armed).toBe(true) - expect(rig.onError).not.toHaveBeenCalled() - expect(rig.order).toEqual(['activate-routes']) - } finally { - vi.useRealTimers() - } - }) - - it('tears the composition down once the grace expires with no replacement', async () => { - vi.useFakeTimers() - try { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - const replaced = authorityReplacedError() - - rig.hostOptions.onError?.(replaced) - vi.advanceTimersByTime(1_000) - - expect(rig.onError).toHaveBeenCalledWith(replaced) - expect(rig.order).toContain('closing') - await vi.runAllTimersAsync() - await composition.whenClosed() - } finally { - vi.useRealTimers() - } - }) - - it('cancels the grace when the replacement authority actually arrives', async () => { - vi.useFakeTimers() - try { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - rig.hostOptions.onError?.(authorityReplacedError()) - - await composition.replaceAuthority(replacementInput) - - expect(rig.authorityReplacementWait.armed).toBe(false) - vi.advanceTimersByTime(10_000) - expect(rig.onError).not.toHaveBeenCalled() - } finally { - vi.useRealTimers() - } - }) - - it('cancels the grace when the composition closes for another reason', async () => { - vi.useFakeTimers() - try { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - rig.hostOptions.onError?.(authorityReplacedError()) - - await composition.close() - - expect(rig.authorityReplacementWait.armed).toBe(false) - vi.advanceTimersByTime(10_000) - expect(rig.onError).not.toHaveBeenCalled() - } finally { - vi.useRealTimers() - } - }) - - it('arms one deadline for a burst of mismatch errors', async () => { - vi.useFakeTimers() - try { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - - rig.hostOptions.onError?.(authorityReplacedError()) - vi.advanceTimersByTime(900) - rig.hostOptions.onError?.(authorityReplacedError()) - vi.advanceTimersByTime(100) - - expect(rig.onError).toHaveBeenCalledTimes(1) - await vi.runAllTimersAsync() - await composition.whenClosed() - } finally { - vi.useRealTimers() - } - }) - - it('still tears down immediately for a host error that is not a replacement', async () => { - vi.useFakeTimers() - try { - const rig = createRig() - const composition = rig.createComposition() - await composition.start() - const fatal = new Error('browser host process exited') - - rig.hostOptions.onError?.(fatal) - - expect(rig.authorityReplacementWait.armed).toBe(false) - expect(rig.onError).toHaveBeenCalledWith(fatal) - await vi.runAllTimersAsync() - await composition.whenClosed() - } finally { - vi.useRealTimers() - } - }) - it('fails closed without racing page cleanup when handlers do not settle', async () => { const rig = createRig({ hostSettled: false }) const composition = rig.createComposition() @@ -429,45 +115,6 @@ describe('PairedRuntimeBrowserClientHostComposition', () => { 'close-executor' ]) }) - - it('reports a deferred executor cleanup failure while retaining its fence', async () => { - const cleanupError = new Error('executor cleanup failed') - const rig = createRig({ executorCloseError: cleanupError, hostSettled: false }) - const composition = rig.createComposition() - await composition.start() - await composition.close() - - rig.settleHandlers() - - await expect(composition.whenClosed()).rejects.toThrow('executor cleanup failed') - expect(rig.onError).toHaveBeenCalledWith(cleanupError) - }) - - it('forgets a failed create that left no unresolved executor page', async () => { - const rig = createRig() - rig.executor.retirePage.mockResolvedValueOnce(false) - const composition = rig.createComposition() - await composition.start() - - await expect(composition.retirePage('page-a', 7)).resolves.toBe(true) - - expect(rig.executor.hasUnresolvedPage).toHaveBeenCalledWith('page-a', 7) - expect(rig.host.forgetPage).toHaveBeenCalledWith('page-a', 7) - }) - - it('keeps an unresolved failed create fenced', async () => { - const rig = createRig() - rig.executor.retirePage.mockResolvedValueOnce(false) - rig.executor.hasUnresolvedPage.mockReturnValueOnce(true) - const composition = rig.createComposition() - await composition.start() - - await expect(composition.retirePage('page-a', 7)).rejects.toThrow( - 'browser_client_page_retirement_cleanup_pending' - ) - - expect(rig.host.forgetPage).not.toHaveBeenCalled() - }) }) function createRig( @@ -635,12 +282,6 @@ function createRig( } } -function authorityReplacedError(): Error { - return Object.assign(new Error('lease attach named a retired runtime'), { - code: BROWSER_CLIENT_HOST_AUTHORITY_MISMATCH_CODE - }) -} - function retainedPageInventory(): BrowserClientHostedPageInventory { return { authorityRuntimeId: 'runtime-a', diff --git a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts index 2d10d3cc208..58f12c01411 100644 --- a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-registry.test.ts @@ -11,50 +11,6 @@ const authority: BrowserClientHostLeaseAuthority = { } describe('PairedRuntimeBrowserClientHostRegistry', () => { - it('shares one composition for the exact environment pairing revision', async () => { - const composition = createComposition() - const compositionFactory = vi.fn(() => composition) - const registry = new PairedRuntimeBrowserClientHostRegistry({ - createComposition: compositionFactory - }) - - const first = registry.start(input(11)) - const second = registry.start(input(11)) - - await expect(Promise.all([first, second])).resolves.toEqual([authority, authority]) - expect(compositionFactory).toHaveBeenCalledOnce() - expect(composition.start).toHaveBeenCalledOnce() - }) - - it('closes an old pairing revision before creating its replacement', async () => { - const order: string[] = [] - const first = createComposition(order, 'start-first', 'close-first') - const second = createComposition(order, 'start-second', 'close-second') - const registry = new PairedRuntimeBrowserClientHostRegistry({ - createComposition: vi.fn().mockReturnValueOnce(first).mockReturnValueOnce(second) - }) - await registry.start(input(11)) - - await registry.start(input(12)) - - expect(order).toEqual(['start-first', 'close-first', 'start-second']) - }) - - it('preserves the composition across a runtime authority transition', async () => { - const composition = createComposition() - const compositionFactory = vi.fn(() => composition) - const registry = new PairedRuntimeBrowserClientHostRegistry({ - createComposition: compositionFactory - }) - await registry.start(input(11)) - - await registry.start(input(11, 'runtime-b')) - - expect(compositionFactory).toHaveBeenCalledOnce() - expect(composition.replaceAuthority).toHaveBeenCalledWith(input(11, 'runtime-b')) - expect(composition.close).not.toHaveBeenCalled() - }) - it('keeps a failed authority transition tombstoned until cleanup settles', async () => { const cleanup = deferred() const failed = createComposition(undefined, undefined, undefined, false, cleanup.promise) @@ -79,87 +35,6 @@ describe('PairedRuntimeBrowserClientHostRegistry', () => { await expect(registry.start(input(11, 'runtime-b'))).resolves.toEqual(authority) expect(replacement.start).toHaveBeenCalledOnce() }) - - it('blocks replacement when the old host cannot prove handler settlement', async () => { - const cleanup = deferred() - const first = createComposition(undefined, undefined, undefined, false, cleanup.promise) - const second = createComposition() - const compositionFactory = vi.fn().mockReturnValueOnce(first).mockReturnValueOnce(second) - const registry = new PairedRuntimeBrowserClientHostRegistry({ - createComposition: compositionFactory - }) - await registry.start(input(11)) - - await expect(registry.start(input(12))).rejects.toThrow( - 'paired_runtime_browser_client_host_cleanup_pending' - ) - - expect(compositionFactory).toHaveBeenCalledOnce() - expect(second.start).not.toHaveBeenCalled() - - cleanup.resolve() - await cleanup.promise - await expect(registry.start(input(12))).resolves.toEqual(authority) - expect(second.start).toHaveBeenCalledOnce() - }) - - it('keeps replacement fenced when deferred cleanup cannot prove completion', async () => { - const cleanup = deferred() - const first = createComposition(undefined, undefined, undefined, false, cleanup.promise) - const second = createComposition() - const compositionFactory = vi.fn().mockReturnValueOnce(first).mockReturnValueOnce(second) - const registry = new PairedRuntimeBrowserClientHostRegistry({ - createComposition: compositionFactory - }) - await registry.start(input(11)) - - await expect(registry.start(input(12))).rejects.toThrow( - 'paired_runtime_browser_client_host_cleanup_pending' - ) - cleanup.reject(new Error('cleanup unresolved')) - await cleanup.promise.catch(() => undefined) - await expect(registry.start(input(12))).rejects.toThrow( - 'paired_runtime_browser_client_host_cleanup_pending' - ) - - expect(compositionFactory).toHaveBeenCalledOnce() - expect(second.start).not.toHaveBeenCalled() - }) - - it('reports a page as hosted only by the live composition of its own environment', async () => { - const cleanup = deferred() - const composition = createComposition(undefined, undefined, undefined, false, cleanup.promise) - composition.hostsPage.mockImplementation((browserPageId) => browserPageId === 'page-a') - composition.replaceAuthority.mockRejectedValueOnce(new Error('replacement attach failed')) - const registry = new PairedRuntimeBrowserClientHostRegistry({ - createComposition: vi.fn(() => composition) - }) - await registry.start(input(11)) - - expect(registry.hostsPage('environment-a', 'page-a')).toBe(true) - expect(registry.hostsPage('environment-a', 'page-b')).toBe(false) - expect(registry.hostsPage('environment-b', 'page-a')).toBe(false) - await expect(registry.start(input(11, 'runtime-b'))).rejects.toThrow() - expect(registry.hostsPage('environment-a', 'page-a')).toBe(false) - }) - - it('permanently fences new starts before closing every environment', async () => { - const first = createComposition() - const second = createComposition() - const registry = new PairedRuntimeBrowserClientHostRegistry({ - createComposition: vi.fn().mockReturnValueOnce(first).mockReturnValueOnce(second) - }) - await registry.start(input(11)) - await registry.start({ ...input(11), environmentId: 'environment-b' }) - - await registry.close() - - expect(first.close).toHaveBeenCalledOnce() - expect(second.close).toHaveBeenCalledOnce() - await expect(registry.start(input(11))).rejects.toThrow( - 'paired_runtime_browser_client_host_registry_closed' - ) - }) }) function createComposition( diff --git a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts index 4ab01822309..eb17cf6a447 100644 --- a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts +++ b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host-route-identity.test.ts @@ -1,4 +1,4 @@ -import { mkdtempSync, readFileSync, realpathSync, writeFileSync } from 'node:fs' +import { mkdtempSync, readFileSync, realpathSync } from 'node:fs' import { tmpdir } from 'node:os' import { join } from 'node:path' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -61,12 +61,6 @@ const SSH_DEPLOYMENT: OrcadDeploymentLink = { localPort: 9999, remotePort: 7777 } -const WSL_DEPLOYMENT: OrcadDeploymentLink = { - kind: 'wsl', - distro: 'Ubuntu', - localPort: 9999, - remotePort: 7777 -} function pairedEnvironment( id: string, @@ -118,18 +112,6 @@ async function routeIdentity( return identity } -async function connectionIdentity( - environment: KnownRuntimeEnvironment, - authorityRuntimeId: string -): Promise<{ current: string; pairing: string; legacy: string }> { - const identity = await routeIdentity(environment, authorityRuntimeId) - return { - current: identity.authorityConnectionIdentity, - pairing: identity.pairingAuthorityConnectionIdentity, - legacy: identity.legacyAuthorityConnectionIdentity - } -} - function pageIdentity( identity: ClientHostRouteIdentity, authorityConnectionIdentity: string, @@ -202,41 +184,6 @@ function resolvePartitionAsOlderBuild(filePath: string, identity: ClientHostRout return derived.partition } -/** Older parsers discard unrecognized alias fields. */ -function rewriteAsOlderBuild(filePath: string): void { - const persisted: { - version: number - bindings: Record - } = JSON.parse(readFileSync(filePath, 'utf8')) - const bindings = Object.fromEntries( - Object.entries(persisted.bindings).map(([partition, binding]) => [ - partition, - { - fingerprint: binding.fingerprint, - storageScope: binding.storageScope, - lastUsedAt: binding.lastUsedAt - } - ]) - ) - writeFileSync(filePath, JSON.stringify({ version: persisted.version, bindings })) -} - -function seedOlderBuildJar(filePath: string, identity: ClientHostRouteIdentity): string { - const derived = deriveBrowserRoutePartition( - pageIdentity( - identity, - identity.pairingAuthorityConnectionIdentity, - identity.executionHostIdentity - ) - ) - new BrowserRoutePartitionBindingStore({ filePath }).set( - derived.partition, - derived.bindingFingerprint, - identity.storageScope - ) - return derived.partition -} - function bindingStorePath(): string { return join( realpathSync(mkdtempSync(join(realpathSync(tmpdir()), 'orca-re-pair-partition-'))), @@ -248,148 +195,7 @@ beforeEach(() => { compositions.length = 0 }) -describe('client host authority connection identity', () => { - it('survives the remote restarting, and keeps the pre-migration identity distinct', async () => { - configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) - const environment = pairedEnvironment('environment-restart') - - const before = await connectionIdentity(environment, 'runtime-a') - const after = await connectionIdentity(environment, 'runtime-restarted') - - expect(after.current).toBe(before.current) - expect(after.legacy).not.toBe(before.legacy) - expect(before.legacy).not.toBe(before.current) - }) - - it('separates environments, pairing revisions, and server keys', async () => { - configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) - const identities = [ - await connectionIdentity(pairedEnvironment('environment-a'), 'runtime-a'), - await connectionIdentity(pairedEnvironment('environment-b'), 'runtime-a'), - await connectionIdentity( - pairedEnvironment('environment-a', { pairingRevision: 2 }), - 'runtime-a' - ), - await connectionIdentity( - pairedEnvironment('environment-a', { publicKeyB64: 'key-rotated' }), - 'runtime-a' - ) - ] - - expect(new Set(identities.map((entry) => entry.current)).size).toBe(identities.length) - }) -}) - describe('client host identity for a server Orca re-pairs in place', () => { - it.each([ - ['managed SSH', SSH_DEPLOYMENT], - ['WSL', WSL_DEPLOYMENT] - ])('%s keeps one identity across re-pairs and still separates keys', async (_, deployment) => { - configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) - const id = `environment-${deployment.kind ?? 'ssh'}` - const before = await connectionIdentity( - pairedEnvironment(id, { orcadDeployment: deployment, pairedDeviceId: 'device-a' }), - 'runtime-a' - ) - const rePaired = await connectionIdentity( - pairedEnvironment(id, { - orcadDeployment: deployment, - pairingRevision: 5, - pairedDeviceId: 'device-b', - deviceToken: 'token-b' - }), - 'runtime-b' - ) - const otherKey = await connectionIdentity( - pairedEnvironment(id, { orcadDeployment: deployment, publicKeyB64: 'key-b' }), - 'runtime-a' - ) - const otherEnvironment = await connectionIdentity( - pairedEnvironment(`${id}-other`, { orcadDeployment: deployment }), - 'runtime-a' - ) - - expect(rePaired.current).toBe(before.current) - expect(rePaired.pairing).not.toBe(before.pairing) - expect(otherKey.current).not.toBe(before.current) - expect(otherEnvironment.current).not.toBe(before.current) - }) - - it('leaves a manually paired server on its pairing identity', async () => { - configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) - const identity = await connectionIdentity(pairedEnvironment('environment-manual'), 'runtime-a') - - expect(identity.current).toBe(identity.pairing) - }) - - it.each([ - ['managed SSH', SSH_DEPLOYMENT], - ['WSL', WSL_DEPLOYMENT] - ])( - '%s keeps the jar an older build filled through re-pairs and a downgrade', - async (_, deployment) => { - configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) - const filePath = bindingStorePath() - const id = `environment-jar-${deployment.kind ?? 'ssh'}` - const atRevisionOne = await routeIdentity( - pairedEnvironment(id, { orcadDeployment: deployment, pairedDeviceId: 'device-a' }), - 'runtime-a' - ) - const atRevisionTwo = await routeIdentity( - pairedEnvironment(id, { - orcadDeployment: deployment, - pairingRevision: 2, - pairedDeviceId: 'device-b', - deviceToken: 'token-b' - }), - 'runtime-b' - ) - const withNewKey = await routeIdentity( - pairedEnvironment(id, { - orcadDeployment: deployment, - pairingRevision: 3, - publicKeyB64: 'key-b' - }), - 'runtime-c' - ) - const olderJar = seedOlderBuildJar(filePath, atRevisionOne) - - expect(resolvePartition(filePath, atRevisionOne)).toBe(olderJar) - expect(resolvePartitionAsOlderBuild(filePath, atRevisionOne)).toBe(olderJar) - expect(resolvePartition(filePath, atRevisionTwo)).toBe(olderJar) - expect(resolvePartitionAsOlderBuild(filePath, atRevisionTwo)).toBe(olderJar) - rewriteAsOlderBuild(filePath) - expect(resolvePartition(filePath, atRevisionTwo)).toBe(olderJar) - expect(resolvePartition(filePath, withNewKey)).not.toBe(olderJar) - } - ) - - it('mints a fresh jar an older build can open at every pairing', async () => { - configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) - const filePath = bindingStorePath() - const id = 'environment-fresh' - const atRevisionOne = await routeIdentity( - pairedEnvironment(id, { orcadDeployment: SSH_DEPLOYMENT, pairedDeviceId: 'device-a' }), - 'runtime-a' - ) - const atRevisionTwo = await routeIdentity( - pairedEnvironment(id, { - orcadDeployment: SSH_DEPLOYMENT, - pairingRevision: 2, - pairedDeviceId: 'device-b' - }), - 'runtime-b' - ) - - const jar = resolvePartition(filePath, atRevisionOne) - expect(resolvePartitionAsOlderBuild(filePath, atRevisionOne)).toBe(jar) - expect(resolvePartition(filePath, atRevisionTwo)).toBe(jar) - expect(resolvePartitionAsOlderBuild(filePath, atRevisionTwo)).toBe(jar) - rewriteAsOlderBuild(filePath) - expect(resolvePartition(filePath, atRevisionOne)).toBe(jar) - expect(resolvePartitionAsOlderBuild(filePath, atRevisionOne)).toBe(jar) - }) - it('adopts a per-process jar under the fingerprint an older build reads', async () => { configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) const filePath = bindingStorePath() @@ -414,23 +220,3 @@ describe('client host identity for a server Orca re-pairs in place', () => { expect(resolvePartitionAsOlderBuild(filePath, identity)).toBe(legacy.partition) }) }) - -describe('client host route identity lifetime', () => { - it('stops answering with a route identity once the host is retired by its own error', async () => { - configurePairedRuntimeBrowserClientHostsForOrcaProfile({ orcaProfileId: 'profile-a' }) - const environment = pairedEnvironment('environment-retired') - await startPairedRuntimeBrowserClientHost({ - environment, - authorityRuntimeId: 'runtime-a' - }) - expect(getPairedRuntimeBrowserClientRouteIdentity(environment.id)).not.toBeNull() - - const failure = new Error('lease fenced') - compositions.at(-1)?.options.onError(failure) - await vi.waitFor(() => { - expect(compositions.at(-1)?.closed).toEqual([failure]) - }) - - expect(getPairedRuntimeBrowserClientRouteIdentity(environment.id)).toBeNull() - }) -}) diff --git a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts deleted file mode 100644 index 945d3f809ed..00000000000 --- a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-client-host.test.ts +++ /dev/null @@ -1,399 +0,0 @@ -import { pairedRuntimeConnectionFromOffer } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' -import { afterEach, describe, expect, it, vi } from 'vitest' -import type { - BrowserClientHostedPageInventory, - BrowserClientHostCommandEvent -} from '../../../../shared/browser/client-hosting/browser-client-host-protocol' -import type { BrowserClientAutomationResult as BrowserClientHostCommandResult } from '../../../../shared/browser/client-hosting/browser-client-automation-protocol' -import type { - RemoteRuntimeSubscription, - RemoteRuntimeSubscriptionCallbacks -} from '../../../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' - -const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ - subscribeRemoteRuntimeRequestMock: vi.fn() -})) - -vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ - subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock -})) - -import { PairedRuntimeBrowserClientHost } from './paired-runtime-browser-client-host' -import { PairedRuntimeBrowserHostLease } from '../leases/paired-runtime-browser-host-lease' - -const pairing = pairedRuntimeConnectionFromOffer({ - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'device-token', - publicKeyB64: 'public-key', - pairedDeviceId: 'device-a' -}) - -afterEach(() => { - subscribeRemoteRuntimeRequestMock.mockReset() - vi.restoreAllMocks() -}) - -describe('PairedRuntimeBrowserClientHost', () => { - it('forwards a complete inventory provider to the lease attach', async () => { - const { callbacks } = subscribeHost() - const getPageInventory = vi.fn(() => [] as readonly BrowserClientHostedPageInventory[]) - const host = createHost(() => ({ status: 'completed' }), undefined, undefined, getPageInventory) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - - expect(getPageInventory).toHaveBeenCalledOnce() - expect(subscribeRemoteRuntimeRequestMock).toHaveBeenCalledWith( - pairing, - 'browser.clientHost.attach', - expect.objectContaining({ - pageInventoryProtocolVersion: 1, - pageInventory: [], - leaseReconnectProtocolVersion: 1 - }), - expect.any(Number), - expect.any(Object), - expect.any(Object) - ) - // Retries share a deadline; clock ticks can reduce the first attach timeout. - const attachTimeoutMs = subscribeRemoteRuntimeRequestMock.mock.calls[0]?.[3] - expect(attachTimeoutMs).toBeLessThanOrEqual(15_000) - expect(attachTimeoutMs).toBeGreaterThan(14_000) - expect(subscribeRemoteRuntimeRequestMock.mock.calls[0]?.[2]).not.toHaveProperty( - 'pageReconciliationProtocolVersion' - ) - callbacks.current!.onResponse(readyResponse()) - await starting - await host.close() - }) - - it('advertises reconciliation only when the composed host enables it', async () => { - const { callbacks } = subscribeHost() - const host = createHost( - () => ({ status: 'completed' }), - undefined, - undefined, - () => [], - 1 - ) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - - expect(subscribeRemoteRuntimeRequestMock.mock.calls[0]?.[2]).toMatchObject({ - pageCommandProtocolVersion: 1, - pageInventoryProtocolVersion: 1, - pageReconciliationProtocolVersion: 1 - }) - callbacks.current!.onResponse({ - ...readyResponse(), - result: { - ...readyResponse().result, - pageInventoryProtocolVersion: 1, - pageReconciliationProtocolVersion: 1 - } - }) - await expect(starting).resolves.toMatchObject({ pageReconciliationProtocolVersion: 1 }) - await host.close() - }) - - it('constructs command authority before the first command can arrive', async () => { - const { callbacks, sendRequest } = subscribeHost() - const handler = vi.fn((_command: BrowserClientHostCommandEvent, _signal: AbortSignal) => ({ - status: 'completed' as const - })) - const host = createHost(handler) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - - callbacks.current!.onResponse(readyResponse()) - callbacks.current!.onResponse(commandResponse()) - - await expect(starting).resolves.toMatchObject({ - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - pageCommandProtocolVersion: 1 - }) - await vi.waitFor(() => expect(handler).toHaveBeenCalledOnce()) - expect(handler.mock.calls[0][0]).toMatchObject({ - browserPageId: 'page-a', - pageHostGeneration: 1 - }) - await vi.waitFor(() => expect(sendRequest).toHaveBeenCalledOnce()) - await host.close() - }) - - it('closes transport first and aborts every owned page handler', async () => { - const { callbacks, close } = subscribeHost() - const order: string[] = [] - close.mockImplementation(() => { - order.push('transport-close') - }) - const observed: { signal: AbortSignal | null } = { signal: null } - const handler = vi.fn( - (_command: BrowserClientHostCommandEvent, signal: AbortSignal) => - new Promise((resolve) => { - observed.signal = signal - signal.addEventListener( - 'abort', - () => { - order.push('handler-abort') - resolve({ status: 'failed', errorCode: 'browser_host_command_cancelled' }) - }, - { once: true } - ) - }) - ) - const host = createHost(handler) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - await starting - callbacks.current!.onResponse(commandResponse()) - await vi.waitFor(() => expect(handler).toHaveBeenCalledOnce()) - - await expect(host.close()).resolves.toBe(true) - - expect(close).toHaveBeenCalledOnce() - expect(observed.signal?.aborted).toBe(true) - expect(order).toEqual(['transport-close', 'handler-abort']) - }) - - it('aborts owned handlers even when lease cleanup rejects', async () => { - const { callbacks } = subscribeHost() - let aborted = false - const host = createHost( - (_command, signal) => - new Promise((resolve) => { - signal.addEventListener( - 'abort', - () => { - aborted = true - resolve({ status: 'failed', errorCode: 'browser_host_command_cancelled' }) - }, - { once: true } - ) - }) - ) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - await starting - callbacks.current!.onResponse(commandResponse()) - await vi.waitFor(() => expect(aborted).toBe(false)) - vi.spyOn(PairedRuntimeBrowserHostLease.prototype, 'close').mockRejectedValueOnce( - new Error('lease cleanup failed') - ) - - await expect(host.close()).rejects.toThrow('lease cleanup failed') - expect(aborted).toBe(true) - }) - - it('preserves a falsy lease cleanup rejection across cached close calls', async () => { - const host = createHost(() => ({ status: 'completed' })) - vi.spyOn(PairedRuntimeBrowserHostLease.prototype, 'close').mockRejectedValueOnce(undefined) - - await expect(host.close()).rejects.toThrow('undefined') - await expect(host.close()).rejects.toThrow('undefined') - }) - - it('aborts owned handlers when the lease transport fails', async () => { - const { callbacks } = subscribeHost() - const onError = vi.fn() - let aborted = false - const host = createHost( - (_command, signal) => - new Promise((resolve) => { - signal.addEventListener( - 'abort', - () => { - aborted = true - resolve({ status: 'failed', errorCode: 'browser_host_command_cancelled' }) - }, - { once: true } - ) - }), - onError - ) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - await starting - callbacks.current!.onResponse(commandResponse()) - await vi.waitFor(() => expect(aborted).toBe(false)) - - callbacks.current!.onError( - new RemoteRuntimeClientError('remote_runtime_unavailable', 'transport failed') - ) - - await vi.waitFor(() => expect(aborted).toBe(true)) - expect(onError).toHaveBeenCalledWith(expect.objectContaining({ message: 'transport failed' })) - }) - - it('retires and forgets only the exact page generation', async () => { - const { callbacks } = subscribeHost() - const handler = vi.fn( - (_command: BrowserClientHostCommandEvent, signal: AbortSignal) => - new Promise((resolve) => { - signal.addEventListener( - 'abort', - () => resolve({ status: 'failed', errorCode: 'browser_host_command_cancelled' }), - { once: true } - ) - }) - ) - const host = createHost(handler) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - await starting - callbacks.current!.onResponse(commandResponse()) - await vi.waitFor(() => expect(handler).toHaveBeenCalledOnce()) - - await expect(host.retirePage('page-a', 2)).rejects.toThrow('browser_host_page_generation_stale') - await expect(host.retirePage('page-a', 1)).resolves.toBe(true) - expect(host.forgetPage('page-a', 2)).toBe(false) - expect(host.forgetPage('page-a', 1)).toBe(true) - await host.close() - }) - - it('keeps timed-out retirement fenced until the exact late handler settles', async () => { - const { callbacks } = subscribeHost() - const stuck = deferredCommandResult() - const host = createHost(() => stuck.promise, undefined, { joinTimeoutMs: 10 }) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - await starting - callbacks.current!.onResponse(commandResponse()) - - await expect(host.retirePage('page-a', 1)).resolves.toBe(false) - expect(host.forgetPage('page-a', 1)).toBe(false) - stuck.resolve({ status: 'completed' }) - await expect(host.retirePage('page-a', 1)).resolves.toBe(true) - expect(host.forgetPage('page-a', 1)).toBe(true) - await host.close() - }) - - it('exposes exact late handler settlement after bounded close', async () => { - const { callbacks } = subscribeHost() - const stuck = deferredCommandResult() - const host = createHost(() => stuck.promise, undefined, { joinTimeoutMs: 10 }) - const starting = host.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - await starting - callbacks.current!.onResponse(commandResponse()) - - await expect(host.close()).resolves.toBe(false) - let handlersSettled = false - void host.whenHandlersSettled().then(() => { - handlersSettled = true - }) - await Promise.resolve() - expect(handlersSettled).toBe(false) - - stuck.resolve({ status: 'completed' }) - await expect(host.whenHandlersSettled()).resolves.toBeUndefined() - }) -}) - -function subscribeHost(): { - callbacks: { current?: RemoteRuntimeSubscriptionCallbacks } - close: ReturnType - sendRequest: ReturnType -} { - const callbacks: { current?: RemoteRuntimeSubscriptionCallbacks } = {} - const close = vi.fn() - const sendRequest = vi.fn().mockResolvedValue({ - id: 'command-result', - ok: true, - result: { accepted: true }, - _meta: { runtimeId: 'runtime-a' } - }) - subscribeRemoteRuntimeRequestMock.mockImplementationOnce( - async (...args: unknown[]): Promise => { - callbacks.current = args[4] as RemoteRuntimeSubscriptionCallbacks - return { - requestId: 'browser-host', - close, - sendBinary: () => false, - sendRequest - } - } - ) - return { callbacks, close, sendRequest } -} - -function createHost( - handler: ( - command: BrowserClientHostCommandEvent, - signal: AbortSignal - ) => BrowserClientHostCommandResult | Promise, - onError?: (error: Error) => void, - dispatcher?: { joinTimeoutMs?: number }, - getPageInventory?: () => readonly BrowserClientHostedPageInventory[], - pageReconciliationProtocolVersion?: 1 -): PairedRuntimeBrowserClientHost { - return new PairedRuntimeBrowserClientHost({ - connection: pairing, - authorityRuntimeId: 'runtime-a', - browserHostClientId: 'host-a', - hostCapabilities: ['webview'], - handler, - getPageInventory, - ...(pageReconciliationProtocolVersion ? { pageReconciliationProtocolVersion } : {}), - onError, - dispatcher - }) -} - -function deferredCommandResult(): { - promise: Promise - resolve: (result: BrowserClientHostCommandResult) => void -} { - let resolve = (_result: BrowserClientHostCommandResult): void => {} - const promise = new Promise((innerResolve) => { - resolve = innerResolve - }) - return { promise, resolve } -} - -function readyResponse() { - return { - id: 'browser-host', - ok: true as const, - result: { - type: 'ready' as const, - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - pageCommandProtocolVersion: 1 as const - }, - _meta: { runtimeId: 'runtime-a' } - } -} - -function commandResponse() { - return { - id: 'browser-host', - ok: true as const, - result: { - type: 'command' as const, - pageCommandProtocolVersion: 1 as const, - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'host-a', - browserHostGeneration: 4, - browserPageId: 'page-a', - pageHostGeneration: 1, - commandSequence: 1, - commandId: 'command-a', - command: { - type: 'createPage' as const, - browserProfileId: 'default', - executionHostKey: 'native:runtime-a:1' - } - }, - _meta: { runtimeId: 'runtime-a' } - } -} diff --git a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts b/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts deleted file mode 100644 index 338ca00282e..00000000000 --- a/src/main/browser/client-hosts/lifecycle/paired-runtime-browser-host-reconciliation-negotiation.test.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { pairedRuntimeConnectionFromOffer } from '../../../../shared/remote-runtime/pairing/paired-runtime-connection' -import { afterEach, describe, expect, it, vi } from 'vitest' -import type { PairingOffer } from '../../../../shared/remote-runtime/pairing/mobile-relay-pairing-offer' -import type { - RemoteRuntimeSubscription, - RemoteRuntimeSubscriptionCallbacks -} from '../../../../shared/remote-runtime/remote-runtime-client' -import { RemoteRuntimeClientError } from '../../../../shared/remote-runtime/remote-runtime-client-error' - -const { subscribeRemoteRuntimeRequestMock } = vi.hoisted(() => ({ - subscribeRemoteRuntimeRequestMock: vi.fn() -})) - -vi.mock('../../../../shared/remote-runtime/remote-runtime-client', () => ({ - subscribeRemoteRuntimeRequest: subscribeRemoteRuntimeRequestMock -})) - -import { PairedRuntimeBrowserHostLease } from '../leases/paired-runtime-browser-host-lease' -import type { PairedRuntimeBrowserHostLeaseOptions } from '../leases/paired-runtime-browser-host-lease-options' - -const pairing = { - v: 2, - endpoint: 'ws://127.0.0.1:6768', - deviceToken: 'device-token', - publicKeyB64: 'public-key', - pairedDeviceId: 'device-a', - scope: 'runtime' -} as PairingOffer - -afterEach(() => { - subscribeRemoteRuntimeRequestMock.mockReset() -}) - -describe('paired runtime browser-host reconciliation negotiation', () => { - it('falls back without enabling reconciliation when an older host omits the echo', async () => { - const callbacks: { current?: RemoteRuntimeSubscriptionCallbacks } = {} - subscribeRemoteRuntimeRequestMock.mockImplementationOnce( - async (...args: unknown[]): Promise => { - callbacks.current = args[4] as RemoteRuntimeSubscriptionCallbacks - return { - requestId: 'browser-host', - close: vi.fn(), - sendBinary: () => false, - sendRequest: vi.fn() - } - } - ) - const lease = createLease() - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse()) - - await expect(starting).resolves.not.toHaveProperty('pageReconciliationProtocolVersion') - await lease.close() - }) - - it('rejects an unsolicited or dependency-inconsistent reconciliation echo', async () => { - const callbacks: { current?: RemoteRuntimeSubscriptionCallbacks } = {} - subscribeRemoteRuntimeRequestMock.mockImplementation( - async (...args: unknown[]): Promise => { - callbacks.current = args[4] as RemoteRuntimeSubscriptionCallbacks - return { - requestId: 'browser-host', - close: vi.fn(), - sendBinary: () => false, - sendRequest: vi.fn() - } - } - ) - const unsolicited = createLease({ pageReconciliationProtocolVersion: undefined }) - const unsolicitedStart = unsolicited.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageReconciliationProtocolVersion: 1 })) - await expect(unsolicitedStart).rejects.toThrow('Invalid browser host lease response') - - subscribeRemoteRuntimeRequestMock.mockReset() - callbacks.current = undefined - subscribeRemoteRuntimeRequestMock.mockImplementation( - async (...args: unknown[]): Promise => { - callbacks.current = args[4] as RemoteRuntimeSubscriptionCallbacks - return { - requestId: 'browser-host', - close: vi.fn(), - sendBinary: () => false, - sendRequest: vi.fn() - } - } - ) - const inconsistent = createLease() - const inconsistentStart = inconsistent.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse({ - ...readyResponse({ pageReconciliationProtocolVersion: 1 }), - result: { - ...readyResponse({ pageReconciliationProtocolVersion: 1 }).result, - pageInventoryProtocolVersion: undefined - } - }) - await expect(inconsistentStart).rejects.toThrow('Invalid browser host lease response') - }) - - it('rejects reconciliation downgrade during exact reconnect', async () => { - const callbacks: RemoteRuntimeSubscriptionCallbacks[] = [] - const onError = vi.fn() - subscribeRemoteRuntimeRequestMock.mockImplementation( - async (...args: unknown[]): Promise => { - callbacks.push(args[4] as RemoteRuntimeSubscriptionCallbacks) - return { - requestId: `browser-host-${callbacks.length}`, - close: vi.fn(), - sendBinary: () => false, - sendRequest: vi.fn() - } - } - ) - const lease = createLease({ reconnectRetryDelayMs: 1, onError }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks).toHaveLength(1)) - callbacks[0]!.onResponse(readyResponse({ pageReconciliationProtocolVersion: 1 })) - await starting - - callbacks[0]!.onError( - new RemoteRuntimeClientError('remote_runtime_unavailable', 'transport closed') - ) - await vi.waitFor(() => expect(callbacks).toHaveLength(2)) - callbacks[1]!.onResponse(readyResponse()) - await vi.waitFor(() => expect(onError).toHaveBeenCalledOnce()) - - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Browser host lease authority changed in place' }) - ) - await lease.close() - }) - - it('refuses a page command that drops the negotiated reconciliation protocol', async () => { - const callbacks: { current?: RemoteRuntimeSubscriptionCallbacks } = {} - const close = vi.fn() - subscribeRemoteRuntimeRequestMock.mockImplementationOnce( - async (...args: unknown[]): Promise => { - callbacks.current = args[4] as RemoteRuntimeSubscriptionCallbacks - return { requestId: 'browser-host', close, sendBinary: () => false, sendRequest: vi.fn() } - } - ) - const onError = vi.fn() - const onPageCommand = vi.fn() - const lease = createLease({ onError, onPageCommand }) - const starting = lease.start() - await vi.waitFor(() => expect(callbacks.current).toBeDefined()) - callbacks.current!.onResponse(readyResponse({ pageReconciliationProtocolVersion: 1 })) - await starting - - callbacks.current!.onResponse({ - id: 'browser-host', - ok: true, - result: { - type: 'command', - pageCommandProtocolVersion: 1, - authorityRuntimeId: 'runtime-a', - authorityEpoch: 'epoch-a', - browserHostClientId: 'host-a', - browserHostGeneration: 4, - browserPageId: 'page-a', - pageHostGeneration: 1, - commandSequence: 1, - commandId: 'command-a', - command: { - type: 'createPage', - browserProfileId: 'default', - executionHostKey: 'native:runtime-a:1' - } - }, - _meta: { runtimeId: 'runtime-a' } - }) - - await vi.waitFor(() => expect(close).toHaveBeenCalledOnce()) - expect(onPageCommand).not.toHaveBeenCalled() - expect(onError).toHaveBeenCalledWith( - expect.objectContaining({ message: 'Unnegotiated browser host page command' }) - ) - }) -}) - -function createLease( - overrides: Partial = {} -): PairedRuntimeBrowserHostLease { - return new PairedRuntimeBrowserHostLease({ - connection: pairedRuntimeConnectionFromOffer(pairing), - authorityRuntimeId: 'runtime-a', - browserHostClientId: 'host-a', - hostCapabilities: ['webview'], - pageCommandProtocolVersion: 1, - pageInventoryProtocolVersion: 1, - pageReconciliationProtocolVersion: 1, - leaseReconnectProtocolVersion: 1, - getPageInventory: () => [], - onPageCommand: async () => ({ status: 'completed' }), - ...overrides - }) -} - -function readyResponse(overrides: { pageReconciliationProtocolVersion?: 1 } = {}) { - return { - id: 'browser-host', - ok: true as const, - result: { - type: 'ready' as const, - authorityEpoch: 'epoch-a', - browserHostGeneration: 4, - pageCommandProtocolVersion: 1 as const, - pageInventoryProtocolVersion: 1 as const, - leaseReconnectProtocolVersion: 1 as const, - ...overrides - }, - _meta: { runtimeId: 'runtime-a' } - } -} diff --git a/src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts b/src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts index 15002a2a67e..10036b9b96e 100644 --- a/src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-executor-fencing.test.ts @@ -4,125 +4,6 @@ import { createCommand, createHarness } from './browser-client-page-command-exec describe('BrowserClientPageCommandExecutor authority fencing', () => { beforeEach(() => vi.restoreAllMocks()) - it('does not retain a page when close races its in-flight creation', async () => { - const { dependencies, executor, order, route } = createHarness() - let resolveRoute = (_route: typeof route): void => {} - dependencies.retainNetworkRoute.mockImplementationOnce( - () => - new Promise((resolve) => { - resolveRoute = resolve - }) - ) - const creating = executor.handle(createCommand('createPage'), new AbortController().signal) - await Promise.resolve() - - await expect(executor.close()).rejects.toThrow('Browser client page executor cleanup failed') - resolveRoute(route) - - await expect(creating).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_executor_closed' - }) - expect(executor.hasPage('page-a', 7)).toBe(false) - expect(order).toEqual(['release-route']) - }) - - it('retires every retained page before fencing later commands', async () => { - const { executor, order } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - - await executor.close() - - expect(order.slice(-6)).toEqual([ - 'revoke-navigation', - 'release-guest', - 'retire-guest', - 'retire-renderer-page', - 'release-session', - 'release-route' - ]) - await expect( - executor.handle(createCommand('navigate'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_executor_closed' - }) - }) - - it('revokes retained navigation once without inferring guest destruction', async () => { - const { dependencies, executor, order, route } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - - executor.fenceNavigation() - executor.fenceNavigation() - - expect(dependencies.routeWebContents.revokeNavigation).toHaveBeenCalledOnce() - expect(order.at(-1)).toBe('revoke-navigation') - expect(route.release).not.toHaveBeenCalled() - await expect( - executor.handle(createCommand('navigate'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_executor_closed' - }) - await executor.close() - }) - - it('retains inventory while fencing old pages and uses the replacement route identity', async () => { - const { dependencies, executor } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - - executor.beginAuthorityTransition() - - expect(executor.snapshotPageInventory()).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', authorityRuntimeId: 'runtime-a' }) - ]) - expect(dependencies.routeWebContents.revokeNavigation).toHaveBeenCalledOnce() - await expect( - executor.handle(createCommand('navigate'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_executor_closed' - }) - - executor.completeAuthorityTransition({ - authorityConnectionIdentity: 'authority-record-b', - pairingAuthorityConnectionIdentity: 'pairing-authority-record-b', - legacyAuthorityConnectionIdentity: 'legacy-authority-record-b' - }) - await expect( - executor.handle( - createCommand('navigate', { - authorityRuntimeId: 'runtime-b', - authorityEpoch: 'epoch-b', - browserHostGeneration: 1 - }), - new AbortController().signal - ) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_generation_stale' - }) - expect(dependencies.routeWebContents.navigateGuest).not.toHaveBeenCalled() - - await executor.retirePage('page-a', 7) - await executor.handle( - createCommand('createPage', { - authorityRuntimeId: 'runtime-b', - authorityEpoch: 'epoch-b', - browserPageId: 'page-b', - pageHostGeneration: 1 - }), - new AbortController().signal - ) - - expect(dependencies.routeSessions.preparePage).toHaveBeenLastCalledWith( - expect.objectContaining({ - identity: expect.objectContaining({ authorityConnectionIdentity: 'authority-record-b' }) - }) - ) - }) - it('releases an in-flight old-authority create during transition', async () => { const { dependencies, executor, order, route } = createHarness() let resolveRoute = (_route: typeof route): void => {} @@ -152,62 +33,4 @@ describe('BrowserClientPageCommandExecutor authority fencing', () => { }) await executor.close() }) - - it('keeps transition fail-closed when navigation revocation throws', async () => { - const { dependencies, executor, order } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - dependencies.routeWebContents.revokeNavigation.mockImplementationOnce(() => { - order.push('revoke-navigation') - throw new Error('transition revocation failed') - }) - - expect(() => executor.beginAuthorityTransition()).toThrow( - 'Browser client page navigation fencing failed' - ) - await expect( - executor.handle(createCommand('navigate'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_executor_closed' - }) - - await executor.close() - expect(order.slice(-6)).toEqual([ - 'revoke-navigation', - 'release-guest', - 'retire-guest', - 'retire-renderer-page', - 'release-session', - 'release-route' - ]) - }) - - it('continues exact page cleanup when navigation revocation throws', async () => { - const { dependencies, executor, order } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - dependencies.routeWebContents.revokeNavigation.mockImplementationOnce(() => { - order.push('revoke-navigation') - throw new Error('navigation revocation failed') - }) - - await expect(executor.close()).rejects.toMatchObject({ - message: 'Browser client page navigation fencing failed', - errors: [expect.objectContaining({ message: 'navigation revocation failed' })] - }) - - expect(order.slice(-6)).toEqual([ - 'revoke-navigation', - 'release-guest', - 'retire-guest', - 'retire-renderer-page', - 'release-session', - 'release-route' - ]) - await expect( - executor.handle(createCommand('navigate'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_executor_closed' - }) - }) }) diff --git a/src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts b/src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts index a6e57345434..6d0b8c2f832 100644 --- a/src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts +++ b/src/main/browser/client-pages/execution/browser-client-page-command-executor.test.ts @@ -2,284 +2,12 @@ import { beforeEach, describe, expect, it, vi } from 'vitest' import { createCommand, createHarness, - createLifecycleClaim, - partition + createLifecycleClaim } from './browser-client-page-command-executor-test-harness' describe('BrowserClientPageCommandExecutor', () => { beforeEach(() => vi.restoreAllMocks()) - it('keeps legacy-valid command identities when inventory cannot encode them', async () => { - const { executor } = createHarness() - const browserProfileId = '\0'.repeat(256) - - await expect( - executor.handle( - createCommand('createPage', { - command: { type: 'createPage', browserProfileId, executionHostKey: 'execution-host-a' } - }), - new AbortController().signal - ) - ).resolves.toEqual({ status: 'completed' }) - expect(executor.snapshotPageInventory()).toEqual([ - expect.objectContaining({ browserProfileId, state: 'active' }) - ]) - }) - - it('omits a normalized URL that expands beyond the inventory field bound', async () => { - const { dependencies, executor } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - const requestedUrl = `https://example.internal/${'é'.repeat(4_000)}` - - await expect( - executor.handle( - createCommand('navigate', { command: { type: 'navigate', url: requestedUrl } }), - new AbortController().signal - ) - ).resolves.toEqual({ status: 'completed' }) - - expect(dependencies.routeWebContents.navigateGuest).toHaveBeenCalledWith( - expect.any(Object), - expect.stringMatching(/^https:\/\/example\.internal\/%C3%A9%C3%A9/) - ) - expect(executor.snapshotPageInventory()[0]).not.toHaveProperty('currentUrl') - }) - - it('snapshots in-flight and unresolved pages as outcome unknown', async () => { - const { dependencies, executor, route } = createHarness() - let resolveRoute = (_route: typeof route): void => {} - dependencies.retainNetworkRoute.mockImplementationOnce( - () => - new Promise((resolve) => { - resolveRoute = resolve - }) - ) - const creating = executor.handle(createCommand('createPage'), new AbortController().signal) - await Promise.resolve() - - const inFlight = executor.snapshotPageInventory() - expect(inFlight).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'outcomeUnknown' }) - ]) - expect(Object.isFrozen(inFlight)).toBe(true) - expect(Object.isFrozen(inFlight[0])).toBe(true) - - resolveRoute(route) - await expect(creating).resolves.toEqual({ status: 'completed' }) - expect(executor.snapshotPageInventory()).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'active' }) - ]) - }) - - it('never duplicates a page during its create-to-active transition', async () => { - const { dependencies, executor, order } = createHarness() - let transitionSnapshot: ReturnType = [] - dependencies.routeWebContents.grantNavigation.mockImplementationOnce(() => { - order.push('grant-navigation') - queueMicrotask(() => { - transitionSnapshot = executor.snapshotPageInventory() - }) - return true - }) - - await executor.handle(createCommand('createPage'), new AbortController().signal) - - expect(transitionSnapshot).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'active' }) - ]) - }) - - it('never reports a page as active after its renderer authority is replaced', async () => { - const { executor, setRendererCurrent } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - - setRendererCurrent(false) - - expect(executor.snapshotPageInventory()).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'outcomeUnknown' }) - ]) - }) - - it('rejects stale generations and local-file navigation without touching Chromium', async () => { - const { dependencies, executor } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - - const stale = createCommand('navigate', { pageHostGeneration: 8 }) - await expect(executor.handle(stale, new AbortController().signal)).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_generation_stale' - }) - const localFile = createCommand('navigate', { - command: { type: 'navigate', url: 'file:///etc/passwd' } - }) - await expect(executor.handle(localFile, new AbortController().signal)).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_navigation_invalid' - }) - expect(dependencies.routeWebContents.navigateGuest).not.toHaveBeenCalled() - }) - - it('releases every exact resource when guest registration fails', async () => { - const { dependencies, executor, order } = createHarness() - dependencies.routeWebContents.registerGuest.mockImplementationOnce(() => { - order.push('register-guest') - return false - }) - - await expect( - executor.handle(createCommand('createPage'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_guest_registration_failed' - }) - - expect(order).toEqual([ - 'retain-route', - 'prepare-page', - 'mount-page', - 'claim-guest', - 'register-guest', - 'retire-guest', - 'retire-renderer-page', - 'release-session', - 'release-route' - ]) - expect(executor.hasPage('page-a', 7)).toBe(false) - }) - - it('holds network resources when guest retirement cannot be confirmed', async () => { - const { dependencies, executor, order, route, routeSession } = createHarness() - dependencies.routeWebContents.registerGuest.mockImplementationOnce(() => { - order.push('register-guest') - return false - }) - dependencies.routeWebContents.claimGuestLifecycle.mockImplementationOnce((registration) => { - order.push('claim-guest') - return createLifecycleClaim( - registration, - Promise.reject(new Error('guest destruction unavailable')) - ) - }) - dependencies.routeWebContents.beginGuestRetirement.mockImplementationOnce(() => { - order.push('retire-guest') - throw new Error('guest cleanup failed') - }) - - await expect( - executor.handle(createCommand('createPage'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_cleanup_failed' - }) - expect(order.slice(-2)).toEqual(['retire-guest', 'retire-renderer-page']) - expect(routeSession.release).not.toHaveBeenCalled() - expect(route.release).not.toHaveBeenCalled() - expect(executor.hasUnresolvedPage('page-a', 7)).toBe(true) - await expect( - executor.handle( - createCommand('createPage', { pageHostGeneration: 8 }), - new AbortController().signal - ) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_generation_conflict' - }) - }) - - it('holds network resources when a failed mount may have created a guest', async () => { - const { executor, order, renderer, route, routeSession } = createHarness() - renderer.mountPage.mockImplementationOnce(async () => { - order.push('mount-page') - throw new Error('mount outcome unknown') - }) - await expect( - executor.handle(createCommand('createPage'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_cleanup_failed' - }) - expect(order.slice(-2)).toEqual(['mount-page', 'retire-renderer-page']) - expect(routeSession.release).not.toHaveBeenCalled() - expect(route.release).not.toHaveBeenCalled() - expect(executor.snapshotPageInventory()).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'outcomeUnknown' }) - ]) - await expect( - executor.handle( - createCommand('createPage', { pageHostGeneration: 8 }), - new AbortController().signal - ) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_generation_conflict' - }) - }) - - it('fails closed if the selected renderer is replaced during creation', async () => { - const { dependencies, executor, renderer, setRendererCurrent } = createHarness() - renderer.mountPage.mockImplementationOnce(async () => { - setRendererCurrent(false) - return { webContentsId: 41 } - }) - - await expect( - executor.handle(createCommand('createPage'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_renderer_stale' - }) - expect(dependencies.routeWebContents.registerGuest).not.toHaveBeenCalled() - expect(dependencies.routeWebContents.beginGuestRetirement).toHaveBeenCalledOnce() - expect(renderer.retirePage).toHaveBeenCalledOnce() - expect(executor.hasUnresolvedPage('page-a', 7)).toBe(false) - }) - - it('cleans up an exact mounted guest when creation is aborted', async () => { - const { dependencies, executor, renderer } = createHarness() - const controller = new AbortController() - renderer.mountPage.mockImplementationOnce(async () => { - controller.abort() - return { webContentsId: 41 } - }) - - await expect(executor.handle(createCommand('createPage'), controller.signal)).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_command_aborted' - }) - expect(dependencies.routeWebContents.registerGuest).not.toHaveBeenCalled() - expect(dependencies.routeWebContents.beginGuestRetirement).toHaveBeenCalledOnce() - expect(renderer.retirePage).toHaveBeenCalledOnce() - }) - - it('retires only the exact generation before admitting its replacement', async () => { - const { dependencies, executor, order } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - - await expect(executor.retirePage('page-a', 8)).resolves.toBe(false) - expect(executor.hasPage('page-a', 7)).toBe(true) - expect(dependencies.guestBinding.release).not.toHaveBeenCalled() - await expect(executor.retirePage('page-a', 7)).resolves.toBe(true) - expect(dependencies.guestBinding.release).toHaveBeenCalledWith({ - partition, - browserPageId: 'page-a', - pageHostGeneration: 7, - rendererWebContentsId: 11, - webContentsId: 41 - }) - expect(order.slice(-5)).toEqual([ - 'release-guest', - 'retire-guest', - 'retire-renderer-page', - 'release-session', - 'release-route' - ]) - - const replacement = createCommand('createPage', { pageHostGeneration: 8 }) - await expect(executor.handle(replacement, new AbortController().signal)).resolves.toEqual({ - status: 'completed' - }) - }) - it('holds Session and route release for the exact destroyed acknowledgement', async () => { const { dependencies, executor, order } = createHarness() let acknowledgeDestroyed = (): void => {} @@ -312,166 +40,4 @@ describe('BrowserClientPageCommandExecutor', () => { 'release-route' ]) }) - - it('moves a failed retirement into immutable outcome-unknown inventory', async () => { - const { executor, order, renderer } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - renderer.retirePage.mockImplementationOnce(async () => { - order.push('retire-renderer-page') - throw new Error('renderer cleanup failed') - }) - - await expect(executor.retirePage('page-a', 7)).rejects.toThrow( - 'Browser client page cleanup failed' - ) - expect(order.slice(-4)).toEqual([ - 'retire-guest', - 'retire-renderer-page', - 'release-session', - 'release-route' - ]) - expect(executor.hasPage('page-a', 7)).toBe(false) - expect(executor.hasUnresolvedPage('page-a', 7)).toBe(true) - const inventory = executor.snapshotPageInventory() - expect(inventory).toEqual([ - expect.objectContaining({ browserPageId: 'page-a', state: 'outcomeUnknown' }) - ]) - expect(Object.isFrozen(inventory[0])).toBe(true) - expect(executor.hasUnresolvedPage('page-a', 8)).toBe(false) - await expect(executor.retirePage('page-a', 7)).resolves.toBe(false) - await expect( - executor.handle( - createCommand('createPage', { pageHostGeneration: 8 }), - new AbortController().signal - ) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_generation_conflict' - }) - await expect(executor.close()).rejects.toMatchObject({ - message: 'Browser client page executor cleanup failed', - errors: [expect.objectContaining({ message: 'browser_client_page_cleanup_unresolved' })] - }) - }) - - it('reports every page whose cleanup fails during close', async () => { - const { executor, order, renderer } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - renderer.retirePage.mockImplementationOnce(async () => { - order.push('retire-renderer-page') - throw new Error('renderer cleanup failed') - }) - - await expect(executor.close()).rejects.toMatchObject({ - message: 'Browser client page executor cleanup failed', - errors: [expect.objectContaining({ message: 'Browser client page cleanup failed' })] - }) - }) - - it('joins an in-flight retirement instead of running cleanup twice', async () => { - const { executor, order } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - - const [first, second] = await Promise.all([ - executor.retirePage('page-a', 7), - executor.retirePage('page-a', 7) - ]) - - expect([first, second]).toEqual([true, true]) - expect(order.filter((step) => step === 'release-route')).toHaveLength(1) - expect(order.filter((step) => step === 'release-session')).toHaveLength(1) - }) - - it('refuses an authority transition on a closed executor', async () => { - const { executor } = createHarness() - await executor.handle(createCommand('createPage'), new AbortController().signal) - await executor.close() - - expect(() => executor.beginAuthorityTransition()).toThrow( - 'browser_client_page_authority_transition_unavailable' - ) - }) - - it('refuses to complete an authority transition that never began', () => { - const { executor } = createHarness() - - expect(() => - executor.completeAuthorityTransition({ - authorityConnectionIdentity: 'authority-record-b', - pairingAuthorityConnectionIdentity: 'pairing-authority-record-b', - legacyAuthorityConnectionIdentity: 'legacy-authority-record-b' - }) - ).toThrow('browser_client_page_authority_transition_unavailable') - }) - - it('waits for guest destruction when renderer retirement fails', async () => { - const { dependencies, executor, order, renderer } = createHarness() - let acknowledgeDestroyed = (): void => {} - const destroyed = new Promise((resolve) => { - acknowledgeDestroyed = resolve - }) - dependencies.routeWebContents.claimGuestLifecycle.mockImplementationOnce((registration) => { - order.push('claim-guest') - return createLifecycleClaim(registration, destroyed) - }) - dependencies.routeWebContents.beginGuestRetirement.mockImplementationOnce(() => { - order.push('retire-guest') - return destroyed - }) - renderer.retirePage.mockImplementationOnce(async () => { - order.push('retire-renderer-page') - throw new Error('renderer cleanup failed') - }) - await executor.handle(createCommand('createPage'), new AbortController().signal) - - const retiring = executor.retirePage('page-a', 7) - await Promise.resolve() - await Promise.resolve() - expect(order.slice(-2)).toEqual(['retire-guest', 'retire-renderer-page']) - - acknowledgeDestroyed() - await expect(retiring).rejects.toThrow('Browser client page cleanup failed') - expect(order.slice(-4)).toEqual([ - 'retire-guest', - 'retire-renderer-page', - 'release-session', - 'release-route' - ]) - }) - - it('rejects a route resolved for a different execution host and releases it', async () => { - const { dependencies, executor, route } = createHarness() - route.key = 'execution-host-b' - - await expect( - executor.handle(createCommand('createPage'), new AbortController().signal) - ).resolves.toEqual({ - status: 'failed', - errorCode: 'browser_client_page_execution_host_stale' - }) - expect(dependencies.routeSessions.preparePage).not.toHaveBeenCalled() - expect(route.release).toHaveBeenCalledOnce() - }) - - it('bounds retained and concurrently creating page generations', async () => { - const { dependencies, executor, route } = createHarness({ maxPages: 1 }) - let resolveRoute = (_route: typeof route): void => {} - dependencies.retainNetworkRoute.mockImplementationOnce( - () => - new Promise((resolve) => { - resolveRoute = resolve - }) - ) - - const first = executor.handle(createCommand('createPage'), new AbortController().signal) - await Promise.resolve() - await expect( - executor.handle( - createCommand('createPage', { browserPageId: 'page-b', commandId: 'create-b' }), - new AbortController().signal - ) - ).resolves.toEqual({ status: 'failed', errorCode: 'browser_client_page_capacity' }) - resolveRoute(route) - await expect(first).resolves.toEqual({ status: 'completed' }) - }) }) diff --git a/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts index e61f95b9c1e..284c7ec9833 100644 --- a/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts +++ b/src/main/browser/client-pages/lifecycle/browser-client-page-profile-switch.test.ts @@ -49,84 +49,6 @@ async function fixture( } describe('staged client page profile switching', () => { - it('prepares a separate partition and guest before retiring the authenticated old guest', async () => { - const h = await fixture() - let retired = false - h.dependencies.routeWebContents.beginGuestRetirement.mockImplementation(() => { - retired = true - expect(h.bindReplacement).toHaveBeenCalledWith( - expect.objectContaining({ - registration: expect.objectContaining({ - webContentsId: 42, - pageHostGeneration: 8 - }) - }) - ) - return Promise.resolve() - }) - h.bindReplacement.mockImplementation(() => expect(retired).toBe(false)) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toEqual({ - status: 'completed' - }) - expect(h.executor.hasPage('page-a', 8)).toBe(true) - expect(h.executor.hasPage('page-a', 7)).toBe(false) - expect(h.executor.snapshotPageInventory()).toMatchObject([ - { browserProfileId: 'remote-isolated', pageHostGeneration: 8 } - ]) - expect(h.dependencies.routeSessions.preparePage).toHaveBeenLastCalledWith( - expect.objectContaining({ - identity: expect.objectContaining({ - browserProfileId: 'remote-isolated', - authorityConnectionIdentity: 'authority-record-a' - }), - profileMetadata: { - id: 'remote-isolated', - label: 'Remote profile', - scope: 'isolated' - } - }) - ) - }) - - it('preserves the old guest when target preparation fails', async () => { - const h = await fixture() - h.dependencies.routeSessions.preparePage.mockRejectedValueOnce( - new Error('target profile rejected') - ) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed' - }) - expect(h.executor.hasPage('page-a', 7)).toBe(true) - expect(h.dependencies.routeWebContents.beginGuestRetirement).not.toHaveBeenCalled() - expect(h.bindReplacement).not.toHaveBeenCalled() - expect(h.executor.snapshotPageInventory()).toMatchObject([ - { browserProfileId: 'profile-a', state: 'active' } - ]) - }) - - it('retires only the staged guest and restores the old binding when binding fails', async () => { - const h = await fixture() - h.bindReplacement.mockImplementation(() => { - throw new Error('bind failed') - }) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed' - }) - expect(h.executor.hasPage('page-a', 7)).toBe(true) - expect(h.dependencies.routeWebContents.beginGuestRetirement).toHaveBeenCalledTimes(1) - expect(h.dependencies.routeWebContents.beginGuestRetirement).toHaveBeenCalledWith( - expect.objectContaining({ - registration: expect.objectContaining({ webContentsId: 42 }) - }) - ) - expect(h.dependencies.guestBinding.bind).toHaveBeenLastCalledWith( - expect.objectContaining({ - registration: expect.objectContaining({ webContentsId: 41 }), - browserProfileId: 'profile-a' - }) - ) - }) - it('restores the old guest when replacement navigation fails', async () => { const h = await fixture() await h.executor.handle( @@ -161,22 +83,6 @@ describe('staged client page profile switching', () => { ) }) - it('rejects a target partition collision without retiring the old guest', async () => { - const h = await fixture() - h.dependencies.routeSessions.preparePage.mockResolvedValueOnce(h.routeSession) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed', - errorCode: 'browser_client_page_profile_partition_conflict' - }) - expect(h.executor.hasPage('page-a', 7)).toBe(true) - expect(h.bindReplacement).not.toHaveBeenCalled() - expect(h.dependencies.routeWebContents.beginGuestRetirement).toHaveBeenCalledWith( - expect.objectContaining({ - registration: expect.objectContaining({ webContentsId: 42 }) - }) - ) - }) - it('keeps the new availability watcher after retiring the old generation', async () => { const availability = new BrowserRoutePageAvailability() const h = await fixture(availability) @@ -192,147 +98,4 @@ describe('staged client page profile switching', () => { { state: 'outcomeUnknown', pageHostGeneration: 8 } ]) }) - - it('retains unresolved staged cleanup evidence without replacing the old page', async () => { - const h = await fixture() - h.bindReplacement.mockImplementation(() => { - throw new Error('bind failed') - }) - h.dependencies.routeWebContents.beginGuestRetirement.mockImplementationOnce(() => { - throw new Error('cleanup refused') - }) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed' - }) - expect(h.executor.hasPage('page-a', 7)).toBe(true) - await expect(h.executor.close()).rejects.toThrow('Browser client page executor cleanup failed') - }) - - it('fences the staged guest when the connection is fenced during automation retirement', async () => { - const h = await fixture() - await h.executor.handle( - createCommand('navigate', { - command: { type: 'navigate', url: 'https://example.com/authenticated' } - }), - new AbortController().signal - ) - h.dependencies.routeWebContents.navigateGuest.mockClear() - h.dependencies.retireAutomation.mockImplementationOnce(async () => { - h.executor.fenceNavigation() - }) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed', - errorCode: 'browser_client_page_executor_closed' - }) - expect(h.dependencies.routeWebContents.revokeNavigation).toHaveBeenCalledWith( - expect.objectContaining({ - registration: expect.objectContaining({ webContentsId: 42 }) - }) - ) - expect(h.dependencies.routeWebContents.navigateGuest).not.toHaveBeenCalled() - expect(h.bindReplacement).not.toHaveBeenCalled() - expect(h.executor.hasPage('page-a', 7)).toBe(true) - }) - - it('keeps cleanup evidence when staging fails before handing over its guest', async () => { - const h = await fixture() - h.dependencies.routeWebContents.registerGuest.mockReturnValueOnce(false) - h.dependencies.routeWebContents.beginGuestRetirement.mockImplementationOnce(() => { - throw new Error('cleanup refused') - }) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed', - errorCode: 'browser_client_page_cleanup_failed' - }) - expect(h.executor.hasPage('page-a', 7)).toBe(true) - await expect(h.executor.close()).rejects.toThrow('Browser client page executor cleanup failed') - }) - - it('does not commit a replacement guest that died before the switch finished', async () => { - const h = await fixture() - let replacementAlive = true - h.dependencies.routeWebContents.claimGuestLifecycle.mockImplementationOnce((registration) => - createLifecycleClaim(registration, Promise.resolve(), () => replacementAlive) - ) - h.bindReplacement.mockImplementation(() => { - replacementAlive = false - }) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed', - errorCode: 'browser_client_page_generation_stale' - }) - expect(h.executor.hasPage('page-a', 7)).toBe(true) - expect(h.dependencies.routeWebContents.beginGuestRetirement).toHaveBeenCalledTimes(1) - expect(h.dependencies.routeWebContents.beginGuestRetirement).toHaveBeenCalledWith( - expect.objectContaining({ registration: expect.objectContaining({ webContentsId: 42 }) }) - ) - }) - - it('reports an old guest lost during a failed switch so recovery can run', async () => { - let oldAlive = true - const availability = new BrowserRoutePageAvailability() - const h = await fixture(availability, () => oldAlive) - const onPageUnavailable = vi.fn() - Object.assign(h.dependencies, { onPageUnavailable }) - h.dependencies.routeSessions.preparePage.mockImplementationOnce(async () => { - oldAlive = false - availability.report(h.dependencies.routeWebContents.claimGuestLifecycle.mock.calls[0]![0]) - throw new Error('target profile rejected') - }) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toMatchObject({ - status: 'failed' - }) - expect(onPageUnavailable).toHaveBeenCalledWith('page-a', 7) - expect(h.executor.snapshotPageInventory()).toMatchObject([ - { pageHostGeneration: 7, state: 'outcomeUnknown' } - ]) - expect(h.dependencies.guestBinding.bind).toHaveBeenCalledTimes(1) - }) - - it('lets the staged guest own downloads it starts while loading the page', async () => { - const h = await fixture() - await h.executor.handle( - createCommand('navigate', { - command: { type: 'navigate', url: 'https://example.com/report.csv' } - }), - new AbortController().signal - ) - let owner: { pageHostGeneration: number } | undefined - h.dependencies.routeWebContents.navigateGuest.mockImplementationOnce(async () => { - owner = h.executor.findPageByWebContentsId(42) - return true - }) - expect(await h.executor.handle(switchCommand(), new AbortController().signal)).toEqual({ - status: 'completed' - }) - expect(owner).toMatchObject({ browserPageId: 'page-a', pageHostGeneration: 8 }) - }) - - it('rejects stale generations without preparing or binding anything', async () => { - const h = await fixture() - const calls = h.dependencies.routeSessions.preparePage.mock.calls.length - expect( - await h.executor.handle( - { ...switchCommand(), pageHostGeneration: 6 }, - new AbortController().signal - ) - ).toMatchObject({ status: 'failed' }) - expect(h.dependencies.routeSessions.preparePage).toHaveBeenCalledTimes(calls) - expect(h.bindReplacement).not.toHaveBeenCalled() - }) - - it('rolls back an abort after successful target binding', async () => { - const h = await fixture() - const controller = new AbortController() - h.bindReplacement.mockImplementation(() => controller.abort()) - expect(await h.executor.handle(switchCommand(), controller.signal)).toMatchObject({ - status: 'failed' - }) - expect(h.executor.hasPage('page-a', 7)).toBe(true) - expect(h.dependencies.guestBinding.bind).toHaveBeenLastCalledWith( - expect.objectContaining({ - registration: expect.objectContaining({ webContentsId: 41 }) - }) - ) - }) })