Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
4088960
feat(mqtt): implement platform-agnostic MqttConnector with Native and…
lxsaah Sep 6, 2026
ce28e53
feat(mqtt): implement embedded backend transport for MQTT connector
lxsaah Sep 6, 2026
781fc1c
feat(mqtt): enhance embassy runtime support and improve documentation
lxsaah Sep 6, 2026
e19d1eb
feat(mqtt): add internal test for Embassy broker session loop and upd…
lxsaah Sep 6, 2026
6ddc184
feat(mqtt): enhance transport flexibility by allowing caller-supplied…
lxsaah Sep 6, 2026
237e3cd
docs(mqtt-connector): record the runtime-neutral migration
lxsaah Sep 6, 2026
be27274
docs(mqtt-connector): unlink feature-gated items from ungated docs
lxsaah Sep 6, 2026
19caee9
feat(tokio-adapter): add embedded-io support for async streams and en…
lxsaah Sep 7, 2026
664e4fe
feat(Cargo.toml): enhance defmt dependencies for mountain-mqtt integr…
lxsaah Sep 7, 2026
cc65e63
feat(tests): add TokioNet embedded backend smoke test with reconnect …
lxsaah Sep 7, 2026
fef39fc
feat: enhance MQTT connector with session management and event handling
lxsaah Sep 7, 2026
ba9c435
feat(tests): add backend parity test for MQTT connectors and enhance …
lxsaah Sep 7, 2026
84d2b72
Refactor MQTT Connector to unify backend handling and enhance credent…
lxsaah Sep 7, 2026
e20e360
feat: add SNTP codec and TLS transport for MQTT client
lxsaah Sep 7, 2026
e770173
feat: reorganize embedded module structure and add SNTP codec impleme…
lxsaah Sep 7, 2026
7e95b31
fix(tls): correct variable name for port in connection log
lxsaah Sep 7, 2026
b234e85
docs: update feature descriptions and clarify backend distinctions in…
lxsaah Sep 7, 2026
c5a2db0
feat: add embedded TLS support for MQTT connector
lxsaah Sep 7, 2026
3b4423c
feat: update aimdb-mqtt-connector to version 0.7.0 with breaking chan…
lxsaah Sep 7, 2026
98660ff
docs(mqtt-connector): unlink feature-gated and private items from ung…
lxsaah Sep 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 47 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 55 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ RED := \033[0;31m
# pthread_atfork fork detector) silently un-no_std's the crate if it is not
# marked optional and gated behind `std`.
SYNC_NO_STD_FORBIDDEN := tokio|libc
# The embedded MQTT backend runs on any target with a `StreamDialer`, so no
# executor, network stack, adapter or logger may reach its graph.
MQTT_EMBEDDED_FORBIDDEN := embassy-net|embassy-executor|embassy-time|static_cell|aimdb-embassy-adapter|defmt
NC := \033[0m # No Color

## Show available commands
Expand Down Expand Up @@ -94,6 +97,8 @@ build:
cargo build --package aimdb-tokio-adapter --features "tokio-runtime,tracing,observability"
@printf "$(YELLOW) → Building tokio adapter (runtime-neutral transports)$(NC)\n"
cargo build --package aimdb-tokio-adapter --features "net"
@printf "$(YELLOW) → Building tokio adapter (embedded-io streams)$(NC)\n"
cargo build --package aimdb-tokio-adapter --features "embedded-io"
@printf "$(YELLOW) → Building sync wrapper$(NC)\n"
cargo build --package aimdb-sync
@printf "$(YELLOW) → Building sync wrapper (no_std)$(NC)\n"
Expand Down Expand Up @@ -175,6 +180,8 @@ test:
cargo test --package aimdb-tokio-adapter --features "tokio-runtime,tracing,observability"
@printf "$(YELLOW) → Testing tokio adapter (runtime-neutral transports)$(NC)\n"
cargo test --package aimdb-tokio-adapter --features "net"
@printf "$(YELLOW) → Testing tokio adapter (embedded-io streams)$(NC)\n"
cargo test --package aimdb-tokio-adapter --features "embedded-io"
@printf "$(YELLOW) → Testing embassy adapter (host, no executor: buffers, join-queue, connector spine, doctests)$(NC)\n"
cargo test --package aimdb-embassy-adapter --no-default-features --features "alloc,embassy-sync,embassy-time,connectors"
@printf "$(YELLOW) → Testing embassy adapter (host: runtime-neutral transports, UART + UDP over two embassy-net stacks)$(NC)\n"
Expand Down Expand Up @@ -204,11 +211,11 @@ test:
@printf "$(YELLOW) → Testing persistence SQLite backend$(NC)\n"
cargo test --package aimdb-persistence-sqlite
@printf "$(YELLOW) → Testing MQTT connector (tokio, no TLS backend)$(NC)\n"
cargo test --package aimdb-mqtt-connector --features "std,tokio-runtime"
cargo test --package aimdb-mqtt-connector --features "std"
@printf "$(YELLOW) → Testing MQTT connector (tokio + native-tls)$(NC)\n"
cargo test --package aimdb-mqtt-connector --features "std,tokio-runtime,tokio-native-tls"
cargo test --package aimdb-mqtt-connector --features "std,tokio-native-tls"
@printf "$(YELLOW) → Testing MQTT connector (tokio + rustls)$(NC)\n"
cargo test --package aimdb-mqtt-connector --features "std,tokio-runtime,tokio-rustls"
cargo test --package aimdb-mqtt-connector --features "std,tokio-rustls"
@printf "$(YELLOW) → Testing KNX connector$(NC)\n"
cargo test --package aimdb-knx-connector --features "std,tokio-runtime"
@printf "$(YELLOW) → Testing WebSocket connector (server + client: unit, real-socket e2e, AimDB round-trip)$(NC)\n"
Expand All @@ -227,6 +234,14 @@ test:
cargo test --package aimdb-tcp-connector --no-default-features --features "_test-embassy-loopback" --test embassy_loopback
@printf "$(YELLOW) → Testing TCP connector (accept pool over two embassy-net stacks)$(NC)\n"
cargo test --package aimdb-tcp-connector --no-default-features --features "_test-embassy-loopback" --test accept_pool
@printf "$(YELLOW) → Testing MQTT connector (broker session loop against a fake broker)$(NC)\n"
cargo test --package aimdb-mqtt-connector --no-default-features --features "_test-embassy-broker" --test embassy_broker
@printf "$(YELLOW) → Testing MQTT connector (embedded backend over TokioNet, reconnect)$(NC)\n"
cargo test --package aimdb-mqtt-connector --no-default-features --features "_test-tokio-broker" --test tokio_broker
@printf "$(YELLOW) → Testing MQTT connector (both backends, one broker, one process)$(NC)\n"
cargo test --package aimdb-mqtt-connector --no-default-features --features "_test-backend-parity" --test backend_parity
@printf "$(YELLOW) → Testing MQTT connector (mqtts:// against a pinned self-signed root)$(NC)\n"
cargo test --package aimdb-mqtt-connector --no-default-features --features "_test-tls-broker" --test tls_broker

fmt:
@printf "$(GREEN)Formatting code (workspace members only)...$(NC)\n"
Expand Down Expand Up @@ -282,6 +297,8 @@ clippy:
cargo clippy --package aimdb-tokio-adapter --features "tokio-runtime,tracing,observability" --all-targets -- -D warnings
@printf "$(YELLOW) → Clippy on tokio adapter (runtime-neutral transports)$(NC)\n"
cargo clippy --package aimdb-tokio-adapter --features "net" --all-targets -- -D warnings
@printf "$(YELLOW) → Clippy on tokio adapter (embedded-io streams)$(NC)\n"
cargo clippy --package aimdb-tokio-adapter --features "embedded-io" --all-targets -- -D warnings
@printf "$(YELLOW) → Clippy on embassy adapter$(NC)\n"
cargo clippy --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --features "embassy-runtime" -- -D warnings
@printf "$(YELLOW) → Clippy on embassy adapter with network support$(NC)\n"
Expand Down Expand Up @@ -325,14 +342,18 @@ clippy:
@printf "$(YELLOW) → Clippy on KNX connector (embassy)$(NC)\n"
cargo clippy --package aimdb-knx-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime" -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (tokio, no TLS backend)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --features "std,tokio-runtime" --all-targets -- -D warnings
cargo clippy --package aimdb-mqtt-connector --features "std" --all-targets -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (tokio + native-tls)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --features "std,tokio-runtime,tokio-native-tls" --all-targets -- -D warnings
cargo clippy --package aimdb-mqtt-connector --features "std,tokio-native-tls" --all-targets -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (tokio + rustls)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --features "std,tokio-runtime,tokio-rustls" --all-targets -- -D warnings
cargo clippy --package aimdb-mqtt-connector --features "std,tokio-rustls" --all-targets -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (embassy + defmt)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --no-default-features --features "embedded" -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (Embassy bundle + defmt)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,defmt" -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (embassy + TLS + defmt)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --no-default-features --features "embedded-tls" -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (Embassy + TLS + defmt)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,embassy-tls,defmt" -- -D warnings
@printf "$(YELLOW) → Clippy on KNX connector (embassy + defmt)$(NC)\n"
cargo clippy --package aimdb-knx-connector --target thumbv7em-none-eabihf --no-default-features --features "embassy-runtime,defmt" -- -D warnings
Expand All @@ -356,6 +377,14 @@ clippy:
cargo clippy --package aimdb-tcp-connector --no-default-features --features "_test-embassy-loopback" --test embassy_loopback -- -D warnings
@printf "$(YELLOW) → Clippy on TCP connector (accept pool, host)$(NC)\n"
cargo clippy --package aimdb-tcp-connector --no-default-features --features "_test-embassy-loopback" --test accept_pool -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (broker session loop, host)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --no-default-features --features "_test-embassy-broker" --test embassy_broker -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (embedded backend over TokioNet)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --no-default-features --features "_test-tokio-broker" --test tokio_broker -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (backend parity)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --no-default-features --features "_test-backend-parity" --test backend_parity -- -D warnings
@printf "$(YELLOW) → Clippy on MQTT connector (mqtts:// host smoke)$(NC)\n"
cargo clippy --package aimdb-mqtt-connector --no-default-features --features "_test-tls-broker" --test tls_broker -- -D warnings
@printf "$(YELLOW) → Clippy on WASM adapter$(NC)\n"
cargo clippy --package aimdb-wasm-adapter --target wasm32-unknown-unknown --features "wasm-runtime" -- -D warnings
@printf "$(YELLOW) → Clippy on benchmarking infrastructure (host-only, incl. benches)$(NC)\n"
Expand All @@ -372,9 +401,9 @@ doc:
@printf "$(YELLOW) → Building cloud/edge documentation$(NC)\n"
cargo doc --package aimdb-data-contracts --features "std,simulatable,migratable,observable,linkable-json,linkable-postcard" --no-deps
cargo doc --package aimdb-core --features "std,tracing,observability" --no-deps
cargo doc --package aimdb-tokio-adapter --features "tokio-runtime,tracing,observability,net" --no-deps
cargo doc --package aimdb-tokio-adapter --features "tokio-runtime,tracing,observability,net,embedded-io" --no-deps
cargo doc --package aimdb-sync --no-deps
cargo doc --package aimdb-mqtt-connector --features "std,tokio-runtime" --no-deps
cargo doc --package aimdb-mqtt-connector --features "std" --no-deps
cargo doc --package aimdb-knx-connector --features "std,tokio-runtime" --no-deps
cargo doc --package aimdb-codegen --no-deps
cargo doc --package aimdb-cli --no-deps
Expand All @@ -386,7 +415,10 @@ doc:
@printf "$(YELLOW) → Building embedded documentation$(NC)\n"
cargo doc --package aimdb-core --no-default-features --features alloc --no-deps
cargo doc --package aimdb-embassy-adapter --features "embassy-runtime,net" --no-deps
cargo doc --package aimdb-mqtt-connector --no-default-features --features "embedded" --no-deps
cargo doc --package aimdb-mqtt-connector --no-default-features --features "embedded-tls" --no-deps
cargo doc --package aimdb-mqtt-connector --no-default-features --features "embassy-runtime" --no-deps
cargo doc --package aimdb-mqtt-connector --no-default-features --features "embassy-tls" --no-deps
cargo doc --package aimdb-knx-connector --no-default-features --features "embassy-runtime" --no-deps
@cp -r target/doc/* target/doc-final/embedded/
@printf "$(YELLOW) → Building WASM/browser documentation$(NC)\n"
Expand Down Expand Up @@ -447,7 +479,19 @@ test-embedded:
@printf "$(YELLOW) → Checking aimdb-embassy-adapter runtime-neutral transports, with and without the clock, on thumbv7em-none-eabihf target$(NC)\n"
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "alloc,net,embassy-runtime"
cargo check --package aimdb-embassy-adapter --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "alloc,net"
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (Embassy) on thumbv7em-none-eabihf target$(NC)\n"
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (runtime-neutral embedded backend) on thumbv7em-none-eabihf target$(NC)\n"
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embedded"
@printf "$(YELLOW) → Asserting no runtime crates in the embedded MQTT backend$(NC)\n"
@out=$$(cargo tree -p aimdb-mqtt-connector --target thumbv7em-none-eabihf --no-default-features --features "embedded" -e features,no-dev 2>&1) || { \
printf "$(RED)✗ cargo tree failed — refusing to pass vacuously:$(NC)\n"; \
printf '%s\n' "$$out"; exit 1; \
}; \
if printf '%s\n' "$$out" | grep -qiE '$(MQTT_EMBEDDED_FORBIDDEN)'; then \
printf "$(RED)✗ a runtime crate leaked into the embedded MQTT graph$(NC)\n"; \
printf '%s\n' "$$out" | grep -iE '$(MQTT_EMBEDDED_FORBIDDEN)'; exit 1; \
fi
@printf "$(BLUE)✓ embedded MQTT graph is free of $(MQTT_EMBEDDED_FORBIDDEN)$(NC)\n"
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (Embassy bundle) on thumbv7em-none-eabihf target$(NC)\n"
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime"
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (Embassy + defmt) on thumbv7em-none-eabihf target$(NC)\n"
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,defmt"
Expand All @@ -465,6 +509,8 @@ test-embedded:
cargo check --package aimdb-tcp-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,defmt"
@printf "$(YELLOW) → Checking aimdb-sync (no_std) on thumbv7em-none-eabihf target$(NC)\n"
cargo check --package aimdb-sync --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (runtime-neutral TLS) on thumbv7em-none-eabihf target$(NC)\n"
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embedded-tls"
@printf "$(YELLOW) → Checking aimdb-mqtt-connector (Embassy + TLS) on thumbv7em-none-eabihf target$(NC)\n"
cargo check --package aimdb-mqtt-connector --target thumbv7em-none-eabihf --target-dir $(EMBEDDED_CHECK_TARGET_DIR) --no-default-features --features "embassy-runtime,embassy-tls"

Expand Down
6 changes: 6 additions & 0 deletions aimdb-embassy-adapter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- **`Delay` for `EmbassyTcpDialer`** (feature `embassy-time`). The dialer
supplies the session clock, so a connector generic over it needs no separate
handle — which is what keeps the MQTT call sites unchanged.

### Changed (breaking)

- **Issue #131 — `EmbassyAdapter` is a stateless unit type; network capability moves to connector construction.** The `EmbassyNetwork` trait and `EmbassyAdapter::new_with_network` are deleted (an `Arc<dyn RuntimeOps>` runtime can't surface adapter-specific capabilities); network connectors take the `embassy_net::Stack` at construction, wrapped in the new force-`Send + Sync` `connectors::NetStack` so the single-core `unsafe` stays in the audited `connectors` module — the adapter itself now carries **zero `unsafe`**. `EmbassyAdapter::new()` returns `Self` (was a never-failing `ExecutorResult<Self>` forcing `.unwrap()` at every call site) and `new_db_result()` is deleted. `NetStack::new` is an `unsafe fn`: the force-`Send + Sync` rests on the single-core cooperative-executor invariant, which the constructor cannot check, so each connector constructing one acknowledges it with a `SAFETY` comment (constructing on a multicore / multi-executor setup is UB). `EmbassyRecordRegistrarExt` shrinks to `.buffer(cfg)`; `EmbassyRecordRegistrarExtCustom` (`buffer_sized`, `source_with_context`) re-targets the non-generic `RecordRegistrar<'a, T>` with the concrete `RuntimeContext`, and `source_with_context` drops its needless `Sync` bounds (`Ctx: Send`, `F: Send`, matching core's relaxed `source`). `join_queue.rs` (`EmbassyJoinQueue`) is deleted with the `JoinFanInRuntime` family; the core join queue closes when forwarders exit (the Embassy queue previously never closed) and its capacity is 16 (was 8).
Expand Down
Loading