Skip to content

0.2.0 Matter Bridge: scaffold + cluster mapping + hub --matter wiring#27

Merged
avrabe merged 2 commits into
mainfrom
0.2.0/matter-bridge-scaffold
May 25, 2026
Merged

0.2.0 Matter Bridge: scaffold + cluster mapping + hub --matter wiring#27
avrabe merged 2 commits into
mainfrom
0.2.0/matter-bridge-scaffold

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 25, 2026

Summary

  • New crate wohl-matter-bridge lays the scaffold for the Matter integration decided in SWARCH-WOHL-006: CCSDS sensors + the hub as a Matter Bridge.
  • Defines the MatterBridge trait + cluster mapping table; ships LoggingBridge as the only impl in 0.2.0.
  • wohl-hub --matter (or WOHL_MATTER=1) routes alerts + readings through the bridge alongside the existing stdout JSON. Default off — wohl-hub behaves identically to 0.1.0 when not set.
  • Zero edits to verified crates (wohl-{leak,temp,air,door,power,alert,ota}, wohl-fw-door-bench). The Kani-verified line and Verus proofs are untouched.

What this PR is NOT

  • No rs-matter dependency. No mDNS / UDP / Matter wire bytes. No commissioning. Those are 0.3.0 scope, behind a future rs-matter-backend feature gate.
  • This is the interface contract that 0.3.0 will implement. crates/wohl-matter-bridge/DESIGN.md captures the open questions for the 0.3.0 implementor.

Cluster mapping (enum-encoded)

Wohl AlertKind Cluster Cluster id
Freeze / Overheat / RapidDrop / RapidRise TemperatureMeasurement 0x0402
WaterLeak BooleanState (1.0 fallback) 0x0045
Co2Warning / Co2Critical CarbonDioxideConcentrationMeasurement 0x040D
Pm25Warning / Pm25Critical Pm25ConcentrationMeasurement 0x042A
VocWarning / VocCritical TotalVolatileOrganicCompoundsConcentrationMeasurement 0x042C
DoorOpenTooLong / DoorOpenedAtNight BooleanState 0x0045
Overconsumption / PowerSpike / DeviceLeftOn ElectricalPowerMeasurement 0x0090
HealthMiss not bridged (internal-only)

Verified locally

  • cargo +1.85.0 fmt --check
  • cargo +1.85.0 clippy --workspace --all-targets -- -D warnings
  • cargo +1.85.0 test -p wohl-matter-bridge (all green)
  • cargo +1.85.0 test -p wohl-hub (bridge off: identical 0.1.0 behavior; with --matter: bridge receives readings + alerts)
  • cargo +1.85.0 check --workspace
  • Kani: untouched (no edits to verified crates)

Open questions for 0.3.0 (from DESIGN.md §7)

  1. Endpoint id allocation policy — flat-namespace scheme proposed; needs final call before commissioning ships.
  2. WaterLeakDetector dual-publish (Matter 1.0 BooleanState + 1.2+ WaterLeakDetector) vs BooleanState only.
  3. High-frequency reading throttle vs pass-through.

Test plan

  • All CI jobs green (fmt+clippy, test, fuzz-smoke, rivet, Verus, Kani matrix, cargo-deny, bazel-build).
  • Independent reviewer reads scaffold + DESIGN.md cold.
  • After merge: tag v0.2.0 and exercise release.yml.

🤖 Generated with Claude Code

avrabe and others added 2 commits May 25, 2026 13:12
…ring

Lands the *interface* for SWARCH-WOHL-006 (CCSDS sensors + hub as Matter
Bridge) without pulling in rs-matter. The verified sensor line stays
untouched; the unverified Matter stack remains explicitly hub-side.

- New crate `crates/wohl-matter-bridge` (no rs-matter dep):
  * `MatterBridge` trait — the contract wohl-hub calls.
  * Typed `MatterCluster` / `MatterAttribute` enums + exhaustive
    `mapping_for_alert` / `mapping_for_reading` tables (19 unit tests
    pinning every cluster id to Matter App-Cluster-Spec 1.3 values).
  * `LoggingBridge` stderr stub for end-to-end wiring validation.
- wohl-hub: optional Matter bridge field + `--matter` flag (or
  `WOHL_MATTER=1`). Default off — wohl-hub behaves identically to 0.1.0
  when the flag is unset. 2 new tests cover both states.
- `DESIGN.md`: rationale for scaffold-first, cluster decisions,
  rs-matter target version, commissioning approach (`/var/lib/wohl/matter/`),
  multi-admin behavior, attestation cert path, 3 open questions for 0.3.0.
- `WORKSPACE_INTEGRATION.md`: exact root Cargo.toml edits the
  orchestrator needs to apply (workspace member + workspace.dependency).

Verification (Rust 1.85.0): fmt --check clean, clippy --all-targets
-D warnings clean, 19/19 wohl-matter-bridge tests pass, 30/30 wohl-hub
tests pass (including the 2 new bridge-wiring tests). wohl-alert tests
re-run to confirm verified core untouched.

Refs SWARCH-WOHL-006.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the new crate as a workspace member and registers it under
[workspace.dependencies] so wohl-hub can use the `.workspace = true`
form (matching every other intra-workspace dep). The scaffold commit
intentionally left this orchestration-layer edit out so the scaffold
itself stayed reviewable on its own.

Verified:
  cargo +1.85.0 fmt --check
  cargo +1.85.0 clippy --workspace --all-targets -- -D warnings
  cargo +1.85.0 test -p wohl-matter-bridge -p wohl-hub
  cargo +1.85.0 check --workspace

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 19b8168 into main May 25, 2026
14 checks passed
@avrabe avrabe deleted the 0.2.0/matter-bridge-scaffold branch May 25, 2026 11:34
avrabe added a commit that referenced this pull request May 27, 2026
…on (#28)

Architecture, traceability, and code-skeleton foundation for the live
rs-matter integration that will ship as v0.3.0. The live wire
integration (mDNS, commissioning, fabric storage, attestation) is
explicitly out of scope and lives behind a follow-up PR.

What's in this PR

  spar AADL extension
    New spar/wohl_matter.aadl modeling the Matter Bridge thread set
    (MdnsResponder, MatterStackEventLoop, CommissioningHandler,
    MatterBridgePublisher, FabricPersistor) composed as
    MatterBridgeProcess. wohl_nodes.aadl + wohl_home.aadl extended
    to wire the bridge into HubNode.{RPi,MiniPC} and the StarterHome
    deployment. spar parse + instance + analyze all clean: 0 errors,
    120 pre-existing single-point-of-failure warnings on the
    single-hub topology.

  WIT signatures generated from AADL
    spar/generated/ contains the spar codegen output (matter.wit
    plus monitors/ota/fw for the existing processes). Per the
    spar-generates-wit convention, these are derived artifacts; the
    hand-crafted per-crate WIT files predate the convention and
    continue to live under crates/wohl-*/wit/ for now. See
    spar/generated/README.md for the regeneration recipe.

  rivet typed traceability
    Eight new artifacts:
      - SWREQ-MATTER-002..005 — commissioning, multi-admin,
        persistent fabric storage, bridged attribute publishing
      - SWARCH-WOHL-007 — rs-matter implementation shape +
        version-pin policy (refines SWARCH-WOHL-006)
      - SWDD-MATTER-001 — MatterBridgeProcess thread set + cluster
        mapping detailed design (refines SWARCH-WOHL-007)
      - SWV-MATTER-001 — SW verification approach with explicit
        rationale for skipping witness MC/DC and sigil signing in
        this scoped PR
      - UV-MATTER-001 — unit-verification of the existing crate
        tests
    rivet validate: PASS (1 pre-existing warning).

  Code skeleton: rs-matter-backend feature + RsMatterBridge stub
    New Cargo feature `rs-matter-backend` (no transitive deps yet —
    rs-matter itself remains a future dep). New
    crates/wohl-matter-bridge/src/rs_matter.rs with RsMatterConfig +
    RsMatterBridge struct implementing MatterBridge. publish_reading
    and publish_alert return unimplemented!() with a docstring
    pointing the 0.3.x implementor at LoggingBridge for current use.
    Three new unit tests; feature-on test count rises to 22.

  PR #27 reviewer recommendations applied
    DESIGN.md gains §7.4 "Unit-conversion contract" with a full
    table mapping wohl-internal units to Matter wire encoding for
    every cluster + attribute the bridge publishes. cluster.rs
    StateValue doc now explicitly explains device-type-dependent
    polarity (ContactSensor: true=closed; WaterLeakDetector:
    true=leak). ActivePower doc explicit on milliwatts.

Verified line untouched

Zero edits to crates/wohl-{leak,temp,air,door,power,alert,ota,
fw-door-bench}/, proofs/verus/, or fuzz/. cargo kani -p wohl-alert
remains at 4/4 harnesses, 0 failures — same as main. The Matter
bridge lives wholly on the hub side, outside the verified
sensor/dispatcher boundary, exactly as SWARCH-WOHL-006 prescribes.

Oracles green

  cargo +1.85.0 fmt -p wohl-matter-bridge --check               OK
  cargo +1.85.0 clippy -p wohl-matter-bridge -D warnings        OK (no features)
  cargo +1.85.0 clippy ... --features rs-matter-backend         OK
  cargo +1.85.0 test -p wohl-matter-bridge                      19/19
  cargo +1.85.0 test ... --features rs-matter-backend           22/22
  cargo kani -p wohl-alert                                      4/4
  spar analyze (StarterHome.Deployed)                           0 errors
  rivet validate                                                PASS

What is NOT in this PR

  No rs-matter Cargo dependency. The feature gate exists as a symbol
  hook for the next PR; the live wire integration (commissioning,
  fabric storage, attestation chain, mDNS responder) is 0.3.x scope.
  cargo-deny advisory chain is unchanged; the RUSTSEC-2026-0110
  ignore for bare-metal remains the only exception.

  No witness MC/DC. The bridge is a regular Rust library, not a
  Wasm component; witness operates on Wasm artifacts. Documented in
  SWV-MATTER-001.

  No new sigil-signed artifact. Architecture + traceability + a
  feature-gated skeleton don't ship binaries; existing release.yml
  cosign / SLSA chain stays in place for the eventual v0.3.0 tag.
  Documented in SWV-MATTER-001.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant