Commit Graph
21 Commits
Author SHA1 Message Date
kyleandClaude Opus 5.5 40ae18e054 test(fuzz): un-ignore the peer-table recovery probes now that S1 is in
Also match DropReason::IdentityChanged as a unit variant in the harness,
since the variant-level non_exhaustive is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 0fc6333c17 test(fuzz): make the harness check what spec §7 says it checks
The fuzz oracle and its proptest twin checked much less than §7 claims
(S8). The harness now:

- records every frame the node attempts to send, before the transport
  can refuse it, so the "every frame fits mtu()" check can fail;
- reads the MTU from its own u16 (input bytes 1-2), mapped into
  MIN_MTU..=MAX_FRAME, instead of reusing the first step tag;
- reconciles drained drop counts per address: VersionMismatch/Malformed
  drops equal the frames that fail decode (the overflow slot makes up
  any difference), IdentityChanged drops never exceed frames whose
  `from` changed, and nothing is counted beyond the frames received;
- checks no addressed observation is stored, or forwarded in an Obs
  frame, past its lifetime;
- checks signatures round-trip from the input (an observation stored from
  a whole Obs frame keeps exactly its signature, and a stored signature
  never changes), replacing the input-independent sig_round_trip call;
- checks every acked id is stored (F1) and bounds the broadcast ids
  offered per received summary by SEND_QUEUE_CAP (F9);
- has a real adversarial Mode (input byte 0): well-formed Obs, Frag,
  Summary and Ack frames from 3 x MAX_PEERS addresses, with signed and
  max-size observations (u16 payload lengths), chosen observers
  (including the node's own id), ages, lifetimes and addressing,
  structured fragment streams that conflict, repeat or arrive out of
  order, replayed summaries, `from` values that change within a contact,
  and Acks from the peer's real id naming ids the node really sent;
- adds the §10 peer-table recovery probe, which the fuzz target runs
  after every adversarial input.

fuzz_twin.rs now runs the fuzz entry point on random bytes, generated
adversarial steps, and two rewritten properties that were trivially
true: summary_repeat_does_not_resend seeds broadcasts and checks a
replay re-sends nothing while the next on-time summary re-sends all;
peer_table_recovers_after_flood floods the table, checks it is full,
and probes recovery after PEER_IDLE_MS. The recovery tests are
#[ignore]d until the S1 idle sweep lands, and the fuzz target fails on
the first adversarial input until then. A 180 s nightly run with the
probe disabled found nothing else.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 38b97577a4 test(core): probe the agreed 1.0 public surface
public_api.rs imported only spec §3's original list (S15). It now also
probes WallClockStore, Node::set_wall_clock, Node::peer_time_estimate and
Node::flush (decision H), the Node method signatures, the NodeEvent shape
and the public wire constants, and names nothing §3 makes private
(Frame, WireError, local constants).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 18e53b9bdd refactor(core): make local constants crate-private
Decision K (spec §5): the local capacities and timings are defaults that
will become configuration, so they are `pub(crate)`. The wire constants
stay public.

- MAX_PEERS, SUMMARY_INTERVAL_MS, REASSEMBLY_TIMEOUT_MS, SEND_QUEUE_CAP,
  MIN_MTU, EVENT_QUEUE_CAP, DROP_TABLE_CAP, BCAST_SENT_CAP, ACK_BUFFER_CAP
  and PEER_IDLE_MS are now `pub(crate)`; a compile_fail doctest pins it.
- MIN_MTU's doc claimed it was the floor below which a fragment has no
  room. It is only the frag sweep's lower bound (BLE ATT's 23). The real
  floors are now stated on `Transport::mtu` and pinned by
  `consts::tests::mtu_floors`: 85 to carry every valid observation, 66 to
  fragment at all, 35 for an Ack, 26 for a summary.
- tines-bt caps live connections with its own MAX_PEERS (8).
- tines-sim's props mirror MAX_PEERS/SEND_QUEUE_CAP, checked against core
  through the hidden `conformance` module; the fuzz twin reads it there.
- node.rs: drain_events' rustdoc no longer links the now-private consts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 e2717a930d refactor(core): make Frame and WireError crate-private
Spec §3 (decision D-b) lists `Frame` and `WireError` as private; lib.rs
re-exported both. Only `frame_sender` stays public.

- The pinned vectors in tests/vectors.rs now compile in-crate as a
  `#[cfg(test)] #[path]` module (autotests = false keeps Cargo from also
  building them as an integration test). Every golden vector now checks
  `encode() == GOLDEN` as well as the decode, and new literal vectors pin a
  trailing-byte rejection and an addressed Obs with a nonzero age and an
  `observed_at`.
- A `#[doc(hidden)]` `conformance` module (behind the `conformance`
  feature) gives the fuzz harness byte-level frame encoders/decoders and
  core's local limits without exposing `Frame`. The fuzz_twin test target
  now requires `conformance`, which scripts/ci.sh enables.
- compile_fail doctests pin that `Frame`/`WireError` are unreachable.
- Remove the THROWAWAY gen_missing_golden_vectors test and fix stale
  wire.rs comments about the version/tag byte offsets.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyle 164cf97a5b test(core): fuzz harness and proptest twin 2026-10-22 08:44:09 -07:00
kyle a43a4966e1 test(core): pinned vectors + MSRV gate 2026-10-22 08:44:09 -07:00
kyle 158689e265 refactor(core): narrow the 1.0 public API 2026-10-22 08:44:09 -07:00
kyle e85b3704e0 feat(core): Dest type replaces to + lifetime_ms 2026-10-22 08:44:09 -07:00
kyle 193c7bddb8 feat(core): NodeEvent with counted drop reporting 2026-10-22 08:44:09 -07:00
kyle d099f09b63 feat(core): Node::drain_events for confidence events 2026-10-18 11:56:38 -07:00
kyleandClaude Opus 5.5 cc39318673 fix(core): harden exchange send path from full-codebase review
- Cut every fragment of a stream from one encoding (age frozen at the
  first fragment) and bounds-check the slice: re-encoding mid-stream
  corrupted fragments and could panic when the tick went backwards.
- Fold the bloom summary to fit the MTU instead of sending a ~540-byte
  frame that small-MTU links reject; drop the sim's summary MTU
  exemption that hid this.
- Finish a peer's in-flight stream before starting another, and count
  an addressed message as delivered only after its last fragment.
- Alternate custody and broadcast per peer, rotate through addressed
  candidates, and evict the oldest bounce record when full, so neither
  path starves.
- Add Exchange::on_send_error; Node::poll uses it so Busy/Unreachable
  sends are retried rather than silently dropped.
- Clear bounce records per contact, record duplicates against their
  sender, and skip addressed messages that cannot fit the MTU.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 05:08:08 -07:00
kyleandClaude Opus 5.5 111a40236d ci: test the no-alloc build and harden the workflow
Run clippy, docs and tests for tines-core with --no-default-features,
gating the MemStore-based tests on `alloc` so they compile there. Fail on
rustdoc warnings, pass --locked everywhere, and pin the toolchain to
1.99.0. In the workflow, use read-only permissions, cancel superseded
runs, add a 20-minute timeout, and pin actions to commit SHAs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 05:07:12 -07:00
kyle d10e3cd88e test(core): close deferred coverage gaps 2026-10-18 04:28:38 -07:00
kyle 1d646344e6 style: cargo fmt --all 2026-10-18 03:28:51 -07:00
kyle db39dc1df0 feat(core): Node::observe_to and belief excludes addressed-to-others 2026-10-18 02:56:17 -07:00
kyle 1257f227ce refactor(sim): move FrameBuf on dup; vary per-node obs; test disconnect/unreachable 2026-10-17 23:58:15 -07:00
kyle 09a676c243 docs: fix Bloom |1 placement and doubled 'The'; PairTransport 'broadcast' wording 2026-10-17 23:58:15 -07:00
kyle ab9b892d94 chore: ci script and README 2026-10-17 21:48:37 -07:00
kyle 1740acd625 feat(core): Node facade 2026-10-17 15:43:57 -07:00
kyle 12e7c79730 test(core): PairTransport helper 2026-10-17 15:19:25 -07:00