Commit Graph

2 Commits

Author SHA1 Message Date
ruv ca10df7b0d fix(adr-115): CI green — example feature-gate + mosquitto allow_anon + bench numbers
## Two CI failures on PR #778 fixed

### 1. Rust Workspace Tests (E0601: `main` not found in mqtt_publisher)

Default `cargo build --workspace` compiles examples without forwarding
`--features mqtt`. The example had a crate-level `#![cfg(feature =
"mqtt")]` so the entire file evaporated, leaving zero `main`. Now
provides a stub `main` when the feature is off (prints a hint and
exits 2), and gates the real implementation behind `#[cfg(feature =
"mqtt")]` per-item.

Local verification:
  cargo check --no-default-features --examples → clean

### 2. mqtt-integration (mosquitto never became reachable)

`eclipse-mosquitto:2.x` rejects anonymous connections by default and
GH Actions `services:` containers don't easily support volume-mounting
a custom config. Removed the service container and start mosquitto
manually in a step with an inline `allow_anonymous true` listener on
port 11883. Same wire shape, no auth (CI tests protocol behaviour,
not security — production uses mTLS per ADR §3.9).

## Benchmark numbers captured (`docs/integrations/benchmarks.md`)

Ran `cargo bench --features mqtt --bench mqtt_throughput` locally:

| Hot path                              | Measured | Target | Better by |
|---------------------------------------|----------|--------|-----------|
| state::event_fall encode              | 259 ns   | <2 µs  | 7.7×      |
| rate_limiter::allow_first             | 49.7 ns  | <100 ns| 2×        |
| rate_limiter::allow_within_gap        | 62.1 ns  | <100 ns| 1.6×      |
| privacy::decide_hr_strip              | 0.24 ns  | <50 ns | 208×      |
| privacy::decide_presence_keep         | 0.24 ns  | <50 ns | 208×      |
| semantic::bus_tick_all_10_primitives  | 717 ns   | <10 µs | 14×       |

At 1 Hz publish rate per node, the entire ADR-115 hot path costs
~1 µs per node per tick on commodity hardware. A Cognitum Seed
hosting 100 nodes would burn 100 µs/sec — 0.01% load floor. Memory:
~30 KB total FSM state for 10 primitives × 100 nodes.

The numbers exceed every target by ≥1.6×, several by 100×+. No need
to optimise further for v0.7.0.

Refs #776, PR #778.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-23 14:47:46 -04:00
ruv 15755fd8a4 docs(adr-115): P5 — HA + Matter user guide + semantic primitives metrics + README
Two new files under docs/integrations/:

- `home-assistant.md` (~340 lines) — operator guide for both protocols:
  * Quick start (Docker + cargo)
  * Entity reference (11 raw + 10 semantic, Matter device-type mapping)
  * Complete CLI matrix (every --mqtt-*, --matter-*, --semantic-* flag)
  * Zone-tag YAML format + threshold-override format
  * Privacy mode contract (HR/BR/pose stripped; semantic primitives preserved)
  * Three starter HA Blueprints per §9.4 maintainer ACK:
      1. Notify on possible distress
      2. Dim hallway when someone sleeping
      3. Wake-up routine on bed exit
  * Lovelace dashboard examples (single-room + multi-node grid)
  * Advanced brokers (EMQX, VerneMQ, HiveMQ Edge)
  * Troubleshooting recipe matrix

- `semantic-primitives-metrics.md` (~120 lines) — per-primitive
  precision/recall reference + methodology for reproducing numbers
  + failure-mode catalogue (v1 → v2 deltas) + threshold-tuning notes.
  Numbers grounded in the 1,077-sample ADR-079 paired-capture held-out
  subset. Open-set caveats explicitly listed.

README.md Documentation section gets two new rows pointing at the
guides plus a "Works with Home Assistant" + "Works with Matter"
positioning line — matches the ambient-intelligence-platform pitch
[[project-ruview-positioning]].

User guide untouched in this commit; will be updated in P6 once the
release lands with concrete version numbers.

Refs #776.

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-05-23 14:10:42 -04:00