Skip to content

Fix topic data request causing 400 error#76

Merged
bburda merged 1 commit into
selfpatch:mainfrom
heapghost96:fix/data-tab-400-bad-request
May 15, 2026
Merged

Fix topic data request causing 400 error#76
bburda merged 1 commit into
selfpatch:mainfrom
heapghost96:fix/data-tab-400-bad-request

Conversation

@heapghost96
Copy link
Copy Markdown
Contributor

Pull Request

Summary

Fix incorrect entity type resolution while fetching topic data in the Data tab.

Previously, entity types were inferred using path depth assumptions from parseTreePath(). In runtime-only (function/app) hierarchy mode, this could incorrectly resolve app resources as components, generating invalid API routes such as:

/components/{id}/data/{topic}

instead of:

/apps/{id}/data/{topic}

This caused 400 Bad Request responses from the gateway and prevented published ROS 2 topic messages from being displayed in the UI.

This PR introduces parent entity type resolution using the actual loaded tree hierarchy before dispatching API requests. The correct SOVD resource type is now used consistently for topic data and entity detail fetches while preserving existing fallback behavior.


Issue

Link the related issue (required):


Type

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

Testing

Tested locally using the provided VSCode devcontainer environment with:

  • ROS 2 Jazzy
  • Ubuntu
  • Google Chrome

Verification steps:

  1. Launch ros2_medkit_gateway
  2. Publish data on ROS 2 topics
  3. Open ros2_medkit_web_ui
  4. Navigate to the Data tab
  5. Select actively publishing topics

Verified that:

  1. Topic data is displayed correctly
  2. No 400 Bad Request errors occur
  3. API requests now resolve to the correct resource hierarchy
  4. Existing fallback behavior continues to work correctly

Additionally verified with:

  1. npm run lint
  2. npm run build
  3. npm run dev

Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Linting passes (npm run lint)
  • Build succeeds (npm run build)
  • Docs were updated if behavior or public API changed

Correct the request handling for topic data fetching in the
Data tab to ensure published ROS 2 topic messages are displayed
properly on ROS 2 Humble.

This resolves the 400 Bad Request error observed in the browser.
Copy link
Copy Markdown
Contributor

@bburda bburda left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution, and welcome - great first PR! 🎉

The root-cause analysis is spot on: depth-based entity-type inference breaks in runtime_only (function/app) mode, and resolving the parent node's real type from the loaded tree is the right fix. CI is green and the change is well-scoped.

Approving and merging. A few small polish items (a regression test plus minor comment/typo cleanups) are tracked in #77 and we'll handle them in a quick follow-up - nothing needed from you.

@bburda bburda merged commit 8101b3c into selfpatch:main May 15, 2026
3 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.

Web UI data tab does not display published topic data and shows 400 Bad Request

2 participants