Skip to content

test(e2e): fake WSL connector reports a stopped distro as distro-stopped, as production does - #34624

Merged
nwparker merged 1 commit into
mainfrom
nwparker/e2e-fake-wsl-distro-stopped
Oct 28, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/e2e-fake-wsl-distro-stopped

Conversation

@nwparker

@nwparker nwparker commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​13 $\color{#cf222e}{\Huge{\mathbf{−}}}$​1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​12
Prod 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​6 $\color{#cf222e}{\Huge{\mathbf{−}}}$​5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​1

ELI5

The e2e tests use a fake WSL connection, so they can run on any CI machine. When a fake distro was stopped, the fake reported the connection as merely "closed". The real app reports "distro stopped" in that case. Now the fake matches. Only the e2e fake changes.

What Changed

src/main/wsl/wsl-host-e2e-fake-connector.ts is reachable only under ORCA_E2E_FAKE_WSL_HOSTS.

  • Before: when reachability() found a fake distro marked stopped, it dropped the bridge and published { state: 'closed' }.
  • After: it publishes { state: 'distro-stopped', terminals: 'exited', recovering: false }, the same status production liveness publishes when a distro stops (WslOrcadLivenessSupervisor.onDistroStopped).
  • An explicit disconnect() of a running distro still publishes closed.

So, as in production, the host service now records the stopped host as parked off this status, and the UI shows a stopped distro's wording rather than a generic closed one.

Why

The fake should exercise the same status path production does, so e2e results carry over to the real connector. Neither tests/e2e/wsl-host-chat.spec.ts nor tests/e2e/wsl-host-fake-transport.spec.ts asserts on closed. The chat spec's "Ubuntu was stopped" refusal comes from the same parked path either way.

Follow-up enabled: #33911's paired-phone e2e can go back to asserting the "isn't running" wording for a stopped distro once this lands.

Linked Issue

N/A (e2e fidelity).

Visual Proof

N/A: e2e fake only.

Testing

  • wsl-host-e2e-fake-connector.test.ts:

    • the stop case now expects distro-stopped;
    • a new case keeps closed for an explicit disconnect.
    • 4/4 pass.
  • Ran wsl-host-chat.spec.ts and wsl-host-fake-transport.spec.ts locally, hidden (ORCA_BACKGROUND_LAUNCH=1): 2 passed and 2 failed. The failures are at the same lines (chat :170 project focus, fake-transport :351 runtime route) both with and without this change, before either spec stops a distro, so they are local and unrelated. CI runs both specs through the route-contracts selection.

  • pnpm tc:node, oxlint, the anti-slop lint and the changed-code gate pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

E2E-only. There's no production, SSH, mobile or wire impact.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…ge as distro-stopped

Production liveness publishes distro-stopped when a stopped distro loses its
bridge; the e2e fake published closed. An explicit disconnect still reports
closed.
@coderabbitai

coderabbitai Bot commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 70802eab-32a3-4cfe-b396-e4aaacef684d
Commits

Reviewing files that changed from the base of the PR and between 5e9e4c8 and 07200e7.

Files selected for processing: 2
  • src/main/wsl/wsl-host-e2e-fake-connector.test.ts
  • src/main/wsl/wsl-host-e2e-fake-connector.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

Walkthrough

The fake WSL connector now reports distro-stopped with exited terminals and recovery disabled when it detects a stopped distro. Explicit disconnects continue to report closed. Tests cover both notifications and retain the assertion that reconnecting with noBoot: true rejects.

Priority: Low

Merge Risk: Minimal · up to 07200

No actionable merge-blocking risk remains in this E2E-only status update.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within survi… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: the E2E fake WSL connector now reports stopped distros as distro-stopped, matching production behavior.
Description check Passed The description is detailed and mostly follows the repository template. It explains the change, rationale, testing, scope, and checklist status. The linked issue is marked N/A despite the template req…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is detailed and mostly follows the repository template. It explains the change, rationale, testing, scope, and checklist status. The linked issue is marked N/A despite the template requiring an issue, and several review or validation items remain incomplete, but the description is otherwise complete and relevant.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@nwparker
nwparker merged commit 5105fd2 into main Oct 28, 2026
54 checks passed
nwparker added a commit that referenced this pull request Oct 28, 2026
…, and checks nothing booted the distro

Main's fake now publishes 'distro-stopped' when it drops a stopped distro's
bridge (#34624), as liveness does, so the phone gets "isn't running" and
stoppedOnDesktop. The spec also checks distros.json still reads 'stopped' at
the end: the fake boots a distro by rewriting it.
nwparker added a commit that referenced this pull request Oct 28, 2026
…, and checks nothing booted the distro

Main's fake now publishes 'distro-stopped' when it drops a stopped distro's
bridge (#34624), as liveness does, so the phone gets "isn't running" and
stoppedOnDesktop. The spec also checks distros.json still reads 'stopped' at
the end: the fake boots a distro by rewriting it.
nwparker added a commit that referenced this pull request Oct 28, 2026
…, and checks nothing booted the distro

Main's fake now publishes 'distro-stopped' when it drops a stopped distro's
bridge (#34624), as liveness does, so the phone gets "isn't running" and
stoppedOnDesktop. The spec also checks distros.json still reads 'stopped' at
the end: the fake boots a distro by rewriting it.
nwparker added a commit that referenced this pull request Oct 29, 2026
…, and checks nothing booted the distro

Main's fake now publishes 'distro-stopped' when it drops a stopped distro's
bridge (#34624), as liveness does, so the phone gets "isn't running" and
stoppedOnDesktop. The spec also checks distros.json still reads 'stopped' at
the end: the fake boots a distro by rewriting it.
nwparker added a commit that referenced this pull request Oct 29, 2026
…er starts its distro (E6) (#33911)

* feat(wsl-host): a paired phone reaches the desktop's WSL host and never starts its distro (E6)

Behind ORCA_INTERNAL_WSL_HOSTS and the Experimental switch. The desktop relay
lists its WSL hosts to phones. Every relayed call (resolve, call, watchChanges,
status.get) passes a never-start check, and a WSL host serves a phone only
while it already runs.

- WslHostPhoneGate holds the phone's view. The call check reuses E9's
  focusReachability, so with no bridge in this process it refuses without a
  running-list read. A host shows as "stopped" only on a confirmed stop
  (liveness's distro-stopped, or a running list read by the check); anything
  else gets a neutral "isn't available" message. Hosts are hidden from phones
  while the Experimental switch is off or a Remove is pending.
- The relay host list sends optional `stoppedOnDesktop` only for a confirmed
  stop. The phone badges those rows "Start on computer"; older peers ignore
  the field.
- The paired-server rows producer carries WSL hosts like any server, so the
  main-computed sidebar feed a phone reads has their rows.
- The paired-phone e2e drives a WSL host project end to end and asserts a
  stopped distro is never started.

* fix(wsl-host): keep the phone's no-start check off non-WSL servers, and a stale stop off a ready host

- status.get runs the no-start check only for a WSL host, through a
  check-only helper. SSH-managed and paired servers reach the status owner
  exactly as on main: no reconnect, no redeploy, and the manual-disconnect,
  coalescing and repair handling stay in place. The preparation option is
  stripped before the probe.
- WslHostPhoneGate drops a 'stopped' read when a ready status arrived while it
  ran (a per-host ready generation), and clears a recorded stop when a check
  finds the host answering.
- A phone asking about a host that is switched off or being removed gets copy
  that says so, not "open one of its projects".

* test(wsl-host): the real no-start helper leaves SSH-managed and paired servers untouched

* fix(wsl-host): tie a phone's confirmed WSL stop to that host's status, and label a host not connected

- A stop a phone's check confirmed is stored with that host's own status
  object and holds only while that status is current. Another host's change no
  longer clears it. Any status of its own (ready, a disable's closed, a failed
  Remove's closed) does. A read never records a stop over a ready status, so a
  read shared with one begun before ready can't. Removed hosts drop their
  entry. The generation map and status listener are gone.
- The relay sends optional `unavailableOnDesktop` for a WSL host this desktop
  isn't connected to and doesn't know is stopped. New phones badge it "Open on
  computer"; older ones still show Connecting.
- The relay list reads the WSL host records once per poll (reachAll).

* refactor(wsl-host): one records read per phone check; note the gate's status identity compare

* test(wsl-host): read the phone's host flags as booleans in the paired-phone e2e

toMatchObject({ stoppedOnDesktop: undefined }) requires the key to be
present, and the desktop omits an unset flag, so the ready poll could never
match. The poll now compares relay plus both flags read as booleans.

* test(wsl-host): expect the neutral refusal once main's fake drops a stopped distro's bridge as closed

Main's fake connector (#34573) now publishes 'closed' when a stopped distro's
bridge drops, not liveness's 'distro-stopped'. So the phone's check reads the
stop under a ready status and doesn't claim it. The phone gets the neutral
copy and unavailableOnDesktop; the confirmed-stop copy stays unit-tested.

* test(wsl-host): the paired-phone e2e expects the confirmed stop again, and checks nothing booted the distro

Main's fake now publishes 'distro-stopped' when it drops a stopped distro's
bridge (#34624), as liveness does, so the phone gets "isn't running" and
stoppedOnDesktop. The spec also checks distros.json still reads 'stopped' at
the end: the fake boots a distro by rewriting it.

* test(wsl-host): the startup reconcile suite stubs the phone gate built beside the service

The reconcile still runs before the connector exists; the suite only lacked the new
setWslHostPhoneGate export on its service-instance mock.

Co-Authored-By: Claude <[email protected]>

---------

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant