Skip to content

[jazzy] Fix QoS overrides ignored when topic name has no leading slash (backport #2394)#2413

Merged
MichaelOrlov merged 1 commit into
jazzyfrom
mergify/bp/jazzy/pr-2405
May 5, 2026
Merged

[jazzy] Fix QoS overrides ignored when topic name has no leading slash (backport #2394)#2413
MichaelOrlov merged 1 commit into
jazzyfrom
mergify/bp/jazzy/pr-2405

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify Bot commented Apr 23, 2026

Description

QoS override keys are compared against bag topic names using exact string matching. ROS 2 allows different levels of qualification for topic names my_topic and /my_topic are different strings but expand to the same fully-qualified name
/my_topic. This means a user writing talker: in their YAML override file gets no match against /talker stored in the bag, and the override is silently ignored with no warning or error.

Fix: normalize topic names to their fully-qualified form (prepend / if absent) on both sides of the QoS override map — at insertion time in the constructor/record() and at lookup time in publisher_qos_for_topic() / subscription_qos_for_topic().

Fixes #1240

Is this user-facing behavior change?

Yes. Previously only an exact string match worked. Now both forms are accepted:

# Before — only this worked if bag stores "/talker":
/talker:
  durability: transient_local

# After — both work:
talker:
  durability: transient_local

Likewise if the bag stores my_topic, then /my_topic in the YAML also works correctly now.

Did you use Generative AI?

Yes, Claude Sonnet 4.6

Additional Information

  • Fix applies to both ros2 bag play (player.cpp) and ros2 bag record (recorder.cpp)
  • If the name already starts with / or is empty it is returned unchanged — no double-slash risk
  • A new regression test topic_qos_profile_override_matches_unqualified_name is added to test_play.cpp to cover the case from the issue completion criteria
  • Before/after screenshots attached showing Durability: VOLATILE (broken) vs Durability: TRANSIENT_LOCAL (fixed) with the same unqualified talker: YAML key

Before

Screenshot from 2026-04-08 22-15-09 Screenshot from 2026-04-08 22-15-40

After

Screenshot from 2026-04-09 00-30-57


This is an automatic backport of pull request #2394 done by Mergify.
This is an automatic backport of pull request #2405 done by Mergify.

…sh (backport #2394) (#2405)

* Fix QoS overrides ignored when topic name has no leading slash (#2394)

* Fix QoS overrides ignored when topic name has no leading slash

Signed-off-by: root <lakhmanisahil8@gmail.com>

* Address review feedback

Signed-off-by: root <lakhmanisahil8@gmail.com>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>

* change timeout to 5s

Signed-off-by: root <lakhmanisahil8@gmail.com>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>

* Use expanded_topic_name for logging in subscription_qos_for_topic

Also fixed code alignment in a couple other places with topic names are
expanded.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

---------

Signed-off-by: root <lakhmanisahil8@gmail.com>
Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
(cherry picked from commit d2c4d6d)

# Conflicts:
#	rosbag2_transport/src/rosbag2_transport/recorder.cpp

* Address merge conflicts

Signed-off-by: Michael Orlov <morlovmr@gmail.com>

---------

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Co-authored-by: Sahil Lakhmani <126493645+lakhmanisahil@users.noreply.github.com>
Co-authored-by: Michael Orlov <morlovmr@gmail.com>
(cherry picked from commit ba5a75d)
@MichaelOrlov MichaelOrlov changed the title [kilted] Fix QoS overrides ignored when topic name has no leading slash (backport #2394) (backport #2405) [jazzy] Fix QoS overrides ignored when topic name has no leading slash (backport #2394) Apr 23, 2026
Copy link
Copy Markdown
Contributor

@MichaelOrlov MichaelOrlov left a comment

Choose a reason for hiding this comment

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

LGTM with green CI.

@MichaelOrlov
Copy link
Copy Markdown
Contributor

Pulls: #2413
Gist: https://gist.githubusercontent.com/MichaelOrlov/f0a94b855845e70a1ce2d7ead455a044/raw/3ba8859ee324c6b6e004807e7f123489e1c7670e/ros2.repos
BUILD args: --packages-above-and-dependencies rosbag2_transport
TEST args: --packages-above rosbag2_transport
ROS Distro: jazzy
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/19062

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@MichaelOrlov
Copy link
Copy Markdown
Contributor

Merging with yellow Windows CI, because:

  1. The failure is unrelated to the changes in this PR
  2. We decided on the latest ROS 2 PMC meeting that we are not supporting Windows CI builds on Jazzy anymore.

@MichaelOrlov MichaelOrlov merged commit 65d188a into jazzy May 5, 2026
12 checks passed
@MichaelOrlov MichaelOrlov deleted the mergify/bp/jazzy/pr-2405 branch May 5, 2026 16:55
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