Skip to content

[launch_manager] use score::Result instead of score::cpp::expected - #350

Open
Narasimha2211 wants to merge 1 commit into
eclipse-score:mainfrom
Narasimha2211:338-launch-manager-score-result
Open

[launch_manager] use score::Result instead of score::cpp::expected#350
Narasimha2211 wants to merge 1 commit into
eclipse-score:mainfrom
Narasimha2211:338-launch-manager-score-result

Conversation

@Narasimha2211

Copy link
Copy Markdown
Contributor

Summary

Closes #338.

This issue is a "spin off from review comment" auto-generated from a review exchange on #333, about the newly-added MpscBoundedQueue/MPMCConcurrentQueue classes using score::cpp::expected_blank<ConcurrencyErrc>.

Scope

Scoped this to exactly the concurrency queue subsystem rather than every score::cpp::expected usage under launch_manager/, which also includes an unrelated configuration/flatbuffer_* subsystem using its own IConfigLoader::Error enum across ~20 functions, and a test file mocking a third-party score::os API signature that must not change. Widening the scope to those would have been a much larger, speculative change not discussed in this issue.

Files changed (5)

  • score/launch_manager/src/daemon/src/common/concurrency/concurrency_error_domain.hpp -- new ConcurrencyErrorDomain (score::result::ErrorDomain subclass) and an ADL-visible MakeError(ConcurrencyErrc, ...), mirroring the existing ExecErrorDomain pattern in execution_error.h. Also changed ConcurrencyErrc's underlying type from uint8_t to score::result::ErrorCode (int32_t) -- required by score::result::Error's constructor constraint (IsValidErrorCodeEnum).
  • mpsc_bounded_queue.hpp, mpmc_concurrent_queue.hpp -- all score::cpp::expected_blank<ConcurrencyErrc>/score::cpp::expected<T, ConcurrencyErrc> return types converted to score::Result<void>/score::Result<T>; score::cpp::make_unexpected(...) -> score::MakeUnexpected(...); score::cpp::blank{} -> {}.
  • mpmc_concurrent_queue_test.cpp -- updated 5 local variable declarations to match.
  • BUILD -- added @score_baselibs//score/result dep to both queue targets; dropped the now-fully-unused @score_baselibs//score/language/futurecpp dep from mpmc_concurrent_queue (kept it for mpsc_bounded_queue, which still needs score/assert.hpp from that package).

mpsc_bounded_queue_test.cpp, workerthread.hpp, mpmc_concurrent_queue_benchmark.cpp, and the two external callers (graph.cpp, process_info_node.cpp) needed no changes -- they consume results via auto/.has_value()/.error()/operator bool(), all API-identical between score::cpp::expected and score::Result.

How I tested this

No Bazel binary was available in the environment I worked in, so a build wasn't feasible. Verified by evidence-based code review instead:

  • Fetched and read the actual score::Result/score::result::Error/ErrorDomain implementations from eclipse-score/baselibs to confirm API compatibility (has_value(), error(), operator bool(), implicit construction from unexpected<E>, and the LogStream& operator<<(LogStream&, const Error&) overload that keeps existing LM_LOG_ERROR() << ... << foo.error() call sites compiling unchanged).
  • Traced every call site of the two migrated queues across the module to confirm no other file needed edits.
  • Cross-checked the ExecErrorDomain/ExecErrc pattern already used elsewhere in this codebase and replicated it exactly for ConcurrencyErrc.
  • Repeated greps for leftover score::cpp::expected/expected_blank/score/expected.hpp references in the touched scope -- none remain.

Given I couldn't build, a CI run / maintainer build check would be very welcome on this one.

Commits are DCO-signed (git commit -s).

…concurrency queues

MpscBoundedQueue and MPMCConcurrentQueue (introduced in eclipse-score#333) used
score::cpp::expected/expected_blank<ConcurrencyErrc>, whereas the rest of
launch_manager's public error-returning APIs use score::Result. Per the
PR eclipse-score#333 review discussion, switch these two queues over to score::Result
for consistency.

- ConcurrencyErrc's underlying type changes from uint8_t to
  score::result::ErrorCode (int32_t), as required to construct a
  score::result::Error from it.
- Add ConcurrencyErrorDomain and an ADL-visible MakeError() overload for
  ConcurrencyErrc, following the same pattern as ExecErrorDomain in
  score/launch_manager/src/execution_error.h.
- push()/wait()/stop() now return score::Result<void>; pop() returns
  score::Result<T>. Callers that only relied on has_value()/error()/
  operator bool() (workerthread.hpp, graph.cpp, process_info_node.cpp)
  did not need changes since they use `auto` for the result type.
- Update BUILD deps: add @score_baselibs//score/result to both queue
  targets, and drop the now-unused @score_baselibs//score/language/futurecpp
  dependency from mpmc_concurrent_queue (mpsc_bounded_queue keeps it for
  score/assert.hpp).

Fixes eclipse-score#338

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: asymtote <152078151+asymtote@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 23, 2026 05:31
@Narasimha2211
Narasimha2211 temporarily deployed to workflow-approval July 23, 2026 05:31 — with GitHub Actions Inactive
@Narasimha2211
Narasimha2211 temporarily deployed to workflow-approval July 23, 2026 05:31 — with GitHub Actions Inactive

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

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: 31e36c48-8e8c-4738-8621-e74bf3ca4f73
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 (43 packages loaded, 10 targets configured)

Analyzing: target //:license-check (86 packages loaded, 10 targets configured)

Analyzing: target //:license-check (142 packages loaded, 1814 targets configured)

Analyzing: target //:license-check (153 packages loaded, 2904 targets configured)

Analyzing: target //:license-check (154 packages loaded, 8200 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8271 targets configured)

Analyzing: target //:license-check (164 packages loaded, 8271 targets configured)

Analyzing: target //:license-check (167 packages loaded, 10159 targets configured)

Analyzing: target //:license-check (168 packages loaded, 10283 targets configured)

INFO: Analyzed target //:license-check (169 packages loaded, 10409 targets configured).
[10 / 16] checking cached actions
[13 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox
[15 / 16] Building license.check.license_check.jar (); 0s disk-cache, multiplex-worker
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: 23.037s, Critical Path: 2.30s
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>]

@github-actions

Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

@NicolasFussberger

Copy link
Copy Markdown
Contributor

The eclipsefdn/eca check is failing. @Narasimha2211 please make sure that you have an eclipse account that is linked to your github account. We will only be able to merge your changes, once this check is successful.

@paulquiring

Copy link
Copy Markdown
Contributor

The eclipsefdn/eca check is failing. @Narasimha2211 please make sure that you have an eclipse account that is linked to your github account. We will only be able to merge your changes, once this check is successful.

@Narasimha2211 you find the instructions here https://eclipse-score.github.io/score/main/contribute/general/contribution_attribution.html#

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.

[launch_manager] use score::Result instead of score::cpp::expected

4 participants