-
Notifications
You must be signed in to change notification settings - Fork 31
fix: collect nested deps for action Goal/Result/Feedback hashing #339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| //! Action Goal/Result/Feedback type hashing must include nested message | ||
| //! dependencies, the same way plain service hashing already does. | ||
| //! | ||
| //! `tf2_msgs/LookupTransform` exercises both affected paths with one real, | ||
| //! already-packaged fixture -- no synthetic types needed: | ||
| //! - Result (`geometry_msgs/TransformStamped transform`, `tf2_msgs/TF2Error | ||
| //! error`): `TransformStamped` nests `std_msgs/Header` and | ||
| //! `geometry_msgs/Transform`, and `Transform` itself nests | ||
| //! `Vector3`/`Quaternion` -- multi-level nesting `calculate_get_result_hash` | ||
| //! silently dropped from its dependency set. | ||
| //! - Goal (`builtin_interfaces/Duration timeout`, among primitives): | ||
| //! `Duration` is a nested dependency `calculate_send_goal_hash` never | ||
| //! inserted manually (unlike `builtin_interfaces/Time`, which every | ||
| //! action hash function adds by hand for the goal_id UUID) -- it was only | ||
| //! ever reachable via `collect_nested_deps`. | ||
| //! | ||
| //! Both were fixed by wiring `collect_nested_deps` into `resolver.rs` | ||
| //! (fj#158, GitHub#334). | ||
|
|
||
| use std::path::PathBuf; | ||
|
|
||
| fn assets_dir() -> PathBuf { | ||
| PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("assets/jazzy") | ||
| } | ||
|
|
||
| #[test] | ||
| fn test_lookup_transform_hashes_include_nested_deps() { | ||
| use hiroz_codegen::{ | ||
| discovery::{discover_actions, discover_messages}, | ||
| resolver::Resolver, | ||
| }; | ||
|
|
||
| let assets = assets_dir(); | ||
| let packages = [ | ||
| "builtin_interfaces", | ||
| "unique_identifier_msgs", | ||
| "action_msgs", | ||
| "service_msgs", | ||
| "std_msgs", | ||
| "geometry_msgs", | ||
| "tf2_msgs", | ||
| ]; | ||
| let mut all_messages = Vec::new(); | ||
| for pkg in &packages { | ||
| let pkg_path = assets.join(pkg); | ||
| let msgs = discover_messages(&pkg_path, pkg).unwrap_or_default(); | ||
| all_messages.extend(msgs); | ||
| } | ||
|
|
||
| let mut resolver = Resolver::new(false); | ||
| resolver | ||
| .resolve_messages(all_messages) | ||
| .expect("resolve messages"); | ||
|
|
||
| let pkg_path = assets.join("tf2_msgs"); | ||
| let actions = discover_actions(&pkg_path, "tf2_msgs").expect("discover actions"); | ||
| let resolved = resolver.resolve_actions(actions).expect("resolve actions"); | ||
| let lookup_transform = resolved | ||
| .iter() | ||
| .find(|a| a.parsed.name == "LookupTransform") | ||
| .expect("LookupTransform action"); | ||
|
|
||
| // Pinned after fixing calculate_get_result_hash to call | ||
| // collect_nested_deps on the Result type, matching the plain-service | ||
| // path (resolver.rs:181-182). Before that fix this hash is computed | ||
| // over an incomplete dependency set (missing TransformStamped's own | ||
| // nested Header/Transform/Vector3/Quaternion types) and differs from | ||
| // this value -- this test must fail on unfixed code. | ||
| assert_eq!( | ||
| lookup_transform.get_result_hash.to_rihs_string(), | ||
| "RIHS01_3cd1715751899e3167b5aec3e4ac194f7da9e8493a77285f9f6a4c914f5e8b24", | ||
| "get_result hash mismatch -- nested dependency collection regressed" | ||
| ); | ||
|
|
||
| // Same defect, the Goal side: calculate_send_goal_hash never inserted | ||
| // builtin_interfaces/Duration -- the Goal's `timeout` field -- so it | ||
| // was only ever reachable via collect_nested_deps too. | ||
| assert_eq!( | ||
| lookup_transform.send_goal_hash.to_rihs_string(), | ||
| "RIHS01_4646ff5706c86b04d0a1098d329951a9731a7517e16702905de6073cc72c8530", | ||
| "send_goal hash mismatch -- nested dependency collection regressed" | ||
| ); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.