Skip to content

feat: Add socom for high level SOME/IP abstraction - #854

Draft
lurtz wants to merge 20 commits into
eclipse-score:mainfrom
elektrobit-contrib:add-socom
Draft

feat: Add socom for high level SOME/IP abstraction#854
lurtz wants to merge 20 commits into
eclipse-score:mainfrom
elektrobit-contrib:add-socom

Conversation

@lurtz

@lurtz lurtz commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This is the first of more pull requests for moving the SOME/IP Gateway code to communication. socom is the high level abstraction using which the gatewayd (ASIL-B) and the someipd (QM) communicate. It still misses an IPC binding, which will be a followup.

TODO

Copilot AI lite review requested due to automatic review settings August 5, 2026 16:43
Comment thread .bazelrc
Comment on lines +147 to +148
# Remove before merge. Only for getting CI results
common --features=someip-gateway

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

revert before merge

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.

Pull request overview

This PR introduces the new SOCom (Service Oriented Communication) library into communication as a high-level, in-process client/server abstraction intended to support SOME/IP gateway components, along with extensive unit/stress testing and design documentation. It also adds Bazel feature-gating to control build compatibility and updates project tooling/coverage scope to include the new component.

Changes:

  • Add SOCom core library (runtime, client/server connectors, payload/method/event primitives, string registries, and error domains).
  • Add comprehensive unit + stress tests plus a small test framework to validate behavior, threading, and deadlock detection.
  • Integrate Bazel feature compatibility (someip-gateway) and include SOCom in coverage scope/toolchain configuration.

Reviewed changes

Copilot reviewed 106 out of 108 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
score/socom/test/unit/string_registry_tests.cpp Adds unit tests for String_registry insertion behavior.
score/socom/test/unit/smoke_test.cpp Adds basic end-to-end smoke tests for runtime/connectors.
score/socom/test/unit/service_interface_identifier_tests.cpp Adds tests for service/interface identifier construction and registry behavior.
score/socom/test/unit/registry_string_view_tests.cpp Adds tests for Registry_string_view semantics and operators.
score/socom/test/unit/multiple_runtimes_tests.cpp Adds tests for running multiple independent runtimes/pairs.
score/socom/test/unit/multi_connection_tests.cpp Adds multithreaded client/server interaction tests.
score/socom/test/unit/move_only_function_mock.cpp Adds tests validating the move-only function mock helper.
score/socom/test/unit/mock_tests.cpp Adds basic construction tests for provided mocks.
score/socom/test/unit/method_call_tests.cpp Adds tests for method call flows, results, credentials, and payload allocation.
score/socom/test/unit/interface_compatibility_tests.cpp Adds parameterized tests for interface/version compatibility rules.
score/socom/test/unit/identity_tests.cpp Adds tests for bridge identity creation and comparison.
score/socom/test/unit/final_action_tests.cpp Adds tests for Final_action RAII behavior.
score/socom/test/unit/error_tests.cpp Adds tests validating MakeError(...) mappings/messages.
score/socom/test/unit/connection_tests.cpp Adds connection lifecycle tests (offer/stop/re-offer, creds, subscriptions).
score/socom/test/unit/BUILD Bazel cc_test target for SOCom unit tests.
score/socom/test/stress/tsan.supp Adds TSAN suppression file for stress tests.
score/socom/test/stress/runtime_multi_threading_tests.cpp Adds stress tests for runtime/bridge/client concurrency.
score/socom/test/stress/client_multi_threading_tests.cpp Adds stress tests for client APIs under concurrency.
score/socom/test/stress/BUILD Bazel cc_test target for SOCom stress tests and TSAN config.
score/socom/test/framework/src/vector_payload.cpp Implements test payload helpers (vector-backed payloads, cloning).
score/socom/test/framework/src/utilities.cpp Implements test utilities (waiting, printing, random fill, streaming helpers).
score/socom/test/framework/src/temporary_event_subscription.cpp Implements RAII helper for temporary event subscriptions in tests.
score/socom/test/framework/src/socom_mocks.cpp Implements helper functions creating callback bundles from mocks.
score/socom/test/framework/src/single_connection_test_fixture.cpp Implements shared test fixture utilities/data for single-connection tests.
score/socom/test/framework/src/multi_threaded_test_template.cpp Implements multi-threaded test loop harness.
score/socom/test/framework/src/bridge_t.cpp Implements bridge facade used by tests (registration + expectations).
score/socom/test/framework/inc/score/socom/vector_payload.hpp Declares vector payload helpers for tests.
score/socom/test/framework/inc/score/socom/temporary_event_subscription.hpp Declares temporary subscription RAII helper for tests.
score/socom/test/framework/inc/score/socom/socom_mocks.hpp Declares strict mocks and callback factory helpers for tests.
score/socom/test/framework/inc/score/socom/single_connection_test_fixture.hpp Declares shared test fixture type and constants.
score/socom/test/framework/inc/score/socom/multi_threaded_test_template.hpp Declares multi-threaded test harness types/functions.
score/socom/test/framework/inc/score/socom/bridge_t.hpp Declares bridge test facade.
score/socom/test/framework/BUILD Bazel cc_library target for the SOCom test framework.
score/socom/string_registry.hpp Declares String_registry and registries for service/instance IDs.
score/socom/service_interface_identifier.hpp Declares service instance + service interface identifier types and hashing.
score/socom/service_interface_definition.hpp Declares client/server interface definition/config types and strong counters.
score/socom/registry_string_view.hpp Declares Registry_string_view wrapper and comparisons/hash.
score/socom/reference_token.hpp Declares reference-token types used for lifetime/blocking.
score/socom/README.adoc Adds top-level SOCom README and links into design docs.
score/socom/posix_credentials.hpp Declares Posix_credentials value type.
score/socom/mock/score/socom/server_connector_mock.hpp Adds server connector mock type.
score/socom/mock/score/socom/runtime_mock.hpp Adds runtime mock type.
score/socom/mock/score/socom/move_only_function_mock.hpp Adds reusable mock wrapper for move-only function callbacks.
score/socom/mock/score/socom/client_connector_mock.hpp Adds client connector mock type.
score/socom/mock/score/socom/callback_mocks.hpp Adds aliases for callback mocks used in tests.
score/socom/method.hpp Declares method call primitives, results, and reply callback data.
score/socom/impl/temporary_thread_id_add.hpp Declares deadlock detection helpers (thread-id tracking).
score/socom/impl/temporary_thread_id_add.cpp Implements deadlock detection helpers.
score/socom/impl/string_registry.cpp Implements string registry insertion and global registries.
score/socom/impl/service_interface_definition.cpp Implements interface definition comparisons and server wrapper.
score/socom/impl/service_identifier.hpp Declares internal service instance identifier for uniqueness tracking.
score/socom/impl/service_identifier.cpp Implements ordering for internal service identifiers.
score/socom/impl/server_connector_impl.hpp Declares server connector implementation and endpoint receive/send APIs.
score/socom/impl/runtime.cpp Implements create_runtime() factory.
score/socom/impl/runtime_registration.hpp Declares internal registration RAII interface.
score/socom/impl/runtime_impl.hpp Declares runtime implementation, service DB, and bridge registration logic.
score/socom/impl/payload.cpp Implements payload equality and empty_payload().
score/socom/impl/method.cpp Implements Method_call_reply_data behavior and token/deadlock wiring.
score/socom/impl/messages.hpp Declares internal message types exchanged between endpoints.
score/socom/impl/error.cpp Implements error domains and MakeError(...) helpers.
score/socom/impl/endpoint.hpp Declares endpoint wrapper used for in-process message passing.
score/socom/impl/client_connector_impl.hpp Declares client connector implementation and endpoint receive APIs.
score/socom/impl/client_connector_impl.cpp Implements client connector behavior (connect/update/call/payload alloc).
score/socom/flags/BUILD Adds Bazel feature definition + config_setting for someip-gateway.
score/socom/final_action.hpp Adds Final_action RAII helper for deferred execution.
score/socom/feature_compatibility.bzl Adds select-based target compatibility gating for SOCom.
score/socom/event.hpp Declares event IDs/modes/states.
score/socom/error.hpp Declares SOCom error enums and MakeError(...) overloads.
score/socom/docs/design/models/zero_copy_event_update.puml Adds design model for zero-copy event update across gateway boundary.
score/socom/docs/design/models/state_diagram_service_state.puml Adds service-state diagram model.
score/socom/docs/design/models/state_diagram_event_subscription_state.puml Adds event subscription-state diagram model.
score/socom/docs/design/models/interaction_diagram_service_gateway_require_service.puml Adds gateway “require service” interaction model.
score/socom/docs/design/models/interaction_diagram_service_gateway_provide_service.puml Adds gateway “provide service” interaction model.
score/socom/docs/design/models/interaction_diagram_server_connector_deadlocks.puml Adds deadlock interaction model for server connector callbacks.
score/socom/docs/design/models/interaction_diagram_method_communication.puml Adds method communication interaction model.
score/socom/docs/design/models/interaction_diagram_field_notification_communication.puml Adds field-notification interaction model.
score/socom/docs/design/models/interaction_diagram_event_communication.puml Adds event communication interaction model.
score/socom/docs/design/models/interaction_diagram_client_connector_deadlocks.puml Adds deadlock interaction model for client connector callbacks.
score/socom/docs/design/models/component_diagram_socom.puml Adds component diagram for SOCom.
score/socom/docs/design/index.rst Adds Sphinx index for SOCom design docs.
score/socom/docs/design/50_state_dynamics_view.rst Adds state dynamics documentation page.
score/socom/docs/design/40_behavioral_view.rst Adds behavioral documentation page.
score/socom/docs/design/30_structural_view.rst Adds structural documentation page.
score/socom/BUILD Adds Bazel build targets for SOCom library and mocks.
quality/coverage/README.md Expands coverage scope documentation to include //score/socom.
quality/coverage/BUILD Adds //score/socom to coverage scope deps.
MODULE.bazel Enables someip-gateway feature in LLVM toolchain feature list.
.devcontainer/devcontainer.json Updates devcontainer image version.
.bazelrc Adds a repo-wide feature enable (currently marked “Remove before merge”).
Suppressed comments (1)

score/socom/test/unit/string_registry_tests.cpp:37

  • Same issue as above: comparing via data() depends on null-termination and ignores length. Prefer string_view() for content comparison.

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

Comment on lines +17 to +18
#include <ostream>
#include <string_view>
Comment thread score/socom/impl/string_registry.cpp Outdated
Comment on lines +56 to +59
auto const iter =
std::find_if(m_registered_strings.begin(), m_registered_strings.end(),
[&new_string](auto const& entry) { return entry.data() == new_string; });

Comment on lines +139 to +142
// ASSERT_TRUE(invocation);

EXPECT_CALL(m_method_reply_mock, Call).Times(1);
pointer->reply(Method_result{Application_return{empty_payload()}});
Comment on lines +41 to +44
// Method callbacks
using Method_call_credentials_callback_mock =
Move_only_function_mock<Method_call_credentials_callback>;
using Method_reply_callback_mock = Move_only_function_mock<Method_reply_callback>;
Comment on lines +18 to +21
#include <chrono>
#include <cstddef>
#include <bits/chrono.h>
#include <future>
Comment thread .bazelrc
Comment on lines +147 to +148
# Remove before merge. Only for getting CI results
common --features=someip-gateway
ASSERT_FALSE(interface_config_1 == interface_config_2);
}

TEST_F(ServiceInterfaceIdentifierTest, LiteratorConstructorUsesStringView) {
Comment on lines +95 to +96
/// Strings added to the registry from two different memory locations compare as same.
EXPECT_FALSE(string_view1 == string_view3);
/// String from an std::String is added to the registry when it is not there yet.
EXPECT_TRUE(insert1.second);
/// StringView of the correct string is returned.
EXPECT_TRUE(insert1.first.data() == std::string("TestString"));

@LittleHuba LittleHuba left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm struggling to understand the purpose of SOCom here.
To me this looks like a 1:1 reimplementation of what we already provide in mw::com.

We had the agreement that mw::com remains the only high-level communication abstraction.

Please prepare a detailed run-down of why you cannot use mw::com (if necessary with a custom binding) for this purpose for our next weekly meeting.

@lurtz

lurtz commented Aug 6, 2026

Copy link
Copy Markdown
Contributor Author

I'm struggling to understand the purpose of SOCom here. To me this looks like a 1:1 reimplementation of what we already provide in mw::com.

We had the agreement that mw::com remains the only high-level communication abstraction.

Please prepare a detailed run-down of why you cannot use mw::com (if necessary with a custom binding) for this purpose for our next weekly meeting.

We wanted first to implement the gateway underneath mw::com and asked @crimson11 for help: https://github.com/orgs/eclipse-score/discussions/1984#discussioncomment-15209694

But even he eventually bailed out and preferred not to extend the mw::com-API with SOME/IP specific functionality and wanted to create a new API for the SOME/IP Gateway. Instead of designing a new API from scratch, we took socom and removed everything we do not need for the SOME/IP Gateway.

We agreed with @crimson11 that we still use e.g. @score_baselibs//score/memory/shared and @score_communication//score/message_passing.

Copilot AI review requested due to automatic review settings August 6, 2026 14:05

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.

Pull request overview

Copilot reviewed 106 out of 109 changed files in this pull request and generated no new comments.

Suppressed comments (12)

score/socom/impl/string_registry.cpp:64

  • String_registry::insert(std::string&&) searches for an existing entry using entry.data() == new_string, which compares through C-string semantics (breaks on embedded \0) and also makes the lookup O(n) even though an unordered_set is available. Use unordered_set::find with a std::string_view key before moving new_string.
    score/socom/test/unit/string_registry_tests.cpp:33
  • This assertion compares a const char* (data()) to an std::string, which relies on null-termination and doesn't validate the view length. Prefer comparing via string_view() (or EXPECT_EQ on the view) to avoid C-string semantics.
    score/socom/test/unit/string_registry_tests.cpp:39
  • This assertion compares a const char* (data()) to an std::string, which relies on null-termination and doesn't validate the view length. Prefer comparing via string_view() (or EXPECT_EQ on the view) to avoid C-string semantics.
    score/socom/test/unit/smoke_test.cpp:143
  • pointer is dereferenced unconditionally, but it is only set if the call_method path succeeds and the mock callback runs. The test currently comments out the success assertion, so this can become undefined behavior (nullopt deref) and produce flaky failures.
    score/socom/test/framework/src/multi_threaded_test_template.cpp:18
  • <bits/chrono.h> is a non-standard libstdc++ internal header and will not be available on non-GNU standard libraries. It should not be included in production code (or test framework code).
    score/socom/test/unit/registry_string_view_tests.cpp:103
  • The comment contradicts the asserted behavior: Registry_string_view equality is pointer-based here, so the same string stored in different registries should compare as different (and the test expects that).
    .bazelrc:148
  • This repository-level Bazel configuration enables someip-gateway for all builds, but the comment explicitly says it must be removed before merge. Leaving this in will change default build behavior for everyone and can mask feature-gating issues.
# Remove before merge. Only for getting CI results
common --features=someip-gateway

score/socom/test/framework/inc/score/socom/vector_payload.hpp:18

  • This header uses std::is_unsigned_v and std::begin/std::end but doesn't include <type_traits> / <iterator>. Relying on transitive includes is brittle and can break builds on different standard library implementations.
    score/socom/test/framework/inc/score/socom/temporary_event_subscription.hpp:18
  • This header defines Subscriptions as std::vector<std::unique_ptr<...>> but doesn't include <vector> or <memory>. This can fail to compile depending on transitive includes.
    score/socom/test/framework/inc/score/socom/temporary_event_subscription.hpp:48
  • Typo in the parameter documentation (brokeness vs brokenness). This is public-facing test framework documentation, so it's worth keeping consistent with the actual parameter name.
    score/socom/test/framework/inc/score/socom/multi_threaded_test_template.hpp:20
  • This header uses size_t without including <cstddef>. Depending on transitive includes for size_t availability is not portable across toolchains.
    score/socom/test/framework/inc/score/socom/multi_threaded_test_template.hpp:34
  • Prefer std::size_t (and include <cstddef>) rather than relying on an unqualified size_t being visible in this header.

Copilot AI review requested due to automatic review settings August 6, 2026 14:31

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.

Pull request overview

Copilot reviewed 107 out of 110 changed files in this pull request and generated no new comments.

Suppressed comments (11)

score/socom/impl/string_registry.cpp:65

  • String_registry::insert(std::string&&) linearly scans m_registered_strings and compares via entry.data() == new_string, which is O(n) and relies on null-termination (and would be wrong for embedded '\0'). Since m_registered_strings is an unordered_set<std::string_view> with content-based lookup, this should just use find(new_string) for average O(1) and correct length-based comparison.
    score/socom/test/unit/string_registry_tests.cpp:33
  • This assertion compares Registry_string_view::data() (a raw pointer) against a temporary std::string via the C-string overload. That relies on null-termination and doesn't validate the view's length. Prefer comparing the returned std::string_view directly.
    score/socom/test/unit/string_registry_tests.cpp:39
  • Same issue as above: comparing data() to a std::string relies on null-termination and doesn't check length. Compare string_view() instead so the test matches Registry_string_view semantics.
    score/socom/test/unit/registry_string_view_tests.cpp:107
  • This test's comments and assertions don't match the intended semantics: the first comment says different-registry strings compare "as same" but the assertion expects false, and the second comment claims to test "added twice" but it only compares string_view1 to itself. This reduces test value and can mislead future maintainers.
    score/socom/test/unit/service_interface_identifier_tests.cpp:58
  • The test name uses "Literator" which appears to be a typo for "Literal" (this test is about constructing from a Registry_string_view / literal registry entry). Fixing the spelling improves discoverability when grepping for related tests.
    score/socom/test/framework/src/multi_threaded_test_template.cpp:18
  • <bits/chrono.h> is a non-standard libstdc++ internal header and will break builds on non-GNU standard libraries (and is redundant since <chrono> is already included). Prefer only the standard headers here.
    .bazelrc:148
  • This repo-level .bazelrc change force-enables --features=someip-gateway for all Bazel commands. The comment indicates this is only for CI experimentation; keeping it will change default developer/CI behavior and can hide feature-gating issues elsewhere. Please drop this before merging (feature should be enabled via CI configs or explicit --config instead).
# Remove before merge. Only for getting CI results
common --features=someip-gateway

score/socom/test/unit/registry_string_view_tests.cpp:35

  • The comments here are duplicated and contain a typo ("the the end"). This makes the test harder to read and looks unintentional.
    score/socom/test/unit/service_interface_identifier_tests.cpp:116
  • Same typo in this test name ("Literator" -> "Literal").
    score/socom/test/framework/inc/score/socom/temporary_event_subscription.hpp:41
  • Typoed enum values/param docs (no_server_reponse*, brokeness) leak into the test framework API and make the meaning harder to understand. Consider renaming to *_response* and brokenness consistently.
    .github/workflows/_linter.yml:160
  • The SARIF merge loop concatenates multiple JSON documents without guaranteeing a separator between files. If any report doesn't end with a newline, the stream can become }{ which jq cannot parse. Add an explicit newline (or other whitespace) after each cat to make the slurped input unambiguous.
          #
          # Use one jq process fed from stdin instead of `xargs jq ...`, because
          # xargs may split into multiple jq invocations once argv limits are hit,
          # which would append multiple JSON documents to the output file.
          while IFS= read -r report; do
            cat "${report}"
          done <<< "${REPORTS}" | jq -s '{

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

3 participants