Initial Rust API design for diag-lib#1
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
57765c7 to
d401cd8
Compare
|
general question: are there plans on how to support future sovd-api versions? would it make sense to version the apis? |
Not yet. But yes, it might definitely make sense to use versioned modules such as |
d401cd8 to
6d2967e
Compare
| fn read(&self, _input: ReadValueArgs) -> DiagResult<ReadValueReply> { | ||
| Ok(ReadValueReply { | ||
| id: Some("feature_flag".to_string()), | ||
| data: ReplyMessagePayload::from_string(self.enabled.to_string()), |
There was a problem hiding this comment.
We should support deserialization of data so the WriteableFlag could use e.g. serde and we could pass the value itself and not dealing with deserialization manually.
There was a problem hiding this comment.
I would like to add json serialization as well as deserialization later on top of this design as separate features
| The public entry point is the diag_api crate from within the [api](../api/) directory. | ||
| It re-exports the common types and groups the user-facing APIs into two main protocol views: | ||
|
|
||
| - `diag_api::sovd` for SOVD-oriented data resources and operations |
There was a problem hiding this comment.
In the design doc we named it diag_lib complementary to fault_lib. I would be consistent so lets align which naming convention to chose. We can discuss this in the next call.
There was a problem hiding this comment.
From my POV, diag_lib is the set of API + respective particular implementation. Since there can (and most likely also will) be different implementations of the API, I would like to keep these two parts separated. Hence, I deliberately used diag_lib here as name for the crate.
|
@stmuench please run |
| serde_json::Value | ||
| } | ||
|
|
||
| class JsonSchema <<alias>> { |
There was a problem hiding this comment.
JsonSchema and JsonValue are both aliases for serde_json::Value. One should be newtype.
…n 1.0 Part II Draft 1.0: - §II.6.17 PROD-17 scope reduced from build to absorb-when-ready after confirming eclipse-score/inc_diagnostics#1+#2 is the live upstream home (repo last push 2026-04-16). Build outputs retired; replaced with quarterly watch report and three named revisit triggers (upstream graduates / OEM deadline / upstream stalls). Implementation returns via new capability PROD-17B only if triggers fire. Saves 8-12 engineer-weeks while preserving the strategic option. - §II.6.20 PROD-20 UDS->SOVD ingress proxy added. Audit 2026-04-21 found both our vendored uds2sovd-proxy/ and upstream are empty scaffolds (zero .rs files, ~6 months stale). Five sub-deliverables covering design ADR, proxy crate, gateway wiring, integration tests, bench fixture. 5-8 engineer-week estimate. Role clarifier added stating no S-CORE equivalent exists, so Taktflow authoring is unavoidable (distinguishes from PROD-17 absorb posture). - §II.6.15 PROD-15 per-workstream cadence table: diag-lib Rust API and UDS2SOVD<->ServiceApps design both quarterly; returns to monthly on observed upstream activity. Basis cited with dates and URLs only (2026-03-24 + 2026-03-31 meetings skipped per public minutes; uds2sovd-proxy zero source commits since 2025-10-14). - §II.6.16 PROD-16 revised — Role + Constraints softened to reflect active upstream tracking, not "reference only"; 16.1/16.2 path names corrected after discovering the "FaultShim" contract ships as the AUTOSAR Dem module in embedded-production. Added 16.5 (richer FaultId) and 16.6 (extern "C" on Dem.h, cross-repo tracking). - §II.12 chase-list row 17 added (UDS->SOVD ingress proxy -> PROD-20). - Part I §1.3 exclusion clarified from "upstream contribution" to "upstream code contribution" + positive scope statement that design absorption is in scope. - Part I §7.11.1 P10-SCA-A1 marked superseded by PROD-20 after audit found crate is empty scaffold; acceptance criteria moved into PROD-20 Verification. - Part I S-CORE alignment table fault-lib row: "aligned; no action" -> "aligned; upstream direction actively tracked" with pointer to PROD-16. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| .put(current_status, ExecutionStatusDetails::none()); | ||
| } | ||
| _ => { | ||
| let mut last_exec_event_kind = exec_event.kind; |
There was a problem hiding this comment.
| let mut last_exec_event_kind = exec_event.kind; | |
| last_exec_event_kind = exec_event.kind; |
|
I see that from the application point of view there is no registration/deregistration, no heartbeat or topology onboarding, is this in scope or ? |
Idea was to add such APIs later incrementally on top of this PR in order to keep the complexity of this PR reasonable |
I see, thanks for fast response, do you have like a plan when this PR will be merged and then when will register/deregister will be live also onboarding of topology? The reason I ask this, is because opensovd-core is relying on this feature to be able to integrate hpc apps. |
| +{static} from_code_with_translation(code: ErrorCode, message: String, translation_id: String) : Self | ||
| +{static} from_vendor_error(error: String, message: String) : Self | ||
| +{static} from_vendor_error_with_translation(error: String, message: String, translation_id: String) : Self | ||
| +add_additional_attr(key: String, value: String) |
There was a problem hiding this comment.
how about creating a pub type which will have key and value as field, if not then i suggest here use a newType so user cannot pass value wrongly.
88da1f8 to
22b1ca3
Compare
| - **Ready**: `from_error(err)` — error available immediately | ||
| - **Ready**: `ready(reply)` / `ready()` — result available immediately | ||
| - **Pending**: `from_future(async move { ... })` — returns a future to await | ||
| - **Pending**: `from_closure(|| { ... })` — wraps a synchronous closure in an async handle that returns the result directly |
There was a problem hiding this comment.
| - **Ready**: `from_error(err)` — error available immediately | |
| - **Ready**: `ready(reply)` / `ready()` — result available immediately | |
| - **Pending**: `from_future(async move { ... })` — returns a future to await | |
| - **Pending**: `from_closure(|| { ... })` — wraps a synchronous closure in an async handle that returns the result directly | |
| 1. Ready | |
| .... | |
| 2. Pending | |
| .... |
| +proximity_response : Option<String> | ||
| } | ||
|
|
||
| enum ExecutionStatus <<enum>> { |
There was a problem hiding this comment.
do you want to consider Cancel status as separate or it is part of stopped ?
| interface RoutineControl <<trait>> { | ||
| +start(input: Option<ByteSlice>) : DiagResult<StartRoutine> | ||
| +stop(input: Option<ByteSlice>) : DiagResult<Option<ByteVector>> | ||
| +completion_percentage() : Option<u8> |
There was a problem hiding this comment.
| +completion_percentage() : Option<u8> | |
| +completion_status() : Option<u8> |
I feel API documentation can give return type is percentage rather than API naming, or may be return tuple (bool, u8) if needed.
Summary
This PR documents the intended Rust-based API surface, explains how consumers are expected to implement and register diagnostic resources/operations, and adds a PlantUML class diagram to visualize the design.
A working implementation of this API Design, including a runtime-backed example implementation and usage snippets which are demonstrating how to use the API in practice, can be found in #2.
Changes
score/mw/diag/api.sovdanduds)Why
The new documentation gives consumers of the diagnostics library a clearer entry point for the planned Rust API and provides a shared design reference for further implementation and review.