resolute: complete ament_index_cpp::get_package_share_path migration#3705
Merged
Conversation
6 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3705 +/- ##
==========================================
+ Coverage 46.23% 46.28% +0.06%
==========================================
Files 726 726
Lines 59512 59506 -6
Branches 7622 7624 +2
==========================================
+ Hits 27509 27538 +29
+ Misses 31836 31801 -35
Partials 167 167 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Timple
reviewed
Mar 15, 2026
8189640 to
a521b04
Compare
562ec8b to
0c83916
Compare
nbbrooks
added a commit
to nbbrooks/moveit2
that referenced
this pull request
Jul 9, 2026
…macro The §1.1 draft advised guarding C++ divergence on RCLCPP_VERSION_GTE as a general distro proxy. That's fragile: every ROS 2 package has its own version macro and its own release cadence, so RCLCPP_VERSION only proxies for another package's feature when their versions happen to move in lockstep. Concrete failure moveit#3703 → moveit#3705: `ament_index_cpp` renamed `get_package_share_directory.hpp` → `get_package_share_path.hpp` in 1.14. Rolling's `rclcpp` had already been at ≥ 30 for months before that, so a `RCLCPP_VERSION_GTE(30, 0, 0)` guard triggered on Rolling-on-Noble containers that still shipped ament_index_cpp 1.13.1 — referencing a header that didn't exist yet. The guard was doing nothing useful in the Noble era, then quietly discriminating wrong across the Noble→Resolute transition. Changes: - §1.1 rewritten to advise guarding on the actual feature-carrier package's version macro (`AMENT_INDEX_CPP_VERSION_GTE`, `TF2_VERSION_GTE`, `RCLCPP_VERSION_GTE` for genuine rclcpp changes). Adds a "picking the threshold" checklist, a version snapshot for the frozen `rolling-ci` container vs. current Rolling, and moveit#3703→moveit#3705 as the canonical example. - §1.5 adds a reviewer checklist item: verify the threshold matches the upstream release, and verify the guard uses the correct package's macro. - New Topic 3 section "Auditing existing version guards when Rolling changes base OS" — a concrete grep-and-audit procedure for the CI-matrix PR that adopts each new Rolling base. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…lling ament_index_cpp evolved its API in two steps, and the RCLCPP_VERSION_GTE(30, 0, 0) guards added in moveit#3703 hit the wrong branch on Rolling-on-Noble (where the header still exists but the 1-arg form is now deprecated) and outright fail to compile on Rolling-on-Resolute (where the header no longer exists at all). Guard on ament_index_cpp's own version macro — three tiers: 1.14+ (Rolling on Resolute) <ament_index_cpp/get_package_share_path.hpp> replaced the old header, exposing get_package_share_path(pkg) which returns std::filesystem::path directly. 1.5+ (Jazzy 1.8.4, Kilted 1.11.4, Lyrical 1.13.3, Rolling-on-Noble 1.13.1) Old header still present; use the 2-arg out-param overload get_package_share_directory(pkg, path) which is non-deprecated (matters for the -Werror=deprecated-declarations job on Rolling-on-Noble where the 1-arg form is deprecated). older (Humble 1.4.1) Only the 1-arg get_package_share_directory(pkg) returning std::string is available; wrap in std::filesystem::path(). Guarding on ament_index_cpp's own version (rather than rclcpp's) is important because the two packages release independently — the API change lives in ament_index_cpp, and using RCLCPP_VERSION as a proxy misfires when Rolling's rclcpp advances without a corresponding ament_index_cpp bump (as happened in moveit#3703 → this fix). Drops the now-unused `#include <rclcpp/version.h>` in each file (added by moveit#3703 for the guard we replaced). Verified with a full source-build of moveit2 + downstream against `ubuntu:resolute` + ROS Rolling (`ros2-testing` apt). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
0c83916 to
7c2646e
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Completes the
ament_index_cpp::get_package_share_directory→get_package_share_pathmigration that #3703 started for Rolling. The current source has#if RCLCPP_VERSION_GTE(30, 0, 0)guards that hit the wrong branch on Rolling-on-Noble (deprecated call path) and outright fail to compile on Rolling-on-Resolute (missing header). Fixes both with a three-tier guard keyed onAMENT_INDEX_CPP_VERSION_GTE— the correct carrier package's version macro.Background: what ament_index_cpp did
ament_index_cpp'sget_package_share_directoryAPI evolved in two steps:<ament_index_cpp/get_package_share_path.hpp>get_package_share_path(pkg)returnsstd::filesystem::pathdirectly. Old header removed.<ament_index_cpp/get_package_share_directory.hpp>std::string get_package_share_directory(pkg)(deprecated in 1.13+) andvoid get_package_share_directory(pkg, std::filesystem::path& out)(non-deprecated).<ament_index_cpp/get_package_share_directory.hpp>std::string get_package_share_directory(pkg). Not deprecated.Version snapshot for the distros moveit2 currently supports (from
apt-cache policyagainst packages.ros.org):moveit/moveit2:rolling-ci)What went wrong in #3703
#3703 added conditional branches like:
Two problems:
RCLCPP_VERSION_GTE(30, 0, 0)guards onrclcpp's version, but the API change lives inament_index_cpp. When Update deprecated usage of get_package_share without std::filesystem::path #3703 was written the two packages' versions happened to correlate; they've since drifted apart (see the version snapshot above).#ifbranch's 2-arg call is real on 1.13.x but no longer exists on 1.14+. On the current Rolling-on-Resolute container,<ament_index_cpp/get_package_share_directory.hpp>doesn't exist at all — the header include itself fails.Concretely, the current code fails on rolling-resolute with:
(from an earlier iteration of this PR that guarded on a too-permissive threshold; the current version pins the header choice on 1.14+ so this specific error is gone.)
What this PR does
Three-tier guard, keyed on
AMENT_INDEX_CPP_VERSION_GTE:Why three tiers, not two:
get_package_share_pathAPI. Required to compile on Rolling-on-Resolute where the old header is gone.moveit/moveit2:rolling-cicontainer, ament_index_cpp 1.13.1) treats the 1-arg form as deprecated, and therolling-ci + deprecation checkjob runs with-Werror=deprecated-declarations. Using the 2-arg form keeps that job green.Why guard on
AMENT_INDEX_CPP_VERSION_GTEinstead ofRCLCPP_VERSION_GTE: the API rename lives inament_index_cpp. Its release cadence is independent ofrclcpp's. Using another package's version macro as a proxy silently misfires when the two packages' versions drift — exactly what happened in #3703 → this fix. Companion policy update in #3751 makes "guard on the feature-carrier package's version macro" the documented rule going forward.Also drops the now-unused
#include <rclcpp/version.h>in each file (added by #3703 for the guard we replaced).Test plan
ubuntu:resolute+ ROS Rolling (ros2-testingapt) — all three files' downstream packages build cleanly; the rolling-resolute build path exercises the 1.14+ branch.rolling-ci + ccov(Rolling on Noble, ament_index_cpp 1.13.1, no-Werroron deprecations) — exercises the 1.5–1.13.x branch.rolling-ci + deprecation check(same container,-Werror=deprecated-declarations) — exercises the 1.5–1.13.x branch, confirms the 2-arg form doesn't trigger deprecation.humble-ci,jazzy-ci— exercise the sub-1.5 and 1.5+ branches respectively.