Skip to content

Rename IComponent result types - #797

Open
danth wants to merge 5 commits into
eclipse-score:mainfrom
etas-contrib:pin-rename-result
Open

danth wants to merge 5 commits into
eclipse-score:mainfrom
etas-contrib:pin-rename-result

Conversation

@danth

@danth danth commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

I struggled to understand the original code because some values had multiple meanings, and different things were valid depending on the context.

Split into two results, one for de/activate and one for termination. The interesting changes are in icomponent.hpp.

Part of addressing #705 (comment)

@WilliamRoebuck WilliamRoebuck 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 like removing the error before/after ready distinction, that part was always quite confusing to me. Unfortunately though, a lot of the new changes have just become out of date yesterday since #738.

In summary, the whole async issue is no longer present, kWaiting can probably be removed. As far as I know:

  • tryReportCompletion is no longer needed. Existing calls should be replaced or removed
  • tryHandleTermination - should now only flag an error to the caller or return some sort of void/ignore result (no error yet). Should never return kSuccess. Terminations during startup are resolved at the end using the stored termination result member.
  • activate & deactivate - always runs synchronously and returns success or failure

This all probably allows process monitor to be simplified as well

There are also some leftover unit tests (several of the parameterized ones) that test various async termination scenarios, most of which can be removed.

@danth

danth commented Oct 15, 2026

Copy link
Copy Markdown
Member Author

In summary, the whole async issue is no longer present

This is good to hear. I think most of the dead code will be replaced anyway as part of #705, so in this pull request I'll only make the minimal edits needed to change the error types.

@danth

danth commented Oct 16, 2026

Copy link
Copy Markdown
Member Author

@WilliamRoebuck I've removed the async values from the enums. I'd appreciate if you could take another look :))

@danth
danth requested a review from WilliamRoebuck October 16, 2026 10:22
danth added 3 commits October 16, 2026 11:58
The old result was difficult to understand because some values had
multiple meanings, and different things were valid depending on the
context.

Split into two results, one for de/activate and one for termination.
The interesting changes are in `icomponent.hpp`.
I only made the minimal edits in `ProcessInfoNode` to be able to
update the enums: there is still a lot of code which does not
really make sense any more.

However, the new `Component` class shall eventually replace
`ProcessInfoNode`, so there is not much point refactoring it
further.
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-797: https://eclipse-score.github.io/lifecycle/pr-797/

{
run_target.activate(stop_source_.get_token());
const IComponent::RequestResult result = run_target.activate(stop_source_.get_token());
SCORE_LANGUAGE_FUTURECPP_ASSERT(result == IComponent::RequestResult::kSuccess);

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.

Hmm I think it's right now safe to assert here because the run_target.activate just sets variable but not sure if we should assume that will be the case forever. I would rather log an error I think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Originally we just ignored the return value entirely. I think logging an error could have the same consequences (errors going unnoticed) - the log message might not be noticed if tests are passing.

I would prefer keeping the assert and adding proper error handling if/when the need arises

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 think the assert is good here because other changes might be needed if this did change, needs an assert message though to clear things up (e.g. "Run target activation cannot fail").

Also, is SCORE_LANGUAGE_FUTURECPP_ASSERT debug or production? Probably doesn't matter here but this seems ambiguous. Or did the API change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Also, is SCORE_LANGUAGE_FUTURECPP_ASSERT debug or production?

Neither...

Compilation flag
Default Debug Production
Assertion type
Default Yes Yes No
Debug No Yes No
Production Yes Yes Yes

Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/icomponent.hpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/icomponent.hpp Outdated
@danth
danth requested a deployment to workflow-approval October 20, 2026 09:19 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval October 20, 2026 09:19 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval October 20, 2026 09:19 — with GitHub Actions Waiting
@danth
danth requested a deployment to workflow-approval October 20, 2026 09:19 — with GitHub Actions Waiting

@WilliamRoebuck WilliamRoebuck 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.

Looks great now, I only have two small suggestions

IdentifierHash node_identifier;
/// @brief Description of the error.
IComponent::ComponentError reason;
/// @brief Why the activation failed, either kFailure or kTimeout.

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 think RequestResult should still be an expected (expected_blank I think) with an error code. Something that can be kSuccess being an error code seems wrong to me.

{
run_target.activate(stop_source_.get_token());
const IComponent::RequestResult result = run_target.activate(stop_source_.get_token());
SCORE_LANGUAGE_FUTURECPP_ASSERT(result == IComponent::RequestResult::kSuccess);

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 think the assert is good here because other changes might be needed if this did change, needs an assert message though to clear things up (e.g. "Run target activation cannot fail").

Also, is SCORE_LANGUAGE_FUTURECPP_ASSERT debug or production? Probably doesn't matter here but this seems ambiguous. Or did the API change?

This branch is waiting to be deployed

1 waiting deployment
workflow-approval — 59550a03 Waiting Oct 20, 2026 by danth via Build and test arm64-qnx / approval #1602
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