Skip to content

fix(lifecycle_client): link lifecycle_mock against lifecyclemanager t… - #337

Open
Chahult wants to merge 4 commits into
eclipse-score:mainfrom
Chahult:fix/lifecycle_mock_vtable_link_v0.2.0
Open

fix(lifecycle_client): link lifecycle_mock against lifecyclemanager t…#337
Chahult wants to merge 4 commits into
eclipse-score:mainfrom
Chahult:fix/lifecycle_mock_vtable_link_v0.2.0

Conversation

@Chahult

@Chahult Chahult commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

…o resolve vtable

lifecycle_mock provides a mock implementation of LifeCycleManager, which inherits from the concrete class defined in lifecyclemanager.cpp. Without linking against the :lifecyclemanager target, the vtable symbol is undefined when building lifecycle_mock as a shared library (--no-allow-shlib-undefined).

Added :lifecyclemanager to lifecycle_mock's deps to provide the vtable.

@github-actions

github-actions Bot commented Jul 21, 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: a5f6ac73-6cb5-45d3-ab26-b292f5a5e91f
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: 
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 (33 packages loaded, 10 targets configured)

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

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

Analyzing: target //:license-check (152 packages loaded, 2794 targets configured)

Analyzing: target //:license-check (153 packages loaded, 6231 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 (164 packages loaded, 8271 targets configured)

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

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

INFO: Analyzed target //:license-check (169 packages loaded, 10409 targets configured).
[4 / 14] checking cached actions
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[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: 24.230s, Critical Path: 2.62s
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>]

@anmittag

Copy link
Copy Markdown
Member

@Chahult some checks are failing,are you planning to adapt or delete the PR?

@anmittag anmittag moved this from Backlog to Ready in LCM - Lifecycle & Health FT Jul 21, 2026
@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from bd15106 to 73c9454 Compare July 22, 2026 04:46
@Chahult
Chahult requested a deployment to workflow-approval July 22, 2026 04:46 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 22, 2026 04:46 — with GitHub Actions Waiting
@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 73c9454 to 2da00ec Compare July 22, 2026 11:19
@Chahult
Chahult requested a deployment to workflow-approval July 22, 2026 11:19 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 22, 2026 11:19 — with GitHub Actions Waiting
@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 2da00ec to 4e403ba Compare July 22, 2026 11:22
@Chahult
Chahult requested a deployment to workflow-approval July 22, 2026 11:22 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 22, 2026 11:22 — with GitHub Actions Waiting
@github-actions

Copy link
Copy Markdown

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

@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 4e403ba to 9ae0e52 Compare July 23, 2026 04:37
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 04:37 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 04:37 — with GitHub Actions Waiting
@Chahult

Chahult commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@NicolasFussberger Could you please review

@Chahult Chahult removed their assignment Jul 23, 2026
@Chahult

Chahult commented Jul 23, 2026

Copy link
Copy Markdown
Contributor Author

@Chahult some checks are failing,are you planning to adapt or delete the PR?

Adapt the changes for config management
Please assign this to me and also add Nicolas Fußberger as a reviewer

@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 9ae0e52 to 2de1db3 Compare July 23, 2026 05:56
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 05:56 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 05:56 — with GitHub Actions Waiting
lifecycle_mock provides a mock of LifeCycleManager which inherits from
the concrete class. Without :lifecyclemanager in its deps the vtable
symbol is undefined when building lifecycle_mock as a shared library
(--no-allow-shlib-undefined).

Also guard all ApplicationContext callbacks against null to prevent
std::bad_function_call when a global ApplicationContext is constructed
before any ApplicationContextMock instance exists.
@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 2de1db3 to 5ddb37e Compare July 23, 2026 06:21
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 06:21 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 06:21 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 07:17 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 23, 2026 07:17 — with GitHub Actions Waiting
Comment thread score/launch_manager/src/lifecycle_client/BUILD Outdated
@NicolasFussberger

Copy link
Copy Markdown
Contributor

@Chahult In the lifecycle repo we have a bit the problem that these mocks were contributed but we have no tests for them at the moment and its also not really obvious how to use them.
This is why currently, there is a high chance we accidentally break them.

Would it be possible for you to contribute some tests based on your usage of these mocks? E.g. for some example application we have in the examples folder?

@Chahult

Chahult commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@Chahult In the lifecycle repo we have a bit the problem that these mocks were contributed but we have no tests for them at the moment and its also not really obvious how to use them. This is why currently, there is a high chance we accidentally break them.

Would it be possible for you to contribute some tests based on your usage of these mocks? E.g. for some example application we have in the examples folder?

Sure, Done — added examples/cpp_lifecycle_app/lifecycle_mocks_UT.cpp with tests that mirror how config_management uses the mocks (argument injection via ApplicationContextMock, lifecycle flow via LifeCycleManagerMock). These also serve as usage documentation for future contributors.

@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 80d7948 to f619102 Compare July 24, 2026 04:59
@Chahult
Chahult requested a deployment to workflow-approval July 24, 2026 04:59 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 24, 2026 04:59 — with GitHub Actions Waiting
Comment thread examples/cpp_lifecycle_app/BUILD Outdated
Comment thread score/launch_manager/src/lifecycle_client/BUILD Outdated
Comment thread score/launch_manager/src/lifecycle_client/BUILD Outdated
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 08:35 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 08:35 — with GitHub Actions Waiting
@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 279936a to b5ac84b Compare July 27, 2026 08:44
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 08:44 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 08:44 — with GitHub Actions Waiting
@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from b5ac84b to 0df76f4 Compare July 27, 2026 08:52
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 08:52 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 08:52 — with GitHub Actions Waiting
visibility = ["//score/launch_manager:__subpackages__"],
deps = [
":applicationcontext_mock",
":lifecyclemanager",

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.

Is it really correct to add the lifecylemanager here?
Now this target contains both, the lifecyclemanagermock.cpp and the actual lifecyclemanager implementation

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.

Yes, it's intentional. LifeCycleManagerMock inherits from the concrete LifeCycleManager class. Without :lifecyclemanager in its deps, the vtable symbols for the base class are undefined when building lifecycle_mock as a shared library under --no-allow-shlib-undefined.
Adding :lifecyclemanager provides the vtable — this is the minimum fix to make the linker happy. The mock .cpp itself remains unchanged; it just needs the base class compiled in.

Comment thread score/launch_manager/BUILD Outdated
actual = "//score/launch_manager/src/lifecycle_client:lifecycle_mock",
testonly = True,
deps = [
"//score/launch_manager/src/lifecycle_client:applicationcontext_mock",

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 applicationcontext mock is already part of //score/launch_manager/src/lifecycle_client:lifecycle_mock

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.

You're right , lifecycle_mock already depends on :applicationcontext_mock transitively. Removed the explicit dep from lifecycle_mock_cc

- Move lifecycle_mocks_UT from examples/ into lifecycle_client/src/
  (self-contained test, not coupled to the example app)
- Remove lifecycle_test_mocks aggregator target; adapt lifecycle_mock_cc
  in //score/launch_manager to aggregate all three mock targets instead
- Revert accidental visibility widening on applicationcontext, application,
  and runapplication back to //score/launch_manager:__subpackages__
@Chahult
Chahult force-pushed the fix/lifecycle_mock_vtable_link_v0.2.0 branch from 0df76f4 to e179e93 Compare July 27, 2026 14:42
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 14:42 — with GitHub Actions Waiting
@Chahult
Chahult requested a deployment to workflow-approval July 27, 2026 14:42 — with GitHub Actions Waiting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

3 participants