Skip to content

Conversation

@mfaferek93
Copy link
Collaborator

@mfaferek93 mfaferek93 commented Dec 14, 2025

Pull Request

Summary

Gateway REST API Endpoints for fault management.
Adds FaultManager class that interfaces with ros2_medkit_fault_manager
services and exposes fault operations via REST API.

New REST endpoints:

  • GET /api/v1/components/{id}/faults - list faults (REQ_INTEROP_012)
  • GET /api/v1/components/{id}/faults/{code} - get fault (REQ_INTEROP_013)
  • DELETE /api/v1/components/{id}/faults/{code} - clear fault (REQ_INTEROP_015)

Changes:

  • Add FaultManager class with service clients for fault_manager
  • Integrate FaultManager into GatewayNode
  • Add fault endpoint handlers to RESTServer
  • Add 'faults' capability to root endpoint
  • Add integration tests (test_55-63) with fault_manager_node
  • Update Postman collection and README with Faults folder

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 self-assigned this Dec 14, 2025
Copilot AI review requested due to automatic review settings December 14, 2025 13:10
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 PR implements REST API endpoints for fault management in the ROS2 Medkit Gateway, enabling fault reporting, querying, and clearing operations through HTTP. The implementation bridges SOVD fault management APIs with a new ros2_medkit_fault_manager service backend.

  • Adds four REST endpoints for fault operations: list faults, get specific fault, report fault, and clear fault
  • Introduces a new FaultManager component in the gateway that communicates with the fault manager services
  • Creates a complete ros2_medkit_fault_manager package with in-memory fault storage and service interfaces

Reviewed changes

Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/ros2_medkit_gateway/src/rest_server.cpp Adds four fault endpoint handlers and registers routes for fault operations
src/ros2_medkit_gateway/src/gateway_node.cpp Instantiates FaultManager and provides accessor method
src/ros2_medkit_gateway/src/fault_manager.cpp Implements FaultManager client that interfaces with fault manager services
src/ros2_medkit_gateway/include/ros2_medkit_gateway/fault_manager.hpp Defines FaultManager interface with service client methods
src/ros2_medkit_gateway/test/test_integration.test.py Adds comprehensive integration tests for fault REST endpoints
src/ros2_medkit_fault_manager/src/fault_manager_node.cpp Implements ROS2 node providing fault management services
src/ros2_medkit_fault_manager/src/fault_storage.cpp Implements thread-safe in-memory fault storage with aggregation logic
src/ros2_medkit_fault_manager/test/test_integration.test.py Adds integration tests for fault manager services
src/ros2_medkit_fault_manager/test/test_fault_manager.cpp Adds unit tests for fault storage and manager node
postman/collections/ros2-medkit-gateway.postman_collection.json Adds Postman collection requests for fault endpoints

@mfaferek93 mfaferek93 force-pushed the 77/faultGatewayRESTApiEndpoints branch 5 times, most recently from 4e4fe7a to e60d4e9 Compare December 14, 2025 14:19
@mfaferek93 mfaferek93 force-pushed the 77/faultGatewayRESTApiEndpoints branch from e60d4e9 to 979bc22 Compare December 14, 2025 14:46
Gateway REST API Endpoints for fault management.
Adds FaultManager class that interfaces with ros2_medkit_fault_manager
services and exposes fault operations via REST API.

New REST endpoints:
- GET /api/v1/components/{id}/faults - list faults (REQ_INTEROP_012)
- GET /api/v1/components/{id}/faults/{code} - get fault (REQ_INTEROP_013)
- POST /api/v1/components/{id}/faults - report fault
- DELETE /api/v1/components/{id}/faults/{code} - clear fault (REQ_INTEROP_015)

Changes:
- Add FaultManager class with service clients for fault_manager
- Integrate FaultManager into GatewayNode
- Add fault endpoint handlers to RESTServer
- Add 'faults' capability to root endpoint
- Add integration tests (test_55-63) with fault_manager_node
- Update Postman collection and README with Faults folder
@mfaferek93 mfaferek93 force-pushed the 77/faultGatewayRESTApiEndpoints branch from 979bc22 to 64ee819 Compare December 14, 2025 15:06
@mfaferek93
Copy link
Collaborator Author

Screencast from 14.12.2025 17:13:04.webm
New demo node to test error reporting and cleaning flow

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

Copilot reviewed 13 out of 13 changed files in this pull request and generated 7 comments.

  - Add demo_lidar_sensor node that reports faults based on parameter validation:
    - LIDAR_RANGE_INVALID when min_range >= max_range
    - LIDAR_FREQ_UNSUPPORTED when scan_frequency > 20.0 Hz
    - LIDAR_CALIBRATION_REQUIRED when sensor not calibrated
  - Fix fault filtering to use prefix matching for namespace hierarchy
    (allows querying by namespace e.g. /perception/lidar matches
    /perception/lidar/lidar_sensor)
  - Add LIDAR Fault Workflow folder to Postman collection with 8-step
    example demonstrating complete fault management lifecycle
  - Update Postman README with fault_manager startup instructions
  - Fix prefix matching for fault source_id filtering to support namespace
    hierarchy (e.g., /perception/lidar matches /perception/lidar/lidar_sensor)
  - Add validation to reject non-positive scan_frequency in lidar_sensor demo
  - Extract get_component_namespace_path helper to reduce code duplication
  - Add docstring to fault_to_json method explaining timestamp conversion
  - Add comment to empty except clause in integration tests
  - Fix test section comment numbering (test_55-58)
  - Update Postman README with fault_manager startup instructions
@mfaferek93 mfaferek93 force-pushed the 77/faultGatewayRESTApiEndpoints branch from c5666e0 to d1b4086 Compare December 14, 2025 16:46
@mfaferek93 mfaferek93 requested a review from bburda December 14, 2025 16:47
@mfaferek93 mfaferek93 merged commit 9e180d4 into main Dec 14, 2025
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.

Add Gateway REST API Endpoints

3 participants