Skip to content

hmon: fix cycles interval FFI issue#134

Merged
pawelrutkaq merged 1 commit intoeclipse-score:mainfrom
qorix-group:arkjedrz_fix-cycles-ffi
Mar 27, 2026
Merged

hmon: fix cycles interval FFI issue#134
pawelrutkaq merged 1 commit intoeclipse-score:mainfrom
qorix-group:arkjedrz_fix-cycles-ffi

Conversation

@arkjedrz
Copy link
Copy Markdown
Contributor

@arkjedrz arkjedrz commented Mar 27, 2026

Make optional parameters optional.
Previously uninitialized variable was used if not set.

Resolve #136

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 27, 2026

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.4.2) and connecting to it...
INFO: Invocation ID: cb270d31-a941-4035-892b-298ad4948622
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'score_rust_policies', the root module requires module version score_rust_policies@0.0.3, but got score_rust_policies@0.0.5 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
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 (43 packages loaded, 9 targets configured)

Analyzing: target //:license-check (95 packages loaded, 35 targets configured)

Analyzing: target //:license-check (151 packages loaded, 2686 targets configured)

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

Analyzing: target //:license-check (165 packages loaded, 7901 targets configured)

Analyzing: target //:license-check (165 packages loaded, 7901 targets configured)

Analyzing: target //:license-check (166 packages loaded, 8025 targets configured)

INFO: Analyzed target //:license-check (170 packages loaded, 10039 targets configured).
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions, 1 running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 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: 21.666s, Critical Path: 2.68s
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>]

Copy link
Copy Markdown

Copilot AI left a comment

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 fixes an FFI bug around cycle interval parameters for HealthMonitorBuilder::build() by making the cycle interval inputs truly optional (nullable pointers), avoiding use of uninitialized values when the caller doesn’t set them.

Changes:

  • Updated the Rust health_monitor_builder_build FFI to accept nullable *const u64 cycle interval pointers and only apply cycle settings when non-null.
  • Updated C++ HealthMonitorBuilder to store cycle intervals as optional values and pass nullable pointers to Rust.
  • Updated Rust unit tests across monitor FFI modules to pass null for “unset” intervals; added a Rust test covering the non-null pointer path.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/health_monitoring_lib/rust/ffi.rs Changes FFI signature to nullable pointers, conditionally applies cycles, updates/adds tests for optional + provided intervals.
src/health_monitoring_lib/rust/logic/ffi.rs Adjusts tests to pass null cycle interval pointers to the updated build API.
src/health_monitoring_lib/rust/heartbeat/ffi.rs Adjusts tests to pass null cycle interval pointers to the updated build API.
src/health_monitoring_lib/rust/deadline/ffi.rs Adjusts tests to pass null cycle interval pointers to the updated build API.
src/health_monitoring_lib/cpp/include/score/hm/health_monitor.h Stores cycle intervals as optionals to support “unset” semantics.
src/health_monitoring_lib/cpp/health_monitor.cpp Updates the C++↔Rust FFI declaration and passes nullable pointers based on optionals.

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

@github-actions
Copy link
Copy Markdown

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

@arkjedrz arkjedrz force-pushed the arkjedrz_fix-cycles-ffi branch from 156d217 to 96b3bc2 Compare March 27, 2026 12:02
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 27, 2026 12:02 — with GitHub Actions Inactive
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 27, 2026 12:02 — with GitHub Actions Inactive
Copy link
Copy Markdown
Contributor

@pawelrutkaq pawelrutkaq left a comment

Choose a reason for hiding this comment

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

Create a bug ticket to describe what the problem.
BTW value should have been initialized to 0 with the previous code by internal milis ctor or ?

@arkjedrz arkjedrz requested a review from pawelrutkaq March 27, 2026 13:27
- Make optional parameters optional.
  - Previously uninitialized variable was used if not set.
- Prevent negative cycle durations.
@arkjedrz arkjedrz force-pushed the arkjedrz_fix-cycles-ffi branch from 96b3bc2 to 4562f44 Compare March 27, 2026 14:16
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 27, 2026 14:16 — with GitHub Actions Inactive
@arkjedrz arkjedrz temporarily deployed to workflow-approval March 27, 2026 14:16 — with GitHub Actions Inactive
@pawelrutkaq pawelrutkaq merged commit 5b4fb3f into eclipse-score:main Mar 27, 2026
19 checks passed
@arkjedrz arkjedrz deleted the arkjedrz_fix-cycles-ffi branch March 27, 2026 14:35
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.

Bugfix: fix unset default cycle interval values in HMON

3 participants