Skip to content

feat(health): real per-device last_seen and I/O counters#105

Merged
CameronBrooks11 merged 2 commits into
mainfrom
feat/87-per-device-health-counters
Jul 14, 2026
Merged

feat(health): real per-device last_seen and I/O counters#105
CameronBrooks11 merged 2 commits into
mainfrom
feat/87-per-device-health-counters

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Closes #87 — and completes the observability lesson from the DCMT saga.

Design

Stats live in the CRUMBS Session, not the adapters: that's the only layer where every attempt is visible (retries are internal to Session), and its mutex already serializes the hot path — recording is a map bump under the lock already held. Per address:

Validation failures (bad address, oversized frame, not-open) never reach the wire and are not counted.

Health surface

device_health() maps the device's address to its stats: last_seen becomes the genuine last-contact time, and io_ok/io_failed/io_retried_attempts land in DeviceHealth.metrics. Per the issue: devices with no successful contact (including missing-expected) leave last_seen unset — the started_at fabrication is gone.

Tests

  • 5 new session tests: counting, masked-retry visibility, exhausted-retry, per-address isolation, validation-not-IO.
  • Shell E2E reworked into a lifecycle assertion: last_seen unset + io_ok=0 before any device I/O → set + counter moved after a successful read, per device (rlht0 moves, untouched dcmt0 stays unset).
  • 86/86, warnings-as-errors clean. The TSAN lane covers the new map (all access under the session mutex).

Track cumulative per-address statistics in the CRUMBS session, where
every attempt is visible and the existing mutex already serializes:
ok/failed operation counts, retried_attempts (every attempt beyond an
operation's first), and the timestamp of the last successful
operation. Argument/state validation failures never touch the wire and
are not counted.

device_health() now surfaces them per device: last_seen is the real
last-contact time (probes included) instead of the provider-start
constant stamped on every device, and io_ok / io_failed /
io_retried_attempts land in DeviceHealth.metrics. Devices with no
successful contact yet - including missing-expected devices - leave
last_seen unset rather than fabricated.

The retry counter is the observability half of the DCMT saga: retries
that eventually succeed no longer erase the underlying failures from
health output (a ~30% per-transaction failure rate hid behind the
retry policy for weeks, feastorg/Slice_DCMT#3).

Closes #87
@CameronBrooks11
CameronBrooks11 merged commit 9c04897 into main Jul 14, 2026
11 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/87-per-device-health-counters branch July 14, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: real per-device last-communication heartbeat (replace started_at proxy)

1 participant