Skip to content

Turn Pair with IP on: wire minor 4, and the helper lists pair-with-ip and pair-with-ip-names - #65

Merged
TheAnimatrix merged 7 commits into
mainfrom
minor-4
Dec 1, 2026
Merged

TheAnimatrix merged 7 commits into
mainfrom
minor-4

Conversation

@TheAnimatrix

Copy link
Copy Markdown
Collaborator

Slice 8 of mousse-agent/mousse#2079: turns Pair with IP on. The wire's newest minor version is now 4, and the helper lists pair-with-ip, plus pair-with-ip-names for joining by computer name (#52, #58, #60).

What changed

  • Minor 4. PROTOCOL_MINOR_VERSION is 4 (mousse-net-core). A minor-4 build speaks minors 3 and 4. A minor-3 peer still connects (agreed minor 3), and a minor-2 peer is refused at HELLO with UNSUPPORTED_VERSION and its minor reported, so the app shows Needs update (docs/pair-with-ip-design.md §5).
  • Helper features. hello lists pair-with-ip and pair-with-ip-names, both only while the helper speaks wire minor 4. A debug build lowered to minor 3 lists neither and answers every Pair with IP op unsupported. Before this change the list didn't depend on the minor.
    • pair-with-ip: invite.create {kind: "direct"}, join.direct, join.direct.cancel and their events.
    • pair-with-ip-names: join.direct also takes <name>:<port>, with its not_found error, and invite.create may give host_name. An app gates the name field and the host name on it.
  • Test hooks. The debug hook that raised a build to minor 4 is gone: nothing needs it now that 4 is the real minor. MOUSSE_NET_TEST_HELLO_MINOR now only lowers a debug build to an older minor, never to its own or a newer one. Its test (test_minor_hook.rs) is replaced by a unit test in conn.rs, the_test_hook_speaks_older_minors_only. Pair with IP tests run at the real minor. The tests that prove the ops answer unsupported lower a helper to minor 3 (MOUSSE_NET_TEST_HELLO_MINOR=3), so the gate stays proven.
  • Pinned ranges.
    • Spec vectors: hello.json (this_build, new peer_previous_minor and peer_two_minors_back cases), control.json, mux.json and pairing-e2e.json.
    • The second implementation (interop/second-impl-ts/wire.ts) and the simulator.
    • spec/wire.md and docs/limits.md.
    • docs/pairing-flow-design.md: the pair-with-ip row is listed from minor 4, and there is a new pair-with-ip-names row.
    • docs/pair-with-ip-design.md: §7 phase 4 is done, and §4 "Helper protocol as built" names both features.

How minor 3 and minor 2 are proven

  • Vectors: hello.json cases peer_previous_minor (a minor-3 peer: agreed 3) and peer_two_minors_back (a minor-2 peer: UNSUPPORTED_VERSION). Core and the second implementation both run them, and core runs them on wasm32 too.
  • Helper, minor 3: app_both_ways::a_minor_3_peer_connects_and_calls_go_both_ways. A helper lowered to minor 3 pairs with a minor-4 one, connects at minor 3, and calls go both ways.
  • Helper, minor 2: app_version_refusals. A host lowered to minor 2 is refused for version: the app sees unsupported_version {peer_minor: 2} and peer.incompatible, the refusal is kept and retried, and it clears once the host updates.
  • Pair with IP gate: app_pair_ip::at_minor_3_every_pair_with_ip_op_is_unsupported, the_cli_refuses_pair_with_ip_at_minor_3 and hello_lists_pair_with_ip_only_at_minor_4, plus io direct_minor: a host lowered to minor 3 closes a peer that sends a Pair with IP message anyway, for a protocol error.

Tests and controls

  • New: app_pair_ip::hello_lists_pair_with_ip_only_at_minor_4. Both features are listed at minor 4, and neither by a helper lowered to minor 3.
  • New must-fail control direct-features-ungated in pair-with-ip.helper: the features are listed whatever minor the helper speaks.
  • app_pair_ip::a_typed_name_pairs_and_keeps_the_address_it_reached and the io name tests now run at the real minor.

Review fixes (early review of 1ac9dc7)

  • R1, the TypeScript implementation took minor-4 controls at minor 3: its joiners and host now close with protocol_error, before dispatch, when a JOIN_DIRECT or an AUTHORIZED with keys 2 or 3 arrives on a connection that agreed minor 3, as the Rust driver does. New test pairing-e2e.json / second implementation only: an extended AUTHORIZED at minor 3 closes the connection: a ticket joiner agrees minor 3 with a scripted host, then receives the extended AUTHORIZED. It fails when the check is removed.
  • R2, wording: wire.md now says the minor-4 side refuses a minor-2 peer at HELLO whichever side dialled. A minor-2 build itself would agree minor 2.
  • R3, release guards: both of the helper's release-build guards now name direct-features-ungated, and also direct-host-name-localhost from Pair with IP: the host shows its computer name next to its address #60, which was missing too.
  • Cut taken: the unused DIRECT_MINOR_VERSION import in conn.rs. Not taken: reworking direct_minor.rs to script the caller's minor. It keeps its current, working form.

Checks run (Windows x64)

The full gate ran on 1ac9dc7. The review fixes (4c1552e) touch only the second implementation, docs and two cfg guard lists, so the steps they affect ran again on 4c1552e.

  • On 1ac9dc7: cargo fmt --check, cargo clippy --workspace --all-targets --all-features -D warnings, the core wasm32 check, and second-impl npm run check / npm test all pass.
    • cargo test --workspace: every test passes except grant_connected::a_connection_closed_meanwhile_grants_nothing, once, under load. It passed 5 of 5 runs alone, and pairing-roles runs it again below, where it passes.
  • Every phase in checks/*.toml, with its controls: every check Windows can run passes, and every control in it fails as required: phase0, phase1a, phase1b, phase3, phase4, pairing-flow, pairing-relay-completion, pairing-revoke and pairing-roles. The exceptions:
    • phase1b.ssh control pipe-outlives-helper does not make its test fail: the known mousse-net#22. It is the same on main.
    • phase4.helper-plus had 2 of 34 tests fail under load. All 34 passed in two runs alone.
    • Not runnable on this machine: phase3.reproducible and phase3.install (Linux only), app-session.phone-caller (phone to desktop), and the checks that need signed results from real devices or from macOS and Linux.
  • On 4c1552e:
    • Second-impl npm run check / npm test and phase0.second-implementation pass, and its control fails as required.
    • The whole pair-with-ip phase passes, with every control failing as required:
      • host-io: 26 tests, 9 controls
      • helper: 27 tests, 21 controls, including the new direct-features-ungated
      • joiner-io: 33 tests, 13 controls
      • sim: 1000 seeds, 6 planted bugs
      • helper-units: 124 tests, 6 controls
    • cargo test -p mousse-net-io --test loopback: 20 of 20, three times.
  • Final head: a merge of main (docs(app-session): a thread send may carry files where the host advertises threadFiles #61, fix(relay): a dropped interactive write no longer holds bulk writes back #62, fix(ci): simplify the helper reconnect due check #63), which touch the relay's egress, the app-session spec and vectors, and one line in the helper's paths.rs. On it, cargo fmt --check and workspace clippy with -D warnings are clean, and cargo test -p mousse-relay, -p mousse-helper --test app_pair_ip and -p mousse-helper --bin mousse-helper pass.

PROTOCOL_MINOR_VERSION is 4 and the helper lists pair-with-ip. A minor-4 build speaks minors 3 and 4: a minor-3 peer still connects (agreed 3), a minor-2 peer is refused at HELLO with its minor reported. The test hook only lowers the minor again; the Pair with IP tests run at the real minor, and the gate's tests lower a helper to minor 3. Vectors, the second implementation, wire.md and the designs follow.
# Conflicts:
#	crates/mousse-helper/src/app/mod.rs
#	crates/mousse-net-io/tests/direct_joiner.rs
#	docs/pairing-flow-design.md
… wire speaks minor 4

pair-with-ip-names tells an app that join.direct takes a computer name and invite.create may give host_name. Both are left out by a helper lowered to minor 3, which answers the ops unsupported. The name-dial helper test runs at the real minor.
… implementation; both release guards name the new controls

The TypeScript joiners and host close for a protocol error when a JOIN_DIRECT or an AUTHORIZED with keys 2 or 3 arrives on a connection that agreed minor 3, before dispatch, as the Rust driver does. wire.md says the minor-4 side refuses a minor-2 peer whichever side dialled. The helper's release-build guards name direct-features-ungated and direct-host-name-localhost. An unused import goes.
@TheAnimatrix
TheAnimatrix merged commit 50936f5 into main Dec 1, 2026
1 check passed
@TheAnimatrix
TheAnimatrix deleted the minor-4 branch December 1, 2026 11:10
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