Skip to content

feat(sovd_adapter): expose diag_api::DataResource as opensovd_core::DataProvider - #40

Closed
EP1991 wants to merge 21 commits into
eclipse-score:gateway_cda_intfrom
EP1991:feature/16-sovd-adapter-dataprovider
Closed

EP1991 wants to merge 21 commits into
eclipse-score:gateway_cda_intfrom
EP1991:feature/16-sovd-adapter-dataprovider

Conversation

@EP1991

@EP1991 EP1991 commented Oct 7, 2026 •

Copy link
Copy Markdown

Summary

  • Implement SovdDataProvider adapter that implements opensovd_core::DataProvider backed by diag_api::DataResource instances
  • Add DataResourceRegistry to manage resources with their metadata
  • Replace demo Constant providers in opensovd-gateway with cruise control diag_api resources
  • Add time-based debounce for fault qualification (mirrors DTC semantics)

Components Added

sovd_adapter crate

File Purpose
lib.rs Public API: SovdDataProvider, DataResourceRegistry, PayloadFormat
registry.rs Resource registration with metadata
provider.rs DataProvider trait implementation
convert.rs Type conversions between diag_api and opensovd_core
handle.rs Async handle resolution (Ready/Pending)

opensovd-gateway changes

File Change
BUILD Add sovd_adapter and diag_api dependencies
main.rs Wire cruise control resources instead of demo data
cruise.rs Cruise control diagnostics with fault injection

Cruise Control Resources

Resource Category Access Description
vehicle_speed currentData read Vehicle speed sensor reading
cruise_state currentData read Cruise control state (standby/active/unavailable)
speed_sensor_fault_status currentData read Debounced fault status
speed_sensor_stuck storedData read/write Fault injection control

Features

  • list()/categories()/groups() derived from DataResourceMetadata
  • read(data_id, include_schema) dispatches to DataResource::read, converts encoding
  • write(data_id, value) dispatches to DataResource::write
  • Error mapping: diag_api::Error / DataError to opensovd_models::ErrorCode
  • Per-resource PayloadFormat (JSON, UTF8, Binary) for UDS adapters

Test Evidence

  • Unit tests in sovd_adapter crate
  • Integration tests in opensovd-gateway using opensovd-client
  • Cruise control debounce logic tests

Closes #16

Contributed by: EP1991 | Thinking_CAPs | Eclipse SDV Hackathon Chapter 4 2026

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 55ee2856-c06c-4b73-9eea-f88c69bba9e8
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (24 packages loaded, 14 targets configured)

Analyzing: target //:license-check (77 packages loaded, 14 targets configured)

Analyzing: target //:license-check (97 packages loaded, 14 targets configured)

Analyzing: target //:license-check (97 packages loaded, 14 targets configured)

Analyzing: target //:license-check (156 packages loaded, 3170 targets configured)

Analyzing: target //:license-check (169 packages loaded, 5783 targets configured)

Analyzing: target //:license-check (173 packages loaded, 9440 targets configured)

Analyzing: target //:license-check (173 packages loaded, 9440 targets configured)

Analyzing: target //:license-check (173 packages loaded, 9440 targets configured)

Analyzing: target //:license-check (177 packages loaded, 13648 targets configured)

INFO: Analyzed target //:license-check (181 packages loaded, 15678 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions, 1 running)
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 2 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 54.525s, Critical Path: 2.60s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@EP1991
EP1991 force-pushed the feature/16-sovd-adapter-dataprovider branch from 03ecc68 to 4a5c470 Compare October 7, 2026 07:15
EP1991 pushed a commit to Eclipse-SDV-Hackathon-Chapter-Four/Thinking_CAPs that referenced this pull request Oct 7, 2026
Add comprehensive ASPICE evidence for sovd_adapter implementation:

SWE.1 Requirements:
- 20 functional/non-functional requirements documented
- Categories: Registration, DataProvider, Format, Error, Async

SWE.2 Architecture:
- PlantUML component diagram (architecture.puml)
- Data flow diagram for read operations (data-flow.puml)
- Generated PNG diagrams

SWE.3 Detailed Design:
- Module specifications for registry, provider, convert, handle
- Cruise control state machine documentation
- Concurrency design patterns

SWE.4 Unit Tests:
- 32 unit test specifications across 5 modules
- Coverage: registry, convert, handle, provider, cruise

SWE.5 Integration Tests:
- 3 integration test specifications
- Component discovery, fault injection, read-only enforcement

SWE.6 Qualification:
- Requirements traceability matrix
- Build verification checklist
- Acceptance criteria verification

Report:
- HTML dashboard summarizing all evidence
- Executive summary with metrics

Issue: eclipse-score/inc_diagnostics#16
PR: eclipse-score/inc_diagnostics#40

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@EP1991
EP1991 force-pushed the feature/16-sovd-adapter-dataprovider branch from 4a5c470 to d388985 Compare October 7, 2026 12:59
@FScholPer

Copy link
Copy Markdown
Contributor

@EP1991 please create a new eclipse account and link you github account. We only accept contributions when you signed the eca

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Error details and tags are lost at the adapter boundary, and partial read failures can be returned as successful responses.

3 open findings
What changed in this PR

Adds a diag_api::DataResource adapter for OpenSOVD and demonstrates it through cruise-control diagnostics.

Changes:

  • Adds resource registration, payload conversion, async handle resolution, and provider integration.
  • Replaces gateway demo constants with cruise-control resources and debounce behavior.
  • Adds unit and gateway integration tests.
File Description
score/​opensovd-gateway/​src/​main.rs Wires diagnostic resources into the gateway.
score/​opensovd-gateway/​src/​cruise.rs Implements cruise-control diagnostics and debounce logic.
score/​opensovd-gateway/​BUILD Adds gateway dependencies and tests.
score/​mw/​diag/​sovd_adapter/​registry.rs Implements resource registration and metadata storage.
score/​mw/​diag/​sovd_adapter/​provider.rs Implements the OpenSOVD data provider.
score/​mw/​diag/​sovd_adapter/​lib.rs Exposes the adapter’s public API.
score/​mw/​diag/​sovd_adapter/​handle.rs Resolves synchronous and asynchronous handles.
score/​mw/​diag/​sovd_adapter/​convert.rs Converts metadata, payloads, and errors.
score/​mw/​diag/​sovd_adapter/​BUILD Defines adapter library and test targets.
score/​mw/​diag/​api/​diag_api.rs Re-exports JSON schema requirements.

🧠 Review effort: Balanced


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment on lines +82 to +87
if let Some(errors) = reply.errors.filter(|e| !e.is_empty()) {
// opensovd_core::Data has no error list; a reply with errors and no value is a failure.
if data.is_null() {
return Err(DataError::Internal(convert::reply_errors(&errors)));
}
}
Comment thread score/mw/diag/sovd_adapter/convert.rs Outdated
Comment on lines +35 to +36
// DataResourceMetadata has no tags.
tags: Vec::new(),
Comment thread score/mw/diag/sovd_adapter/convert.rs Outdated
Comment on lines +92 to +96
pub(crate) fn read_error(err: diag_api::Error) -> DataError {
DataError::Internal(match err.code {
ErrorCode::SOVD(generic) => format!("{}: {}", generic.sovd_error, generic.message_text),
ErrorCode::UDS(nrc) => format!("UDS negative response 0x{:02X}", u8::from(nrc)),
})
@EP1991
EP1991 force-pushed the feature/16-sovd-adapter-dataprovider branch from 2a64a28 to 349f503 Compare October 9, 2026 19:32
@EP1991

EP1991 commented Oct 9, 2026

Copy link
Copy Markdown
Author

Addressed Copilot Review Findings

Thanks for the review! All 3 findings have been addressed in commit 349f503:

Finding 1: Payload replies silently discard resource-level errors (High) ✅

Fixed in provider.rs:82-87

Previously, errors were only raised when data.is_null(). Now any reply.errors triggers a failure:

// Any reply with errors is a failure - no partial success
if let Some(errors) = reply.errors.filter(|e| !e.is_empty()) {
    return Err(DataError::Internal(convert::reply_errors(&errors)));
}

Finding 2: Tags are hard-coded empty (Medium) ✅

Fixed in registry.rs, convert.rs, provider.rs

  • Added Entry::tags field to store tags at registration time
  • Added register_with_tags() and register_full() methods
  • convert::metadata() now takes tags parameter from Entry
  • Updated tests to verify tag filtering works
pub fn register_with_tags(
    &mut self,
    metadata: DataResourceMetadata,
    tags: Vec<String>,
    resource: impl DataResource + Send + 'static,
) -> Result<(), RegistrationError>

Finding 3: Diagnostic read errors lose SOVD codes (Medium) ✅

Fixed in convert.rs:96-143

SOVD error codes are now mapped to appropriate DataError variants:

SOVD Error Code DataError Variant HTTP Status
InsufficientAccessRights ReadOnly 403
ResourceNotFound NotFound 404
IncompleteRequest, InvalidValue, PreconditionNotFulfilled InvalidValue 400
Others Internal (with context) 500
fn sovd_error_to_data_error(generic: &GenericError) -> DataError {
    match generic.sovd_error {
        SovdCode::InsufficientAccessRights => DataError::ReadOnly,
        SovdCode::ResourceNotFound => DataError::NotFound(generic.message_text.clone()),
        SovdCode::IncompleteRequest | SovdCode::InvalidValue 
        | SovdCode::PreconditionNotFulfilled => DataError::InvalidValue(generic.message_text.clone()),
        _ => DataError::Internal(format!("{}: {}", generic.sovd_error, generic.message_text)),
    }
}

All tests updated and passing. Ready for re-review!

EP1991 | Team Thinking_CAPs

@EP1991
EP1991 force-pushed the feature/16-sovd-adapter-dataprovider branch 2 times, most recently from a31dde5 to 325ddad Compare October 9, 2026 23:41
@EP1991 EP1991 closed this Oct 9, 2026
@EP1991 EP1991 reopened this Oct 9, 2026
EP1991 and others added 11 commits October 10, 2026 01:45
Aligns .bazelrc and MODULE.bazel with the toolchain configuration
used in eclipse-score/baselibs so that code compiles with the
correct S-CORE certified toolchains.

MODULE.bazel changes:
- Add score_bazel_cpp_toolchains GCC extension: declares
  score_gcc_x86_64_toolchain (x86_64/Linux, GCC 12.2.0) and
  score_gcc_aarch64_toolchain
- Add score_toolchains_rust 0.8.0 (Ferrocene Rust toolchain)
- Add platforms + score_bazel_platforms dependencies
- Upgrade score_docs_as_code to 2.0.3 (compat level 2, required
  by transitive score_process dependency)
- Align rules_python, rules_rust, rules_cc, googletest,
  score_tooling, aspect_rules_lint, buildifier_prebuilt to the
  versions actually resolved by the dependency graph

.bazelrc changes:
- Add HTTP retry/timeout settings matching baselibs
- Register GCC x86_64 + Ferrocene as common extra toolchains for host
- Add _bl_stub config (baselibs flags: nlohmann JSON backend,
  use_typedshmd=False, warning features)
- Add _bl_toolchain_common config (incompatible_strict_action_env,
  host_platform=x86_64-linux)
- Add bl-x86_64-linux named config targeting
  score_bazel_platforms x86_64-linux-gcc_12.2.0-posix

Build command:
  bazel build --config=bl-x86_64-linux //score/...

Verified: 19 targets, 77 actions, Build completed successfully.
- add pre-commit configuration and shared tools/run_tool.sh wrapper
- import missing local link-check action from docs-as-code
- fix gitlint workflow/action metadata for actionlint compatibility
- refresh MODULE/MODULE.lock after tidy and extension resolution
- apply auto-fixes produced by repository hooks (copyright/eof)
Add a minimal GitHub Actions workflow aligned with baselibs that
builds the repository with --config=bl-x86_64-linux on PRs, main
pushes, and merge groups.
Include //score/... only when score/ contains Bazel packages, so CI
works both before and after migration to baselibs-like source layout.
The SOVD/diagnostics stack is QM, so the diagnostics binaries need not be
built with the ASIL Ferrocene/Score-GCC hermetic toolchain. That toolchain
ships binutils 2.34, whose linker cannot read modern glibc's .relr.dyn
sections, which is what broke linking //score/opensovd-cda against the
Ubuntu 24.04 host libm.

Add a score_diag_x86_64_linux_qm config that builds //score/opensovd-cda and
//score/opensovd-gateway (and transitively classic-diagnostic-adapter and
opensovd-core) with a standard upstream rules_rust toolchain and the modern
host C/C++ toolchain, on a plain x86_64-linux platform. CI keeps building the
existing targets on the Score toolchain and builds the diagnostics targets
under the QM config in separate steps.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
EP1991 and others added 10 commits October 10, 2026 01:45
Replace the client example's println! output with tracing::info! and a
tracing-subscriber fmt subscriber honoring RUST_LOG (default info). Add
tracing + tracing-subscriber (env-filter) to the root crate specs.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
ReplyMessageEncoding::JSON takes a JsonSchemaRequired, which was not reachable
through the diag_api facade.

Refs eclipse-score#16

Signed-off-by: erupuri <erupuripurushotham1@gmail.com>
…rovider

DataResourceRegistry keeps each resource next to its metadata; SovdDataProvider
implements opensovd_core::DataProvider over it:

- list/categories/groups from DataResourceMetadata, with category/group/tag filters
- read/write await ReadValueHandle/WriteValueHandle (ready, future, closure)
- resources sit behind a Mutex (write takes &mut self); the lock is never held
  across an await
- per-resource PayloadFormat so the binary-only uds adapters are served as hex
  without extra code
- diag_api errors and NRCs map to DataError; read-only writes are rejected

Refs eclipse-score#16

Signed-off-by: erupuri <erupuripurushotham1@gmail.com>
…ad of demo data

Replace the Constant demo providers with a cruise control example whose
vehicle_speed, cruise_state, speed_sensor_fault_status and speed_sensor_stuck
resources are served through the sovd_adapter. A time-based debounce
(Debounce::TimeBased semantics) turns an injected stuck sensor into a
qualified fault. Integration tests drive the running gateway through
opensovd-client.

Refs eclipse-score#16

Signed-off-by: erupuri <erupuripurushotham1@gmail.com>
- CR-01: Update matches() for new DataFilter API using DataScope enum
- CR-03: Add Sensor::refresh() and call on every access to keep cruise_state current
- CR-04: Initialize tracing subscriber in main() for proper error logging
- Add tracing-subscriber dependency to BUILD file

Signed-off-by: puru1991 <puru1991@eclipse.org>
Signed-off-by: erupuri <erupuripurushotham1@gmail.com>
1. Fail entire read if any resource-level errors present (Finding 1)
   - Previously errors were silently discarded when data was non-null
   - Now any reply.errors triggers DataError::Internal

2. Support tags in registration and metadata conversion (Finding 2)
   - Add Entry::tags field to registry
   - Add register_with_tags() and register_full() methods
   - Pass tags from Entry to convert::metadata()
   - Update tests to verify tag filtering works

3. Map SOVD error codes to proper DataError variants (Finding 3)
   - InsufficientAccessRights → DataError::ReadOnly
   - ResourceNotFound → DataError::NotFound
   - IncompleteRequest/InvalidValue/PreconditionNotFulfilled → DataError::InvalidValue
   - Other SOVD codes → DataError::Internal with context
   - UDS NRCs → DataError::Internal with hex code

Eclipse SDV Hackathon Chapter 4 - 2026

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: erupuri <erupuripurushotham1@gmail.com>
@EP1991
EP1991 force-pushed the feature/16-sovd-adapter-dataprovider branch from 325ddad to deb7d0b Compare October 9, 2026 23:45
@EP1991

EP1991 commented Oct 10, 2026

Copy link
Copy Markdown
Author

@FScholPer

Done! I've linked my GitHub account to my Eclipse Foundation account and updated all commits to use the registered email. ECA check is now passing.

@FScholPer
FScholPer deleted the branch eclipse-score:gateway_cda_int October 27, 2026 15:03
@FScholPer FScholPer closed this Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants