Skip to content

fix: collect nested deps for action Goal/Result/Feedback hashing - #339

Merged
YuanYuYuan merged 2 commits into
mainfrom
fix/action-hash-nested-deps
Sep 2, 2026
Merged

fix: collect nested deps for action Goal/Result/Feedback hashing#339
YuanYuYuan merged 2 commits into
mainfrom
fix/action-hash-nested-deps

Conversation

@YuanYuYuan

@YuanYuYuan YuanYuYuan commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes the nested-dependency-collection defect #334 reported.

A community pull request (#334, draft) from @sathak93 reported a real defect and diagnosed and fixed it correctly, but shipped no test coverage. This preserves their original commit (cherry-picked, authorship intact) and adds the regression test the diagnosis needed on top.

calculate_send_goal_hash, calculate_get_result_hash, and calculate_feedback_message_hash in crates/hiroz-codegen/src/resolver.rs each insert the action's Goal/Result/Feedback TypeDescription into the deps map used to compute its RIHS01 type hash, but never call collect_nested_deps to also pull in that type's own nested/referenced message dependencies — unlike plain service hashing, which already does this (resolver.rs:181-182).

Before and after

today with this change
action Goal/Result/Feedback with no nested custom message correct hash (empty nested-deps set is also the correct set) unchanged
action Goal/Result/Feedback referencing a nested custom message deps omits the nested type; RIHS01 hash is wrong collect_nested_deps pulls in the nested type, matching the plain-service code path

What the test does

crates/hiroz-codegen/tests/action_nested_deps.rs (new) uses tf2_msgs/LookupTransform's Result (geometry_msgs/TransformStamped transform, tf2_msgs/TF2Error error), a real fixture already packaged under assets/jazzy/ — no new asset files needed. TransformStamped nests std_msgs/Header and geometry_msgs/Transform, and Transform itself nests Vector3/Quaternion, so this exercises multi-level recursive nesting, not just a single level.

today with this change
test_lookup_transform_get_result_hash_includes_nested_deps did not exist; the equivalent unfixed code computes RIHS01_d21f340b... (whippet job 4383) new; pins the corrected hash RIHS01_3cd17157... (whippet job 4384), computed over the complete dependency set

Existing action-hash coverage (action_hash_check.rs's Fibonacci test) could not have caught this — Fibonacci's Result (int32[] sequence) has no nested custom message type.

Verified standalone: cargo test -p hiroz-codegen --lib --tests — all green (whippet 4385). cargo clippy -p hiroz-codegen --all-targets -- -D warnings — clean.

Breaking changes

None to the public API. The RIHS01 hash for any action whose Goal/Result/Feedback references a nested custom message type changes — this is the fix, not a regression: the old hash was computed over an incomplete dependency set and would not interoperate with a real rmw_zenoh_cpp peer using the same action definition.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Formatting must be corrected, untested Goal and Feedback branches covered, and the unrelated #158 reference disambiguated.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Fixes RIHS01 action hashing by including transitive message dependencies.

Changes:

  • Collects nested dependencies for Goal, Result, and Feedback hashes.
  • Adds a real-world GetResult hash regression test.
File summaries
File Description
crates/hiroz-codegen/src/resolver.rs Recursively collects action component dependencies.
crates/hiroz-codegen/tests/action_nested_deps.rs Pins the corrected LookupTransform result hash.
Review details

Suppressed comments (1)

crates/hiroz-codegen/src/resolver.rs:688

  • This Feedback path is not exercised with nested dependencies: the new test uses LookupTransform, whose feedback section is empty, and asserts only the Result service hash. Please add a nested-feedback case (the bundled test_msgs/NestedMessage.action fixture covers this shape) and pin feedback_message_hash so this independent branch cannot regress.
        self.collect_nested_deps(&feedback_desc, &mut deps);
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread crates/hiroz-codegen/src/resolver.rs
Comment thread crates/hiroz-codegen/src/resolver.rs Outdated
Comment thread crates/hiroz-codegen/tests/action_nested_deps.rs Outdated
Uses tf2_msgs/LookupTransform, a real fixture already packaged under
assets/jazzy, to exercise both hash paths the previous commit fixes:
Result (TransformStamped + TF2Error, multi-level nesting) and Goal
(builtin_interfaces/Duration, never manually inserted the way Time is).
Pinned to the corrected hashes, measured on whippet.

Also drops a stray whitespace-only line the previous commit left in
resolver.rs (Copilot review on GH#339).
@YuanYuYuan
YuanYuYuan force-pushed the fix/action-hash-nested-deps branch from c1ee76a to da20fba Compare September 2, 2026 07:19
@CLAassistant

CLAassistant commented Sep 2, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@YuanYuYuan

YuanYuYuan commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator Author

Hi @sathak93! This PR preserves your original commit (cherry-picked with your authorship intact) on top of a regression test, so the CLA check now needs a signature from both of us. Could you sign the CLA via the link below when you get a chance?

https://cla-assistant.io/ZettaScaleLabs/hiroz?pullRequest=339

@YuanYuYuan
YuanYuYuan merged commit 844e159 into main Sep 2, 2026
34 checks passed
@YuanYuYuan
YuanYuYuan deleted the fix/action-hash-nested-deps branch September 2, 2026 18:05
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.

4 participants