Skip to content

Conversation

@mfaferek93
Copy link
Collaborator

Pull Request

Summary

prevent duplicate components for root namespace nodes

Nodes in root namespace (e.g., /fault_manager) publishing topics with
matching prefix (e.g., /fault_manager/events) were incorrectly creating
both a node-based app and a duplicate topic-based component.

Add node names to namespace set in get_node_namespaces() for root
namespace nodes, so discover_topic_components() skips creating
redundant topic-based components.


Issue

Link the related issue (required):


Type

  • Bug fix
  • New feature or tests
  • Breaking change
  • Documentation only

Testing

How was this tested / how should reviewers verify it?


Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

@mfaferek93 mfaferek93 marked this pull request as ready for review January 27, 2026 16:07
Copilot AI review requested due to automatic review settings January 27, 2026 16:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes a bug where root namespace nodes publishing topics with matching prefixes incorrectly created duplicate topic-based components during discovery. The fix prevents nodes like /fault_manager from appearing both as a node-based app and as a duplicate topic-based component when publishing topics like /fault_manager/events.

Changes:

  • Modified get_node_namespaces() to include root namespace node names in the namespace set, preventing topic-based discovery from creating duplicate components
  • Added unit test to verify root namespace nodes don't create duplicate topic-based components
  • Added integration test with a demo node to validate the fix in a real-world scenario

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/ros2_medkit_gateway/src/discovery/runtime_discovery.cpp Core fix: adds root namespace node names to the namespace set to prevent duplicate component creation
src/ros2_medkit_gateway/test/test_discovery_manager.cpp Unit test verifying the fix by creating a publisher matching the node name and checking no duplicate is created
src/ros2_medkit_gateway/test/test_discovery_heuristic_apps.test.py Integration test adding a root namespace demo node and verifying no duplicates exist in the API responses

@mfaferek93 mfaferek93 force-pushed the 146/fix/preventDuplicateComponent/discovery branch from a2cffa6 to 170fb65 Compare January 27, 2026 16:37
@mfaferek93 mfaferek93 requested a review from bburda January 27, 2026 16:49
@mfaferek93 mfaferek93 force-pushed the 146/fix/preventDuplicateComponent/discovery branch from 170fb65 to 0439360 Compare January 27, 2026 17:09
@mfaferek93 mfaferek93 requested a review from bburda January 27, 2026 17:16
bburda
bburda previously approved these changes Jan 27, 2026
…nodes

  Nodes in root namespace (e.g., /fault_manager) publishing topics with
  matching prefix (e.g., /fault_manager/events) were incorrectly creating
  both a node-based app and a duplicate topic-based component.

  Add node names to namespace set in get_node_namespaces() for root
  namespace nodes, so discover_topic_components() skips creating
  redundant topic-based components.
@mfaferek93 mfaferek93 force-pushed the 146/fix/preventDuplicateComponent/discovery branch from 0439360 to 2c30d9b Compare January 27, 2026 18:10
@mfaferek93 mfaferek93 requested a review from bburda January 27, 2026 18:14
@mfaferek93 mfaferek93 merged commit 56d4928 into main Jan 27, 2026
4 checks passed
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.

[BUG] Duplicate component created for root namespace nodes due to topic-based discovery collision

3 participants