Commit Graph
122 Commits
Author SHA1 Message Date
kyleandClaude Opus 5.5 3db1e97545 feat(ros2): local trusted time and decision J's peer-time window
- S4: TinesNode::trust_system_clock(now) and trust_wall_clock(wall, now)
  give a ROS2-only fleet a local trusted-time source, with the same
  plausibility bounds as the service (tines::trust).
- Decision J: poll collects peer estimates for a window (default 10 s,
  set_peer_time_window_ms) from the first plausible one and adopts the
  latest, once; implausible estimates (B3) are never adopted.
- S5: adoption goes through tines::trust::adopt_wall_clock, which flushes
  the store right after set_wall_clock.
- has_trusted_time() reports whether a wall time was adopted.

The `ros2` feature is outside the default gate; the shared logic is
tested in `tines`, and these methods were type-checked against it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 0b4b5d1b59 fix(tines): bounded, windowed trusted time for the service
- B3: HostClock::wall_ms saturates. New `tines::trust` module: wall times
  outside WALL_FLOOR_MS (2026-01-01Z) ..= WALL_CEILING_MS (+100 years) are
  never adopted, from a peer or the system clock.
- Decision J: `serve` takes `peer_time_window_ms`; PeerTimeWindow opens on
  the first plausible estimate, keeps the latest (advanced by ticks), and
  adopts once when the window closes. The scan stops once trusted.
- S5: adopt_wall_clock flushes right after set_wall_clock.
- S6: `trusted_clock` accepts only "system", Config denies unknown fields,
  an implausible system clock is logged and left to the peer path, and the
  docs say to order the unit after time-sync.target. New config key
  `peer_time_window_ms` (default 10000).
- Tests: the observed_at and time_from_peer tests now run the host's own
  logic through `serve`; smallest_age_wins is replaced by window and
  latest-estimate tests (the latter ignored until the store returns the
  latest estimate); forged u64::MAX and below-floor estimates aren't
  adopted and don't panic the host.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 97a97379e2 fix(core): free drop-table keys on drain; summary rate-limit slack
- The drop table now empties on drain, keys included. Before, after 32
  distinct (addr, reason) pairs every later drop went to the overflow
  slot until reboot. The overflow slot's reason is documented as that of
  the first drop to overflow since the last drain (review S7).
- F9's receive-side check accepts a summary at least
  SUMMARY_INTERVAL_MS / 2 after the last one acted on, so an on-time
  summary measured at 1999 ms isn't ignored (decision L, review D-f).
- DropReason::IdentityChanged loses its variant-level non_exhaustive,
  which made it unmatchable outside the crate; the enum keeps its own.
- Stale comments: drain_events is used by Node (drop the dead_code
  allow), and NodeEvent drops are this node's, not the peer's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 d983fea024 fix(core): reassembled observations must decode canonically
The reassembler decoded with postcard::from_bytes, which accepts
trailing bytes. It now uses take_from_bytes and rejects a non-empty
remainder, as Frame::decode does (spec §10 F13).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 eda9746d8e fix(core): evict silent and contact-only peers (F8)
The idle check ran only in on_frame and only for the peer that just
sent, so a peer that went quiet, or never sent (contact-only), held its
slot forever: eight spoofed addresses locked out every newcomer
(review S1).

Peers now record when their contact started (added_at), and idle peers
(now - last_inbound.unwrap_or(added_at) > PEER_IDLE_MS) are swept as if
Lost before a peer is added and at the top of next_frame. A peer that
resumes after its idle window is an implicit new contact: its frame is
processed rather than silently dropped. A repeat Contact restarts the
idle clock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 ac2bf37719 fix(core): scope acks, receipts and the F6 pin to the contact
- remove_peer purges only the removed peer's pending acks, not every
  peer's (review S9, F13).
- bcast_sent records for an address are dropped when its contact starts
  or ends, and a broadcast whose send fails has its record undone, so a
  broadcast Ack is accepted only for this contact's dispatched frames
  (review S10).
- A repeat Contact for a known peer starts a new contact: it resets the
  F6 pin and the per-contact bounce and receipt records (spec §10 F6).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 caa245dda4 fix(core): never trust store filtering for summaries and broadcast diff
Core re-checks dest when building the summary Bloom filter, rebuilding
a peer's broadcast send queue, and emitting a broadcast, so a store
whose for_each_broadcast_id yields addressed ids can't leak them into a
summary or forward them (expired) as broadcasts (review S11).

Adds UnfilteredStore, a test store whose iterators yield every held id,
released and broadcast ones included, pinning spec §4's 'core never
trusts a backend's filtering' for custody, acks and summaries (B8).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 5a7722bf25 docs(spec): decisions I–L from the 1.0 review
I: LogStore snapshots the log at the end of open and after the
set_wall_clock fold, so fold results and age lineage survive reboots.
J: hosts adopt the latest peer time estimate within a short window,
bounded, once per run.
K: local constants become pub(crate); only wire constants stay public.
L: quarantined entries are exempt from the count trims; the F9 summary
rate limit accepts at SUMMARY_INTERVAL_MS / 2; Observation.sig stays a
public field and §2's wording is corrected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyleandClaude Opus 5.5 4f7fe8f2c2 docs(spec): decision H — WallClockStore and the Node wall-clock accessors
Record the public 1.0 API that 941a7ce introduced in place of the revived
store_mut backdoor: the opt-in WallClockStore trait (FoldReport,
set_wall_clock, peer_time_estimate) and Node::set_wall_clock /
Node::peer_time_estimate, bounded on S: WallClockStore. Updates §3's
public table and Node method list and §9's fold and time-from-peers
text; core still never interprets wall time.

Also split the drain_events sentence into its own §3 bullet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 08:44:09 -07:00
kyle 8425232ba1 release(core): tines-core 1.0.0 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 ef539b494f refactor(core): WallClockStore trait replaces the store_mut backdoor
Task 10b reached LogStore::set_wall_clock through a general Node::store_mut.
Kyle: replace it with a narrower accessor. A WallClockStore trait (set_wall_clock
+ peer_time_estimate, implemented only by LogStore) now backs Node::set_wall_clock
and Node::peer_time_estimate, so no &mut Store escapes the facade.
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 7c8d8b74e9 feat(hosts): trusted wall time from the system clock or a peer; set observed_at 2026-10-22 08:44:09 -07:00
kyle 9f028743b5 feat(store): quarantine held observations until a wall-clock downtime fold 2026-10-22 08:44:09 -07:00
kyle 5d05ad2252 docs(spec): amend F9 — drop already-sent skip to preserve lossy convergence 2026-10-22 08:44:09 -07:00
kyle c5378b1099 fix(core): peer pinning, idle eviction, replay and queue hardening 2026-10-22 08:44:09 -07:00
kyle 465410ca28 test(sim): pin bounce-table overflow behaviour 2026-10-22 08:44:09 -07:00
kyle e65c8287ba docs(agents): wire/local constant split and 1.0 trait extension rule 2026-10-22 08:44:09 -07:00
kyle 392c7c6b04 docs(core): split wire vs local constants 2026-10-22 08:44:09 -07:00
kyle 07907efec5 feat(core): settle the Store trait (flush, is_empty, conformance suite) 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 94c3a3c8ad feat(core): reserved Signature slot on Observation 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 99036514c2 feat(core): WIRE_VERSION byte on every frame 2026-10-22 08:44:09 -07:00
kyle 9d4ed7db24 fix(ci): install libdbus-1-dev for tines-bt's bluer
CI / ci (push) Successful in 1m10s
The workspace build pulls in bluer -> dbus -> libdbus-sys, which links
against the system D-Bus library. The ubuntu-latest runner has pkg-config
but not dbus-1.pc, so libdbus-sys's build script fails. Install the
libdbus-1-dev headers (matching Dockerfile.ros2) before running the gate.
2026-10-20 09:47:55 -07:00
kyleandClaude Opus 5.5 c3be9d0f83 docs(spec,plan): decision G — quarantine on open, time from peers
The store opens before trusted time. Observations already in the log
are quarantined (not summarised, offered, believed or age-trimmed;
addressed ones report released) until LogStore::set_wall_clock runs the
downtime fold. Trusted time comes from the robot's RTC/GPS, else a
peer's observed_at + age_ms (smallest age wins), else the robot's own
fail-safe. Supersedes "don't open the store until trusted time".

Plan: Task 10 rewritten (quarantine, set_wall_clock, FoldReport,
derived marker wall time); new Task 10b (host trusted-time state
machine, time from peers, observed_at).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 01:53:55 -07:00
kyle ce4e2ba9ca docs(plan): apply 1.0 review round 1 2026-10-20 01:39:10 -07:00
kyle 2d9d549815 docs(spec): amend decision G — plain wall time at open, derived marker wall time 2026-10-20 01:39:10 -07:00
kyle 9558917b70 docs(plan): tines-core 1.0 implementation plan 2026-10-20 01:29:07 -07:00
kyleandClaude Opus 5.5 aedb8026d5 docs(spec): 1.0 decisions F (flush) and G (age across downtime)
CI / ci (push) Failing after 33s
- F: Store::flush(now) with a no-op default; Node::flush(now) replaces
  Node::store_mut. The caller's now anchors ages (fixes LogStore's stale
  clock marker, F18).
- G: age_ms is documented as a lower bound. Robots are assumed to have a
  trusted wall clock (RTC or GPS); LogStore adds power-off time on open
  from a wall-clock flush marker. Unknown downtime expires held addressed
  messages and floors held broadcasts' age at unknown_downtime_age_ms.
  Hosts set observed_at.
- AGENTS.md: specs and plans change only to record decisions Kyle has
  discussed and agreed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 01:14:37 -07:00
kyleandClaude Opus 5.5 a4cde40e85 docs: sweep after the fleet fixes; approve the 1.0 spec
- README: custody chain and receipts replace epidemic forwarding; Ack
  frame; running on a robot (host crates, current limits); security;
  crate layout, constants and reading list.
- AGENTS.md: current spec list, receipt constraints and review focus
  7-8, first_seq rule, constants, host crates and the ros2 gate.
- THREAT_MODEL.md: re-checked at 89041ea. F1, F2, F5, F17 fixed; F3
  (single configured peer) and F4 partly fixed; new F18 (no scheduled
  flush, stale clock marker).
- CHANGELOG: Unreleased section for the fleet milestone and fixes.
- tines-bt README: single-peer limit; manual BLE check not yet recorded.
- tines service rustdoc: oversized-frame behaviour, JSON tagging, clock.
- 1.0 spec: approved (2026-10-20), including §10 and the adversarial
  fuzz mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-20 01:03:08 -07:00
kyle 89041ea89a docs(threat-model): mark F1–F5 and F17 resolved 2026-10-19 23:19:57 -07:00
kyle 7df9f41e9f fix(bt): framing, roles, NodeId binding, contact events 2026-10-19 23:18:35 -07:00
kyle d98895b9d6 fix(service): run the exchange on a poll loop 2026-10-19 19:22:43 -07:00
kyle 24b5a78f22 fix(store): fsync the parent directory on torn-tail truncation 2026-10-19 15:37:41 -07:00
kyle 4718b6f2eb fix(store): log format v1 with CRC and crash recovery 2026-10-19 15:35:42 -07:00
kyle 848721a70d fix(store): boot counter, durable releases, clock marker 2026-10-19 14:16:40 -07:00
kyle 6e2dc6f996 fix(hosts): one monotonic millisecond clock 2026-10-19 12:54:28 -07:00
kyle 2738de4959 fix(core): ack only observations the store kept
Exchange::accept enqueued a pending ack whenever
!(duplicate && addressed && released) held, even when the backend
store.insert returned Err (store full / backend error). On Err the
released flag computed to false, so an ack was still enqueued: a
receiver that did not keep the message acked it. For an addressed
offer that releases the sender's custody for a message nobody holds;
for a broadcast it fires a false confidence event at the sender.

Gate the ack enqueue on res.is_ok(): enqueue only when the store
actually retained the observation. The existing released-holder
exception still applies among kept copies. No bounce is recorded on
Err (already the case).

Adds a unit test exercising a capped store (StoreError::Full) for
both a broadcast and an addressed offer, and a tines-sim property
that drives custody with CappedStore-backed nodes and asserts the
"at least one holder" invariant still holds when stores fill.
2026-10-19 12:35:17 -07:00
kyle 836ab74e81 docs: fleet-fixes implementation plan 2026-10-19 12:02:33 -07:00
kyle 55cc7952bc docs: security assessment specs (fleet-fixes, host-hardening, 1.0 §10, threat model) 2026-10-19 12:02:33 -07:00
kyle 3b1a644b24 docs: tines-core 1.0 design spec (draft v4) 2026-10-18 23:47:54 -07:00
kyle 9281f9b5ae test(tines): give the unknown-belief ipc test its own store dir 2026-10-18 23:44:58 -07:00
kyle 22d003efb4 style(ros2): cargo fmt 2026-10-18 21:17:14 -07:00
kyle 69715a1505 fix(ros2): rclrs 0.8 API + bytes payload mapping
Rewrite tines-ros2/src/node.rs against the rclrs 0.8 API (Context::
default_from_env -> create_basic_executor -> create_node; type-inferred
subscriptions; thiserror-based RclrsError) and switch payloads from
std_msgs String to UInt8MultiArray:

* live topics publish the raw Observation.bytes as data (no UTF-8 lossy);
* inbound callbacks use msg.data verbatim;
* receipts are a 32-byte UInt8MultiArray (peer[..16] ++ id[..16]);
* supply the required MultiArrayLayout { dim: [], data_offset: 0 }.

Bump ros_env 0.1 -> 0.3 so the crate's std_msgs pins rclrs 0.8's rosidl
runtime 0.7 (was 0.6), and update Cargo.lock. Add #[allow(dead_code)] on
ManagedTopic::subscriber (drop-guard for the rcl subscription handle).

Keep the ROS2-free build green; no changes outside tines-ros2/ (and the
Cargo.lock entry).
2026-10-18 21:03:32 -07:00
kyle 049d4095b8 fix(store): crash-safe reopen, bounded record decode, durability docs 2026-10-18 19:16:47 -07:00
kyle 12f72aa6a2 ci: Dockerfile to verify tines-ros2 against ROS 2 Jazzy 2026-10-18 17:59:14 -07:00
kyle 4f61bbde00 fix(tines): harden IPC against malformed frames and lock poison
serve() now replies with Response::Error on a malformed JSON frame and
keeps the connection serving instead of dropping it on the parse error;
the per-connection loop only breaks on a clean disconnect
(UnexpectedEof). node.lock().unwrap() is replaced with poison-safe
into_inner() so one panicking handler can't take down the daemon.
Drop duplicate tines-core/tines-store/serde/serde_json from
dev-dependencies (only heapless is genuinely test-only).
2026-10-18 17:15:14 -07:00