Commit Graph

4 Commits

Author SHA1 Message Date
Maciek "mab122" Bator 2ab81b525f test: integration tests for gossip, bridge discovery, and TCP tunneling
FakeRNSNetwork routes announces and packets between instances in-process,
replacing the need for real RNS hardware in CI.  Covers:

- Gossip: A broadcasts new refs → B receives packet → B triggers sync
- Gossip: repeated identical refs do not trigger a spurious sync
- Gossip: peer discovery via announce causes initial ref exchange
- Bridge: mutual discovery, NID extraction, de-duplication of auto_seed
- TCP tunnel: data forwarded from TCP socket to RNS Packet
- TCP tunnel: data received from RNS written back to TCP socket

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 13:19:01 +02:00
Maciek "mab122" Bator 8f4f732dca feat: watchdog push detection, setup command, and gossip refactor
Gossip relay now reacts to rad push instantly when watchdog is installed.
A threading.Event replaces the interruptible sleep loop: watchdog fires
the event on any filesystem change in the seed's storage directory, waking
the poll loop immediately.  Without watchdog the relay falls back to the
configured poll interval with a clear log message.

New command 'radicle-rns setup' checks all prerequisites and prints exact
fix instructions for anything missing: rad/radicle-node binaries, seed
identity, watchdog, and whether the seed is registered in the user's
radicle node.

Other changes:
- gossip: _poll_loop_once() extracted so tests can drive one iteration
- gossip: stop() sets poll_event so the thread exits without waiting out
  the full poll interval
- gossip: _start_watcher() creates storage dir if absent (watchdog requires
  the watched path to exist)
- pyproject.toml: watchdog>=3.0 added as [watch] optional dep and dev dep
- 5 new tests for watchdog/event/auto-discover behaviour

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:28:42 +02:00
Maciek "mab122" Bator e051d82af1 feat: replace parallel git-bundle layer with real Radicle seed bridging
Rips out the custom git-bundle/sync/adaptive/qr parallel sync stack and
replaces it with a proper seed-to-seed architecture: two real radicle-node
instances (each with seedingPolicy=allow) bridge over Reticulum/LoRa.
Users connect their own radicle-node to the local seed once; all mesh
sync happens in the background using Radicle's own protocol, so atomicity,
Noise XK encryption, and pack verification are all handled natively.

New modules:
- seed.py: SeedNode — manages a dedicated radicle-node subprocess under its
  own RAD_HOME (~/.radicle-rns/seed/), writes a seed config only on first
  run, uses DEVNULL I/O to prevent pipe-buffer deadlocks
- gossip.py: GossipRelay — polls ~/.radicle/storage/<rid>/ for ref changes,
  broadcasts ~200-500 byte RNS packets to known peers, on receipt calls
  `rad sync --fetch --rid X`; thread-safe via separate peers/refs locks

New CLI commands:
- `radicle-rns seed`: starts seed radicle-node + bridge as one command;
  auto-discovers remote seeds over the mesh and connects them
- `radicle-rns gossip`: runs ref-watching notification relay

bridge.py: added rad_home parameter so `rad node connect` is called with
the seed's RAD_HOME when auto-connecting remote seeds.

Bug fixes applied during review:
- seed.py: PIPE→DEVNULL (64 KB pipe buffer deadlock)
- seed.py: missing wait() after kill() (zombie process)
- seed.py: write_config() now idempotent (preserves user customisations)
- seed.py: is_initialized() wraps TimeoutExpired in except Exception
- seed.py: removed hardcoded "network":"main" (breaks testnet)
- seed.py: moved `import socket` to top-level
- cli.py: bridge.start() inside try/finally (orphaned seed on start error)
- cli.py: status line gated on known_bridges change (not every 5 s)
- cli.py: removed dead get_remote_bridges() call in bridge status loop
- gossip.py: added _refs_lock protecting _known_refs across threads

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 15:44:59 +02:00
Maciek "mab122" Bator c418cfaccf feat: initial implementation of radicle-reticulum bridge
Python adapter bridging Radicle (decentralized Git) over Reticulum mesh
  networking (LoRa, packet radio, serial, I2P). Enables offline-first code
  collaboration without internet infrastructure or public seed nodes.

  - Identity mapping: Radicle Ed25519 DIDs ↔ RNS destinations, with persistence
  - TCP↔RNS bridge: tunnels radicle-node traffic over mesh, auto-discovers peers
  - LXMF sync: store-and-forward bundle delivery for offline peers, auto-push
  - Adaptive strategy: selects FULL/INCREMENTAL/MINIMAL/QR by RTT + throughput
  - Git bundles: full and incremental, delay-tolerant transfer
  - QR air-gap: encode/decode bundles as QR codes (≤2953 bytes)
  - CLI: radicle-rns bridge/node/sync/bundle/ping/peers/identity commands
  - 158 tests
2026-04-21 12:14:57 +02:00