120 no std aimx server dispatch port cross cutting anyrecord recordmetadatatracker de std#125
Merged
lxsaah merged 3 commits intoJun 4, 2026
Conversation
- Updated error handling in `remote/error.rs` to streamline conversion from `DbError` to `RemoteError`, utilizing `ToString` for message generation. - Removed `created_at` and `last_update` fields from `RecordMetadata` in `remote/metadata.rs`, simplifying metadata structure and focusing on essential fields. - Adjusted `RecordMetadata` construction and associated methods to reflect the removal of timestamp fields. - Modified `AnyRecord` trait methods to align with the new metadata structure, ensuring compatibility with remote access features. - Enhanced `aimx/dispatch.rs` and `aimx/mod.rs` to support `no_std + alloc` configurations, removing `std` dependencies where applicable. - Updated UDS server implementation in `uds-connector` to accept `String` for socket paths, improving flexibility. - Cleaned up JSON serialization tests in CLI tools to remove references to removed timestamp fields. - Ensured all changes maintain compatibility with existing functionality while improving code clarity and maintainability.
…` fields, addition of `unix_time` methods, and changes to `UdsServer` constructor for no_std compatibility.
… fields, and changes to `AimxConfig.socket_path` for no_std compatibility
Closed
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
no_std AimX server (dispatch) port — cross-cutting
AnyRecord+RecordMetadataTrackerde-stdCloses #120. Follow-up to #39 / design doc 041.
What this does
The Phase 6 foundation (#39) landed the generic session connectors, the
aimdb-uds-connectorcrate, and ano_stdAimX codec — i.e. the embedded client path (a sensor dialing a gateway). What stayedstd-only was the AimX server dispatch (AimxDispatch/AimxSession).This PR lifts that dispatch — and the central record API it reaches into — onto
no_std + alloc, so an MCU can now serve a host (e.g. "board answers a host over serial":record.list/get/set/drain/subscribe), not just dial one.Tracing the dependency to the bottom, this is a cross-cutting refactor of core's record API, not a mechanical re-gate.
Approach: a dedicated
remote-accessfeatureRather than overload
json-serialize, the server data model now sits behind a new feature:This cleanly separates the two embedded opt-ins:
json-serializerecord.latest()?.as_json()remote-accessconnector-session)stdpulls inremote-accesstransitively, so std builds are unaffected.Changes by area
aimdb-core— the cross-cutting de-stdstd→remote-access: theAnyRecordtrait methods (collect_metadata/latest_json/subscribe_json/set_from_json), theJsonBufferReadertrait, theremotemodule, and theAimDb/AimDbInnerJSON API (list_records/try_latest_as_json/set_record_from_json).std::collections::HashMap/HashSet→hashbrown,std::sync::Arc→alloc::sync::Arc.remotemodule:AimxConfig.socket_pathPathBuf→String,SecurityPolicyHashSet→hashbrown,thiserrorpulled withdefault-features = false,From<std::io::Error> for RemoteErrorkept behind astdcfg.RecordMetadataTracker(anArc<Mutex<…>>+Arc<AtomicBool>+SystemTime::now()on everyproduce()). The survivingwritablebit is now a singleportable_atomic::AtomicBoolfield onTypedRecord;collect_metadatareads the type name + flag directly with no shared state.DbError::{runtime_error, permission_denied, record_key_not_found}pub(crate)constructors — let the JSON/remote paths write one error expression acrossstd(message carried) andno_std(unit placeholder), replacing the inline#[cfg]splits.graphserde derives (RecordOrigin/GraphNode/GraphEdge/EdgeType) moved from thestdgate to theserdefeature (always on withalloc) soRecordMetadataserializes onno_std.Runtime-neutral wall clock
RecordMetadataTrackertrackedcreated_at/last_updateviaSystemTime— which has nono_stdequivalent. Introduced an abstraction on the runtime adapter instead:aimdb-executor: newTimeOps::unix_time(&self) -> Option<(u64, u32)>— absolute wall-clock time, distinct from the monotonicnow(). Default impl returnsNone(a bare MCU with no RTC).aimdb-tokio-adapter: implements it from the OS clock (SystemTime::now()).aimdb-embassy-adapter:EmbassyAdapter::set_unix_time(now_unix_secs)anchors a process-globalu32(Unix seconds at boot);unix_time()then derives(secs, nanos)from monotonic uptime + the anchor, returningNoneuntil the device learns the real time (NTP / GPS / host handshake).aimdb-uds-connectorUdsServer::new/socket_pathtakeimpl Into<String>(wasimpl Into<PathBuf>); the internal bind goes throughstd::path::Path::new(&socket_path)— same synchronous remove-stale →bind→set_permissionsbehavior.Verification target (Makefile
test-embedded)Added the full
no_stdserver cross-check, plusremote-accesstest/clippy lines:cargo check --package aimdb-core --target thumbv7em-none-eabihf \ --no-default-features --features "alloc,connector-session,remote-access"Tooling fallout
aimdb-mcp:list_records, therecordsresource, andquery_schemano longer emitcreated_at/last_update(core stopped tracking them).aimdb-cli/aimdb-client: test fixtures updated for theRecordMetadata::newsignature and thesocket_path: Stringchange (test-only).Breaking changes
RecordMetadatalosescreated_at/last_update;RecordMetadata::newdrops itscreated_atparameter;with_last_update/with_last_update_optremoved. AimXrecord.list(and MCP / CLI output derived from it) no longer carry those two fields.AimxConfig.socket_pathis nowString(wasPathBuf);AimxConfig::socket_path(...)/UdsServer::new(...)takeimpl Into<String>.&str/Stringcallers are unaffected;&Path/PathBufcallers must convert (e.g.path.to_str().unwrap()).Verification
All green:
cargo check -p aimdb-core --no-default-features --features "alloc,remote-access"(host)cargo check -p aimdb-core --no-default-features --features "alloc,connector-session,remote-access" --target thumbv7em-none-eabihf— the AimX dispatch cross-compiles (the issue's target)cargo check -p aimdb-core --features "std,tracing,metrics"cargo check -p aimdb-embassy-adapter --target thumbv7em-none-eabihfcargo test -p aimdb-core --no-default-features --features "alloc,remote-access"— 7 passedcargo test -p aimdb-core --lib --features "std" remote::— 18 passedRecordMetadataTracker/created_at/last_updateacross either workspace;aimdb-pro's demo.socket_path("…")still compiles (&str: Into<String>).Checklist (from #120)
AnyRecordJSON + metadata methods off thestdgateRecordMetadataTracker(removed entirely; timestamp tracking dropped,writable→portable_atomic::AtomicBool)remotemodule (socket_path→String,HashSet→hashbrown, gatethiserror/io::Error)AimDbJSON API offstdAimxDispatch/AimxSessiontoconnector-session+remote-access;std::collections→hashbrown,std::sync::Arc→alloc::sync::Arctest-embeddedtargetOut of scope (separate follow-ups, per doc 041)
aimdb-serial-connector,aimdb-tcp-connector, host clientAimxConnection::connect_over/connect_url, and the cli/mcp--connect <url>/AIMDB_CONNECTresolver.