matx64 / matx64/synche

Manual peer addition (deterministic discovery without mDNS multicast)

Open
#56 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
0
Forks
1
PR merge metrics
No merged PRs in 30d

Description

Blocks #24 (End-to-end multi-instance test harness).

Goal

Allow a peer to be added explicitly, without relying on mDNS multicast, so two instances can connect deterministically — over 127.0.0.1 and in CI environments where multicast is unavailable or unreliable.

Today peers are discovered only via mDNS, and the mDNS adapter skips loopback addresses (addr.is_loopback() at app/src/infra/network/mdns.rs) and depends on multicast over a real network interface. As a result, two instances on the same host over loopback cannot find each other, which blocks the deterministic e2e harness in #24.

Proposed surface
  • A repeatable --peer <HOST:PORT> CLI flag in app/src/cli.rs (alongside the existing --config-dir / --http-port / --presence-port / --transport-port).
  • And/or a [[peer]] block in config.toml (the Config struct in app/src/domain/cfg/config.rs).
Wiring
  • Add a small task in Synchronizer (app/src/application/sync.rs) that periodically injects TransportChannelData::HandshakeSyn(endpoint) for each configured peer that has not yet been "seen" (a redial loop), bypassing the mDNS adapter's loopback filter.
  • This reuses the existing handshake path — PresenceService already turns a Ping into a HandshakeSyn on the transport sender channel.
Design wrinkle to resolve

PresenceService::handle_ping (app/src/application/network/presence/service.rs) only sends a SYN when local_id < peer_id, but a manually configured peer's UUID is not known up front. The SYN/ACK exchange must converge when one or both sides dial (e.g. both sides allowed to send SYN, with the receiver deduping). The #52 self-handshake guard already protects against a same-id collision.

Acceptance criteria
  • A peer added via CLI flag and/or config connects and syncs without any mDNS discovery.
  • Works over 127.0.0.1 (two instances on one host with distinct --config-dir and ports).
  • Docs updated (AGENTS.md, README.md, and/or docs/).
  • Unblocks #24.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/src/cli.rs, app/src/domain/cfg/config.rs, app/src/application/sync.rs, and app/src/application/network/presence/service.rs; trace the existing handshake and mDNS paths first. Resolve how configured endpoints converge when peer UUIDs are unknown, then verify loopback connection and syncing with two config directories and ports. Update AGENTS.md, README.md, and/or docs and confirm the setup supports the #24 harness.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, distributed-systems, networking
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.