Skip to content

Stage 12: round-trip allocation gate and Embassy outage semantics (design 054 §5, §8) - #290

Merged
lxsaah merged 4 commits into
feat/054-connector-boundaryfrom
feat/054-s12-checkpoint
Oct 5, 2026
Merged

lxsaah merged 4 commits into
feat/054-connector-boundaryfrom
feat/054-s12-checkpoint

Conversation

@lxsaah

@lxsaah lxsaah commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Stage 12 of the 054 implementation plan (checkpoint): the round-trip allocation gate for both MQTT backends, outage semantics on the Embassy buffers, and a live run of the native MQTT examples.

Commits

  1. ci: run CI and the docs check for the 054 feature branch. ci.yml and docs.yml now also trigger on pushes to, and PRs into, feat/054-connector-boundary. docs.yml deploys GitHub Pages only for refs/heads/main, so nothing is published from here. This existed to get one full CI run for the checkpoint, and is reverted in commit 4.
  2. test(embassy): outage semantics of OutboundRoutes on the Embassy buffers.
    • New aimdb-embassy-adapter/tests/outbound_routes.rs: an AimDb on NoopRuntimeOps with EmbassyBuffers through buffer_raw, driven with a no-op waker. Gated on embassy-sync and embassy-time; it runs in the adapter's existing Makefile test leg.
    • Result: the same as Tokio. After five values with nobody pulling, single-latest gives [4], mailbox [4] and SPMC [0, 1, 2, 3, 4]. Ten values into a four-slot ring give a lag of 6, then [6, 7, 8, 9]. Nothing for stage 17 to document beyond the shared behaviour.
  3. test(mqtt): gate allocations per round trip on both backends.
    • New aimdb-mqtt-connector/tests/alloc_round_trip.rs (_test-backend-parity). One round trip: produce → PUBLISH QoS 1 → the broker's PUBACK and echo → inbound dispatch → the client's PUBACK → recv.
    • The database runs on its own thread with a current-thread runtime. A counting global allocator with per-thread counters counts only there, so the broker isn't counted and the two tests can run in parallel. 100 warm-up and 300 measured round trips.
    • New echo_broker in tests/common: it relays a client's publish back at QoS 1 when the client subscribed to that topic, in the client's protocol version (MQTT 5 for embedded, 3.1.1 for native).
    • Added to make test and make clippy beside backend_parity.
Backend Allocations per round trip Bytes per round trip Live heap before Latency (median, range)
Embedded 0.00 (asserted = 0) 0 43,464 B 41.7 ms (39.6–74.1)
Native 11.00 (asserted ≤ 11) 547 81,714 B 41.8 ms (40.1–75.3)
  • These match the design's prototype figures (§5.1: embedded 0, native 11 / 557 B).
  • The native figure sits exactly on its bound. It's rumqttc's own work (owned topic and payload, its request), so a rumqttc update can move it.
  • Latency is the 40 ms Nagle and delayed-ACK floor on loopback (design §8: neither backend sets TCP_NODELAY). The test therefore takes about 17 s.
  1. Revert "ci: run CI and the docs check for the 054 feature branch". CI ran green on this PR, so the trigger isn't kept. Merged, this PR changes no workflow file.

Live run: native MQTT examples against mosquitto 2.0.11

The broker had four listeners: 1883 plain/anonymous, 1884 plain/password, 8883 TLS/anonymous and 8884 TLS/password. A self-signed test CA was trusted through SSL_CERT_FILE.

tokio-mqtt-connector-demo (11 s per case; a command published to commands/temp/indoor after 6 s):

Case Sensor publishes at the broker Command received by the record Errors/warnings
plain, anonymous 15 (3 routes) yes 0
plain, password 15 yes 0
TLS (tokio-native-tls) 15 yes 0
TLS + password (tokio-native-tls) 15 yes 0
TLS (tokio-rustls) 15 yes 0
TLS + password (tokio-rustls) 15 yes 0
wrong password 0 no ConnectionRefused(NotAuthorized), retried every 5 s
mqtts:// without a TLS feature 0 no build fails: "this build has no TLS backend"

Weather mesh (weather-hub, weather-station-alpha with real open-meteo data, weather-station-beta simulated; 30 s each on the anonymous and the password listener):

  • The broker saw 24 messages across all six station topics.
  • The hub logged decoded TemperatureV2 readings from both stations.
  • No errors or warnings in any process.
  • The weather examples always build mqtt://{MQTT_BROKER}, so TLS can't be exercised with them. The password works through MQTT_BROKER=user:pass@host:port.

Found during the run (not changed here): when the native event loop errors, it logs the broker URL including the password from its authority (MQTT event loop error for mqtt://aimdb:nope@localhost:1884: …). This predates 054.

Verification

  • alloc_round_trip 2 passed. outbound_routes (Embassy) 2 passed. Every Embassy adapter host test and clippy leg passes, and backend_parity 8, tokio_broker 9 and session_loop 7 pass with the extended tests/common.
  • cargo fmt --all --check: clean.
  • CI on this PR (before the revert): all jobs passed: Bench Gate, Build & Test, Build Documentation, Embedded Cross-compilation, Format and Lint, Miri, WASM Browser Tests and Comprehensive Development Check.

🤖 Generated with Claude Code

lxsaah and others added 3 commits October 5, 2026 17:27
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ers (design 054 §8)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…054 §5)

Embedded: 0 per round trip. Native: at most 11, rumqttc's own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lxsaah
lxsaah marked this pull request as ready for review October 5, 2026 17:48
CI ran green on this PR; the trigger is not kept on the feature branch.

This reverts commit 5cf41bc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lxsaah lxsaah changed the title Stage 12: CI for the feature branch and the round-trip allocation gate (design 054 §5) Stage 12: round-trip allocation gate and Embassy outage semantics (design 054 §5, §8) Oct 5, 2026
@lxsaah
lxsaah merged commit decce4a into feat/054-connector-boundary Oct 5, 2026
@lxsaah
lxsaah deleted the feat/054-s12-checkpoint branch October 6, 2026 07:45
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