Commit Graph
2 Commits
Author SHA1 Message Date
molluskandClaude Opus 4.8 ead3031f3c test: cover graceful-leave instant-evict and rejoin-after-eviction edges
Two reconnect-eviction edges were logically handled but had no explicit
assertion:

- A graceful ConnEvent::Left must emit PeerLeft *immediately* (not wait on
  the grace timer). New graceful_leave_evicts_immediately asserts the leave
  lands well inside the grace window.
- After a grace-timer eviction scrubs the peer from seen_connected, a later
  rejoin's initial dial must be a fresh first-dial, not a reconnect that
  arms a new eviction. New rejoin_after_grace_eviction_dials_cleanly covers
  this (distinct from the existing graceful-leave scrub path).

Also reorder the eviction task to scrub timers/seen_connected before
emitting PeerConnectionFailed, so an observer (or a redial racing the
eviction) always sees clean internal state — this also makes the new
rejoin-after-eviction test deterministic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 15:46:15 -04:00
molluskandClaude Opus 4.8 3b7e6e076e test: regression coverage for transport-driven reconnect eviction
Extract the conn-event handling into a testable ConnEventHandler (grace window
as a field) and add tests/reconnect_eviction.rs covering:
- second outage after a reconnect still evicts (the bug fixed in bc1a0a2;
  proven to fail when the transport-arming is disabled)
- a reconnect within grace is not evicted
- a first-ever dial is not given an eviction timer
- a graceful leave scrubs seen_connected so a later rejoin dials cleanly

Behavior-preserving refactor: the conn-event task now builds a ConnEventHandler
and forwards each event to it; arm_grace_timer takes the grace Duration as a
param (production passes RECONNECT_GRACE). All existing transport/reconnect
integration tests still pass; clippy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 05:01:03 -04:00