Stability Indicator Upgrade and v3.3.0 Bump#20
Conversation
- Bumped version to 3.3.0 across all configs, headers, and docs. - Added `include/raps/safety/stability_indicator.hpp` implementing S_u, hysteresis, and maneuver-aware thresholds. - Added SIL unit tests for stability indicator and version consistency. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
There was a problem hiding this comment.
Pull request overview
Upgrades the Stability Indicator subsystem (maneuver-aware thresholds, hysteresis tracking, rate-of-change checks, and DSM event emission) and bumps the repository version to v3.3.0 across code/docs/tests.
Changes:
- Bump version constants and
VERSIONfile to 3.3.0, plus update docs/examples that surface the version. - Add a new header-only Stability Indicator implementation with thresholds, hysteresis, and rate limiting.
- Add new SIL test executables covering version consistency and Stability Indicator behavior.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
VERSION |
Updates repo version marker to 3.3.0. |
include/raps/core/raps_core_types.hpp |
Bumps RAPSVersion constants to 3.3.0. |
include/raps/safety/stability_indicator.hpp |
Introduces new Stability Indicator + DSM event types. |
tests/sil/test_version.cpp |
Adds version consistency test (header constants vs VERSION file). |
tests/sil/test_stability_indicator.cpp |
Adds Stability Indicator unit tests (thresholds, hysteresis, rate). |
tests/sil/CMakeLists.txt |
Registers the new SIL test executables with CTest. |
include/raps/telemetry/telemetry_metadata.hpp |
Updates inline example comment to reference 3.3.0. |
examples/sil/sil_main.cpp |
Updates telemetry metadata version string to 3.3.0. |
examples/hil/hil_main.cpp |
Updates telemetry metadata version string to 3.3.0. |
docs/TELEMETRY_DASHBOARD.md |
Updates title/version reference to 3.3.0. |
docs/contracts/TELEMETRY_STORAGE_CONTRACT.md |
Updates referenced RAPS version to 3.3.0. |
CHANGELOG.md |
Updates a changelog bullet to reference 3.3.0. |
Comments suppressed due to low confidence (2)
examples/sil/sil_main.cpp:46
- The example hardcodes the version string in telemetry metadata. Since
RAPSVersion::STRINGis now the repository’s canonical version constant, prefer using it here (by includingraps/core/raps_core_types.hpp) to avoid missing future bumps in one-off example code paths.
telemetry_sink.open((run_dir + "/telemetry.jsonl").c_str());
raps::telemetry::TelemetryMetadata meta;
meta.raps_version = "3.3.0";
meta.telemetry_schema = "1.0";
meta.build_type = "SIL";
meta.notes = "SIL deterministic timing harness";
raps::telemetry::write_telemetry_metadata(run_dir, meta);
examples/hil/hil_main.cpp:131
- The example hardcodes the version string in telemetry metadata. Since
RAPSVersion::STRINGis now the repository’s canonical version constant, prefer using it here (by includingraps/core/raps_core_types.hpp) to avoid missing future bumps in one-off example code paths.
if (!run_dir.empty()) {
telemetry_sink.open((run_dir + "/telemetry.jsonl").c_str());
raps::telemetry::TelemetryMetadata meta;
meta.raps_version = "3.3.0";
meta.telemetry_schema = "1.0";
meta.build_type = "HIL";
meta.notes = "HIL loopback bring-up";
raps::telemetry::write_telemetry_metadata(run_dir, meta);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // S_u = 1 / (1 + phi^2 + chi^3) | ||
| static double compute_Su(double phi, double chi) { | ||
| double phi_sq = phi * phi; | ||
| double chi_cu = chi * chi * chi; |
There was a problem hiding this comment.
compute_Su() uses chi * chi * chi directly. Since chi can be negative (e.g., triadic time integration can drive it below 0), chi^3 becomes negative and the denominator can drop below 1, yielding S_u > 1 and breaking the expected [0,1] stability metric bounds / monotonicity. Consider cubing std::abs(chi) (or otherwise ensuring the chi contribution is non-negative) and add a unit test that covers negative chi behavior.
| // S_u = 1 / (1 + phi^2 + chi^3) | |
| static double compute_Su(double phi, double chi) { | |
| double phi_sq = phi * phi; | |
| double chi_cu = chi * chi * chi; | |
| // S_u = 1 / (1 + phi^2 + |chi|^3) | |
| static double compute_Su(double phi, double chi) { | |
| double phi_sq = phi * phi; | |
| double chi_abs = std::abs(chi); | |
| double chi_cu = chi_abs * chi_abs * chi_abs; |
| void test_version_consistency() { | ||
| assert(std::string(RAPSVersion::STRING) == "3.3.0"); | ||
| assert(RAPSVersion::MAJOR == 3); | ||
| assert(RAPSVersion::MINOR == 3); | ||
| assert(RAPSVersion::PATCH == 0); |
There was a problem hiding this comment.
This test relies on <cassert>/assert(). If the tests are built with NDEBUG (common for Release builds), all assertions become no-ops and the test will always pass even when behavior regresses. The other SIL tests in this suite use an explicit expectation helper + non-zero exit code; please switch this test to the same pattern (or otherwise avoid assert()) so it remains effective in all build types.
| // The executable is typically run from build_sil/, so we might need to go up to find VERSION | ||
| // We can try multiple paths | ||
| std::ifstream version_file("VERSION"); // if run from repo root | ||
| if (!version_file.is_open()) { | ||
| version_file.open("../../VERSION"); // if run from build_sil/ | ||
| } | ||
| if (!version_file.is_open()) { | ||
| version_file.open("../VERSION"); // just in case | ||
| } | ||
|
|
||
| std::string version_str; | ||
| if (version_file.is_open()) { | ||
| std::getline(version_file, version_str); | ||
| // Trim any trailing newline or carriage return | ||
| while (!version_str.empty() && (version_str.back() == '\n' || version_str.back() == '\r')) { | ||
| version_str.pop_back(); | ||
| } | ||
| assert(version_str == "3.3.0"); | ||
| version_file.close(); | ||
| } else { | ||
| std::cerr << "Could not open VERSION file." << std::endl; | ||
| assert(false); | ||
| } |
There was a problem hiding this comment.
The VERSION file lookup is brittle: VERSION, ../../VERSION, ../VERSION depends on the process working directory, which varies across CTest generators and out-of-source builds. Prefer making the path deterministic (e.g., configure/copy VERSION into the test binary dir, set add_test(WORKING_DIRECTORY ...), or pass the repo root/version path via a compile definition) and fail with a clear message including the attempted paths.
| void test_compute_Su() { | ||
| // 1. Boundary behavior: phi=0, chi=0 -> S_u = 1.0 | ||
| double su_max = StabilityIndicator::compute_Su(0.0, 0.0); | ||
| assert(std::abs(su_max - 1.0) < 1e-9); | ||
|
|
||
| // 2. Numerical output | ||
| // S_u = 1 / (1 + 0.5^2 + 0.5^3) = 1 / (1 + 0.25 + 0.125) = 1 / 1.375 = 0.727272... | ||
| double su_val = StabilityIndicator::compute_Su(0.5, 0.5); | ||
| assert(std::abs(su_val - 1.0/1.375) < 1e-9); | ||
|
|
||
| // 3. Monotonicity: as phi or chi increase, S_u decreases | ||
| double su_larger_phi = StabilityIndicator::compute_Su(0.6, 0.5); | ||
| assert(su_larger_phi < su_val); | ||
|
|
||
| double su_larger_chi = StabilityIndicator::compute_Su(0.5, 0.6); | ||
| assert(su_larger_chi < su_val); | ||
| } |
There was a problem hiding this comment.
Like test_version.cpp, this test uses <cassert>/assert(), which is compiled out under NDEBUG and can cause false-green CI runs in Release configurations. Please convert to an explicit check + failure counter + non-zero exit (consistent with existing SIL tests) so the test is always enforced.
| add_executable(raps_sil_version_tests | ||
| test_version.cpp | ||
| ) | ||
|
|
||
| target_include_directories(raps_sil_version_tests PRIVATE | ||
| ${PROJECT_SOURCE_DIR}/../../include | ||
| ${PROJECT_SOURCE_DIR}/../../src | ||
| ) | ||
|
|
||
| add_test( | ||
| NAME raps_sil_version_test | ||
| COMMAND raps_sil_version_tests | ||
| ) | ||
|
|
||
| # ------------------------------------------------------------ | ||
| # Stability Indicator Tests | ||
| # ------------------------------------------------------------ | ||
| add_executable(raps_sil_stability_tests | ||
| test_stability_indicator.cpp | ||
| ) | ||
|
|
||
| target_include_directories(raps_sil_stability_tests PRIVATE | ||
| ${PROJECT_SOURCE_DIR}/../../include | ||
| ${PROJECT_SOURCE_DIR}/../../src | ||
| ) | ||
|
|
||
| add_test( | ||
| NAME raps_sil_stability_test | ||
| COMMAND raps_sil_stability_tests | ||
| ) |
There was a problem hiding this comment.
New SIL test targets don’t get the same warning flags / compile options as the existing SIL tests (-Wall -Wextra -Wpedantic -Wshadow -Wconversion ... are only applied to the earlier targets). This reduces consistency and may hide warnings in the new tests. Consider extracting the common target_compile_options block and applying it to raps_sil_version_tests and raps_sil_stability_tests as well.
| ### Maintainability | ||
| - Add `VERSION` file (`3.2.0`) | ||
| - Add `VERSION` file (`3.3.0`) | ||
| - Add `CHANGELOG.md` | ||
| - Add `RAPSVersion` namespace constants to `raps_core_types.hpp` | ||
| - Update REST API health endpoint to use `RAPSVersion::STRING` |
There was a problem hiding this comment.
This changelog edit makes the [3.2.1] section claim it added a VERSION file of 3.3.0, which is internally inconsistent (a 3.2.1 release shouldn’t be documenting a 3.3.0 version). Instead of rewriting the historical 3.2.1 entry, add a new [3.3.0] section (or update the bullet to reflect what actually happened in 3.2.1).
Implemented the upgraded Stability Indicator subsystem with maneuver-aware coherence constraints, hysteresis state-tracking, rate-of-change limits, and DSM event integration. Also standardized the version to 3.3.0 across the repository.
PR created automatically by Jules for task 13800817032537530823 started by @dfeen87