Skip to content

test(remote): assert a reconnect's three decisions without a child process - #1266

Merged
huichen merged 2 commits into
mainfrom
test/reconnect-decision
Oct 20, 2026
Merged

huichen merged 2 commits into
mainfrom
test/reconnect-decision

Conversation

@huichen

@huichen huichen commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

test(remote): assert a reconnect's three decisions without a child process

Supervisor::restart_slot decides one of three things from the pairing book
alone: stop a device the book no longer holds, forget one whose credential cannot
be upgraded in place, refresh one it can. Each was covered only end to end,
through a child Desktop — the most expensive and least stable way to assert a
three-way match.

  • supervisor/start.rs: the decision is split out as
    recovery_plan(&[PairingCreds], &str) -> SlotRecovery, a pure function with no
    broker, no platform and no child; restart_slot matches on it, and each arm
    keeps its own effect (stop_slot, forget_slot, the refresh round trip).
  • supervisor/reconnect_tests.rs: the three decisions plus the file effect of
    Forget (the slot leaves the book, so a device that can never connect stops
    being retried on every start). No timing in any of them.

This ports the intent of aeda36823 (which was written against the pre-#1259 tree
and could not be cherry-picked: restart_slot now lives in
packages/remote-server/, and its desktop/-side file is a 37-line forwarding
shell). The other half of that commit — gating the child tests 3 and 4
macos-only because their fixture raced the Remote: Ready printout — is
deliberately not ported: main already replaced that dependency, so both tests
now poll the broker's connect counter and the book file instead of a status line,
and gating them would drop Linux coverage for a race that no longer exists.

Verified: cargo test -p future-remote-server --lib 164 passed, 5 ignored;
cargo clippy -p future-remote-server --all-targets -- -D warnings clean;
cargo check -p future-host clean (the crate's only in-tree consumer of this
module); cargo fmt --all --check clean.

…ocess

`Supervisor::restart_slot` decides one of three things from the pairing book
alone: stop a device the book no longer holds, forget one whose credential cannot
be upgraded in place, refresh one it can. Each was covered only end to end,
through a child Desktop — the most expensive and least stable way to assert a
three-way match.

- `supervisor/start.rs`: the decision is split out as
  `recovery_plan(&[PairingCreds], &str) -> SlotRecovery`, a pure function with no
  broker, no platform and no child; `restart_slot` matches on it, and each arm
  keeps its own effect (`stop_slot`, `forget_slot`, the refresh round trip).
- `supervisor/reconnect_tests.rs`: the three decisions plus the file effect of
  `Forget` (the slot leaves the book, so a device that can never connect stops
  being retried on every start). No timing in any of them.

This ports the intent of `aeda36823` (which was written against the pre-#1259 tree
and could not be cherry-picked: `restart_slot` now lives in
`packages/remote-server/`, and its `desktop/`-side file is a 37-line forwarding
shell). The other half of that commit — gating the child tests 3 and 4
`macos`-only because their fixture raced the `Remote: Ready` printout — is
**deliberately not ported**: main already replaced that dependency, so both tests
now poll the broker's connect counter and the book file instead of a status line,
and gating them would drop Linux coverage for a race that no longer exists.

Verified: `cargo test -p future-remote-server --lib` 164 passed, 5 ignored;
`cargo clippy -p future-remote-server --all-targets -- -D warnings` clean;
`cargo check -p future-host` clean (the crate's only in-tree consumer of this
module); `cargo fmt --all --check` clean.
@huichen
huichen enabled auto-merge (squash) October 20, 2026 11:53
@huichen
huichen merged commit 9ebb518 into main Oct 20, 2026
20 checks passed
@huichen
huichen deleted the test/reconnect-decision branch October 20, 2026 12:07
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