Skip to content

feat(dc_measurements): resolve robot_name from literal, hostname, or file - #456

Merged
Minipada merged 3 commits into
jazzyfrom
feature/442-flexible-robot-name-resolution-literal-h
Aug 31, 2026
Merged

feat(dc_measurements): resolve robot_name from literal, hostname, or file#456
Minipada merged 3 commits into
jazzyfrom
feature/442-flexible-robot-name-resolution-literal-h

Conversation

@Minipada

Copy link
Copy Markdown
Owner

Summary

  • robot_name (a custom key already carried by Records via custom_key_str_list) now
    resolves in order: a literal custom_keys_str.robot_name.value (today's behaviour,
    unchanged), then custom_keys_str.robot_name.value_from_file, then the machine's
    hostname as the default when neither is set — so a fleet doesn't need one hand-edited
    params file per robot.
  • A value_from_file that names an unreadable/missing file, or any source that resolves
    to an empty string, now fails node configuration with a clear std::runtime_error
    instead of silently shipping Records with a missing or blank robot_name.
  • All other custom keys are untouched — this is scoped to the robot_name key only.
  • Documented the resolution order and failure behavior in doc/src/dc/measurements.md.

Closes #442

Test plan

  • Added dc_measurements gtest coverage in test_measurement_dummy.cpp:
    • literal value still wins (unchanged behaviour)
    • defaults to the hostname when nothing is configured
    • resolves from value_from_file
    • a missing value_from_file throws at configure() time
  • CI: colcon test via tools/e2e/scripts/build.sh (triggered by this PR)

🤖 Generated with Claude Code

https://claude.ai/code/session_01LgsQrndgkMK3F7bUcWoU3a

Minipada and others added 2 commits August 31, 2026 12:35
…file

Records already carry robot_name through custom keys, but the value had to be
written literally into each robot's params file -- one hand-edited file per
robot in a fleet. robot_name now resolves in order: a literal
custom_keys_str.robot_name.value (unchanged), then
custom_keys_str.robot_name.value_from_file, then the machine's hostname as the
default when neither is set. A missing file or an empty resolved value fails
node configuration with a clear error instead of shipping Records with a
blank robot_name.

Closes #442

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LgsQrndgkMK3F7bUcWoU3a
Signed-off-by: David Bensoussan <d.bensoussan@proton.me>
Include order and continuation-line alignment CI's clang-format hook flagged
on PR #456.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LgsQrndgkMK3F7bUcWoU3a
Signed-off-by: David Bensoussan <d.bensoussan@proton.me>
@codecov

codecov Bot commented Aug 31, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.59259% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 71.00%. Comparing base (2b2051b) to head (1cc3eb4).

Files with missing lines Patch % Lines
dc_measurements/src/measurement_server.cpp 92.60% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##            jazzy     #456      +/-   ##
==========================================
+ Coverage   70.93%   71.00%   +0.08%     
==========================================
  Files         119      119              
  Lines        7401     7427      +26     
==========================================
+ Hits         5249     5273      +24     
- Misses       2152     2154       +2     
Flag Coverage Δ
cpp-jazzy 71.00% <92.60%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

rclcpp_lifecycle wraps on_configure() in its own catch and converts an
uncaught exception into CallbackReturn::ERROR instead of propagating it to
the caller of configure() -- the same behavior test_measurement_bool_equal.cpp
already documents for BoolEqual's type-mismatch case. RobotNameMissingFile-
FailsConfigureClearly was asserting the wrong thing (EXPECT_THROW), which CI's
colcon test caught: configure() logged the "robot_name: could not read
value_from_file" error exactly as intended but returned normally, so the test
now asserts the node fails to reach the inactive state instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LgsQrndgkMK3F7bUcWoU3a
Signed-off-by: David Bensoussan <d.bensoussan@proton.me>
@Minipada
Minipada merged commit f7249e1 into jazzy Aug 31, 2026
11 checks passed
Minipada added a commit that referenced this pull request Aug 31, 2026
Include order and continuation-line alignment CI's clang-format hook flagged
on PR #456.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LgsQrndgkMK3F7bUcWoU3a
Signed-off-by: David Bensoussan <d.bensoussan@proton.me>
@github-actions
github-actions Bot deleted the feature/442-flexible-robot-name-resolution-literal-h branch August 31, 2026 11:24
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.

1 participant