hmon: fix cycles interval FFI issue#134
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
There was a problem hiding this comment.
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_buildFFI to accept nullable*const u64cycle interval pointers and only apply cycle settings when non-null. - Updated C++
HealthMonitorBuilderto 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.
src/health_monitoring_lib/cpp/include/score/hm/health_monitor.h
Outdated
Show resolved
Hide resolved
|
The created documentation from the pull request is available at: docu-html |
156d217 to
96b3bc2
Compare
pawelrutkaq
left a comment
There was a problem hiding this comment.
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 ?
- Make optional parameters optional. - Previously uninitialized variable was used if not set. - Prevent negative cycle durations.
96b3bc2 to
4562f44
Compare
Make optional parameters optional.
Previously uninitialized variable was used if not set.
Resolve #136