2 core foundation error handling - #15
Conversation
There was a problem hiding this comment.
Pull Request Overview
Adds a comprehensive design document for milestone 1 of issue #2, establishing the foundation for AimDB's error handling and feature flag architecture. The design addresses cross-platform error handling requirements from MCU to cloud environments with unified API surfaces.
- Defines unified
DbErrortype with platform-conditional behavior using feature flags - Establishes feature flag architecture for std/embedded platforms with runtime and protocol extensions
- Creates structured error taxonomy with performance constraints and observability integration
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/design/000-M1_error-feature-flags.md | Complete design document defining error handling architecture, feature flags, and cross-platform abstractions for M1 milestone |
| .github/chatmodes/architecture.chatmode.md | Removes project planning sections to focus purely on architecture and design patterns |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| pub use crate::error::StdErrorExt; | ||
| } | ||
|
|
||
| #[cfg(all(not(feature = "std"), feature = "embedded"))] |
There was a problem hiding this comment.
The condition all(not(feature = "std"), feature = "embedded") may be redundant since the design states that embedded and std are mutually exclusive. Consider simplifying to just #[cfg(feature = "embedded")] if the mutual exclusion is enforced elsewhere, or document why the explicit check is necessary.
| #[cfg(all(not(feature = "std"), feature = "embedded"))] | |
| #[cfg(feature = "embedded")] |
| ❌ mqtt + embedded # Network stack not available | ||
| ``` | ||
|
|
There was a problem hiding this comment.
The invalid combinations list shows mqtt + embedded as invalid, but this conflicts with the IoT use case where MCUs commonly use MQTT. Consider clarifying whether this means 'MQTT over TCP is not available on embedded' or if there should be a separate mqtt-embedded feature for lightweight MQTT implementations.
| ❌ mqtt + embedded # Network stack not available | |
| ``` | |
| ❌ mqtt + embedded # MQTT over TCP not available on embedded; use `mqtt-embedded` for lightweight/MCU MQTT (if available) |
Note: The combination
mqtt + embeddedis invalid because the standard MQTT implementation requires a TCP/IP stack, which is typically unavailable or unsuitable on MCU/embedded platforms. If a lightweight MQTT implementation (e.g., over custom transport or minimal TCP) is supported, use themqtt-embeddedfeature instead.
| ### Architectural Constraints | ||
|
|
||
| **Memory Constraints (Embedded)** | ||
| - Error enum size ≤ 64 bytes (single cache line) |
There was a problem hiding this comment.
The 64-byte constraint assumes a specific cache line size, but MCUs often have different cache architectures or no cache at all. Consider specifying this as a general memory efficiency constraint rather than tying it to cache line size, or provide platform-specific size targets.
| - Error enum size ≤ 64 bytes (single cache line) | |
| - Error enum size ≤ 64 bytes (desktop/edge); ≤ 32 bytes recommended for MCUs. Target minimal size for memory efficiency. |
Adds the design document for milestone 1 of issue #2.
Milestone 2 is still open!