-
Notifications
You must be signed in to change notification settings - Fork 16
Description
Summary
The gateway provides GET /api/v1/faults as a convenience endpoint to list all faults across the system (regardless of entity ownership). However, there is no corresponding DELETE /api/v1/faults to clear all faults globally.
Per-entity DELETE /api/v1/{entity-path}/faults only clears faults owned by that entity. Faults reported via ROS 2 service with arbitrary source_id values aren't owned by any manifest entity, so per-entity DELETE can't clear them.
Note: This is a ros2_medkit extension, not part of the SOVD standard. SOVD is entity-centric - fault operations are scoped to entities. Our GET /api/v1/faults is already an extension; this adds the matching write operation.
Proposed solution
DELETE /api/v1/faults
Clear all faults in the system, regardless of entity ownership.
Response 204 No Content on success.
Optional query parameter:
| Parameter | Type | Required | Description |
|---|---|---|---|
status |
string |
No | Filter which faults to clear: confirmed, prefailed, all (default: confirmed) |
Example:
# Clear all confirmed faults
curl -X DELETE "http://localhost:8080/api/v1/faults"
# Clear everything (including prefailed)
curl -X DELETE "http://localhost:8080/api/v1/faults?status=all"Implementation
The fault manager already has a ClearFault service per fault code. The global DELETE handler should:
- Call
GET /api/v1/faults(internal) to get all fault codes - Call
ClearFaultfor each fault code - Return 204 when all clears complete
Alternatively, add a ClearAllFaults ROS 2 service to fault_manager_node for atomic bulk clear.
Route registration
// Extension: global fault management (not SOVD - convenience API)
srv->Delete(api_path("/faults"), handler);Documentation
Mark clearly as extension in docs/api/rest.rst:
.. note::
``DELETE /api/v1/faults`` is a ros2_medkit extension, not part of the
SOVD standard. SOVD fault operations are entity-scoped.
Additional context
Current workaround: Restart fault_manager_node with storage_type:=memory (memory is wiped on restart).
Files to modify
src/ros2_medkit_gateway/src/http/rest_server.cpp- Register DELETE routesrc/ros2_medkit_gateway/src/http/handlers/fault_handlers.cpp- Implement handlersrc/ros2_medkit_fault_manager/src/fault_manager_node.cpp- Optional: addClearAllFaultsservicesrc/ros2_medkit_msgs/srv/- Optional:ClearAllFaults.srvdocs/api/rest.rst- Document endpoint with extension note- Unit tests + integration test
Acceptance criteria
-
DELETE /api/v1/faultsclears all faults regardless of entity ownership - Optional
statusquery parameter filters which faults to clear - Response is
204 No Content - Documented as ros2_medkit extension (not SOVD)
- Unit test: clear all confirmed faults
- Unit test: clear with
status=allincludes prefailed - Integration test: inject faults via service - DELETE - verify empty