Skip to content

no_std support for the Transform API (#73)#87

Merged
lxsaah merged 20 commits intomainfrom
73-no_std-support-for-transform-api
May 7, 2026
Merged

no_std support for the Transform API (#73)#87
lxsaah merged 20 commits intomainfrom
73-no_std-support-for-transform-api

Conversation

@lxsaah
Copy link
Copy Markdown
Contributor

@lxsaah lxsaah commented May 5, 2026

Closes #73. Implements Design 027.

Summary

  • Multi-input transform_join works on no_std + alloc. Fan-in moved out of aimdb-core into the new JoinFanInRuntime / JoinQueue / JoinSender / JoinReceiver traits in aimdb-executor, with implementations in the Tokio (mpsc::channel, capacity 64), Embassy (embassy_sync::Channel, capacity 8), and WASM (futures_channel::mpsc, capacity 64) adapters. aimdb-core no longer references Tokio types in the join path.
  • Breaking — handler API redesigned. JoinBuilder::with_state(...).on_trigger(Fn(...) -> Pin<Box<dyn Future>>) replaced with task-model JoinBuilder::on_triggers(FnOnce(JoinEventRx, Producer) -> impl Future). Eliminates per-event heap allocation and lets handler state borrow across .await points. aimdb-codegen updated to emit the new stub shape.
  • transform_join is now an inherent method on RecordRegistrar (gated feature = "alloc", R: JoinFanInRuntime) rather than living in the macro-generated extension trait — workaround for rust-lang #48214.
  • transform.rs split into transform/{mod,single,join}.rs so the alloc-only join path is cleanly separated from the runtime-agnostic single-input path.
  • Embassy SpmcRing subscriber-slot exhaustion now emits a defmt::error! with explicit guidance: count one slot per .tap(), .link_to(), and transform_join input. The buffer_sized<CAP, CONSUMERS> doc rewritten to match.
  • Weather-mesh DewPoint demo. All three weather stations (alpha, beta, gamma) derive a DewPoint record from Temperature and Humidity via transform_join, exercising the API on Tokio and Embassy end-to-end.

Follow-ups (filed, not in this PR)

Test plan

  • make check (fmt + clippy + std/no_std feature combos + embedded cargo check for thumbv7em-none-eabihf + wasm-pack build + cargo deny).
  • Tokio integration tests cover multi-input sum + a 200-event backpressure stress test through the bounded(64) fan-in.
  • WASM integration test (wasm-bindgen-test) covers multi-input sum.

lxsaah and others added 19 commits April 27, 2026 19:56
- Introduced `TransformBuilder`, `StatefulTransformBuilder`, and `TransformPipeline` for single-input transforms in `no_std + alloc`.
- Moved join fan-in functionality to `aimdb-executor`, allowing runtime-specific implementations for Tokio, Embassy, and WASM.
- Created `JoinFanInRuntime`, `JoinQueue`, `JoinSender`, and `JoinReceiver` traits to abstract join queue behavior across runtimes.
- Implemented `EmbassyJoinQueue`, `TokioJoinQueue`, and `WasmJoinQueue` for respective adapters, ensuring bounded queue semantics.
- Updated `typed_api` to expose `transform_join` for multi-input joins without embedding runtime-specific types in `aimdb-core`.
- Added documentation for the new design and usage of the transform API in `no_std` environments.
…nin.rs

Co-authored-by: Copilot <copilot@github.com>
- Added a new `DewPoint` contract to derive dew point temperature from `Temperature` and `Humidity` using the Magnus approximation.
- Updated the weather mesh demo to configure dew point records in the alpha, beta, and gamma weather stations.
- Refactored the `transform_join` logic to utilize the new task model, allowing state to be borrowed across `.await` points without additional allocations.
- Enhanced logging to include dew point information during initialization.
- Updated documentation to reflect the new `DewPoint` contract and its integration into the weather mesh system.
Cover the runtime-agnostic join fan-in (Design 027), the breaking
on_triggers task-model handler, and per-adapter join-queue impls
across aimdb-core, aimdb-executor, aimdb-codegen, and the Tokio,
Embassy, and WASM adapters.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lxsaah lxsaah linked an issue May 5, 2026 that may be closed by this pull request
12 tasks
@lxsaah lxsaah self-assigned this May 5, 2026
@lxsaah lxsaah added the enhancement New feature or request label May 5, 2026
@lxsaah lxsaah requested a review from Copilot May 7, 2026 18:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements Design 027 to make the full Transform API (single-input and multi-input transform_join) available on no_std + alloc by moving join fan-in behind runtime-agnostic traits in aimdb-executor, with Tokio/Embassy/WASM adapter implementations, plus updated docs/tests and a DewPoint demo across weather-mesh examples.

Changes:

  • Introduces JoinFanInRuntime / JoinQueue / JoinSender / JoinReceiver traits in aimdb-executor and implements them in Tokio, Embassy, and WASM adapters.
  • Refactors aimdb-core transform implementation into transform/{mod,single,join}.rs, exposes transform_join as an inherent RecordRegistrar method (alloc-gated), and updates codegen/docs/changelogs accordingly.
  • Extends weather-mesh demos/contracts with a derived DewPoint record using transform_join (Tokio + Embassy) and adds join integration tests (Tokio + WASM).

Reviewed changes

Copilot reviewed 41 out of 42 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
examples/weather-mesh-demo/weather-station-gamma/src/main.rs Adds DewPoint derived record via transform_join; adjusts SPMC consumer counts.
examples/weather-mesh-demo/weather-station-gamma/rust-toolchain.toml Bumps pinned Rust toolchain version for the gamma example.
examples/weather-mesh-demo/weather-station-gamma/flash.sh Adds a probe-rs flashing helper script for the gamma board target.
examples/weather-mesh-demo/weather-station-gamma/Cargo.toml Updates adapter/executor feature wiring for join + task pool sizing.
examples/weather-mesh-demo/weather-station-beta/src/main.rs Adds DewPoint derived record via transform_join and updates log output.
examples/weather-mesh-demo/weather-station-alpha/src/main.rs Adds DewPoint derived record via transform_join and updates log output.
examples/weather-mesh-demo/weather-mesh-common/src/lib.rs Re-exports DewPoint and adds DewPointKey record keys.
examples/weather-mesh-demo/weather-mesh-common/src/contracts/mod.rs Adds dew point contract module and re-export.
examples/weather-mesh-demo/weather-mesh-common/src/contracts/dew_point.rs Introduces DewPoint contract implementing AimDB contract traits.
docs/design/027-no-std-transform-api.md Adds the full design document for no_std transform/join refactor (implemented).
docs/design/020-M9-transform-api.md Updates transform API design doc with runtime-owned fan-in and new join exposure.
CHANGELOG.md Documents the no_std Transform API + handler redesign + demo updates.
Cargo.lock Updates lockfile for new deps/version bumps (e.g., futures-channel, embassy crates).
aimdb-wasm-adapter/tests/transform_join_integration_tests.rs Adds WASM join integration test for multi-input sum scenario.
aimdb-wasm-adapter/src/lib.rs Exposes join_queue module from the WASM adapter.
aimdb-wasm-adapter/src/join_queue.rs Implements WASM JoinFanInRuntime using futures_channel::mpsc.
aimdb-wasm-adapter/CHANGELOG.md Notes addition of WASM join queue + integration test + dep changes.
aimdb-wasm-adapter/Cargo.toml Adds futures-channel and enables required futures-util features.
aimdb-tokio-adapter/tests/transform_join_integration_tests.rs Adds Tokio join integration tests (including backpressure stress test).
aimdb-tokio-adapter/src/lib.rs Exposes join_queue module under tokio-runtime feature.
aimdb-tokio-adapter/src/join_queue.rs Implements Tokio JoinFanInRuntime using bounded tokio::mpsc::channel.
aimdb-tokio-adapter/CHANGELOG.md Notes addition of Tokio join queue + integration tests.
aimdb-executor/src/lib.rs Re-exports new join traits and adds ExecutorError::QueueClosed.
aimdb-executor/src/join.rs Defines runtime-agnostic join fan-in traits.
aimdb-executor/CHANGELOG.md Documents new join fan-in traits and QueueClosed error.
aimdb-embassy-adapter/src/lib.rs Exposes join_queue module and updates buffer_sized consumer counting docs.
aimdb-embassy-adapter/src/join_queue.rs Implements Embassy JoinFanInRuntime using embassy_sync::Channel (+ tests).
aimdb-embassy-adapter/src/buffer.rs Adds defmt diagnostics when SpmcRing subscriber slots are exhausted.
aimdb-embassy-adapter/CHANGELOG.md Notes Embassy join queue + improved diagnostics and dependency changes.
aimdb-embassy-adapter/Cargo.toml Adjusts executor dependency/features; adds dev-dep for host critical-section.
aimdb-core/src/typed_api.rs Makes join transform available under alloc with R: JoinFanInRuntime; adds inherent transform_join.
aimdb-core/src/transform/single.rs Extracts single-input transform pipeline/task runner.
aimdb-core/src/transform/mod.rs New transform module root with shared descriptor and re-exports.
aimdb-core/src/transform/join.rs New runtime-agnostic join implementation with task-model on_triggers.
aimdb-core/src/transform.rs Removes old monolithic transform implementation file.
aimdb-core/src/lib.rs Adjusts alloc gating and re-exports join types under alloc.
aimdb-core/src/ext_macros.rs Removes macro-generated transform_join extension method (now inherent).
aimdb-core/src/error.rs Maps executor QueueClosed into DbError.
aimdb-core/CHANGELOG.md Documents no_std transform support and join handler breaking API change.
aimdb-codegen/src/rust.rs Updates generated join handler stubs and join builder call site to on_triggers.
aimdb-codegen/CHANGELOG.md Notes codegen changes for the new join task model.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread aimdb-embassy-adapter/src/join_queue.rs Outdated
Comment thread aimdb-embassy-adapter/src/buffer.rs Outdated
Comment thread aimdb-embassy-adapter/src/buffer.rs Outdated
Comment thread examples/weather-mesh-demo/weather-station-gamma/flash.sh Outdated
Comment thread examples/weather-mesh-demo/weather-station-alpha/src/main.rs Outdated
Comment thread examples/weather-mesh-demo/weather-station-beta/src/main.rs Outdated
Comment thread examples/weather-mesh-demo/weather-station-gamma/src/main.rs Outdated
@lxsaah lxsaah merged commit 76c042f into main May 7, 2026
7 checks passed
@lxsaah lxsaah deleted the 73-no_std-support-for-transform-api branch May 7, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

no_std Support for Transform API

2 participants