Skip to content

Delete one rosbag recording through the bulk-data API - #865

Draft
bburda wants to merge 1 commit into
feat/rosbag-retention-6from
feat/rosbag-retention-7
Draft

bburda wants to merge 1 commit into
feat/rosbag-retention-6from
feat/rosbag-retention-7

Conversation

@bburda

@bburda bburda commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Today DELETE .../bulk-data/rosbags/{id} answers 400: recordings are managed only by the fault manager. A client that downloads its copies through the Bulk Data API then has no way to free the robot's disk once it has them. This PR lets it delete a recording whose faults are no longer active.

This PR is on top of thirteen PRs in the stack. Please review those first. The diff of this PR is against the branch of the PR directly below it.

What it adds:

  • DELETE /api/v1/{apps|components}/{id}/bulk-data/rosbags/{recording_id}:
    • It deletes the whole recording: every file of it (a split recording goes whole), its directory, and every link from a fault to it.
    • 204 when every linked fault is CLEARED or HEALED. The rows are gone at once; the directory is queued to the retention worker, as for every other removal.
    • 409 when a linked fault is PREFAILED, PREPASSED or CONFIRMED. The error names the fault codes in parameters.fault_codes, and nothing is deleted.
    • 404 when the id is not a recording or is outside the entity's scope (the same rule as the download).
    • 503 when the fault manager or its store cannot answer, or the commit is in doubt (the directory stays).
    • The route keeps its OPERATOR role and its entity lock check.
  • The list. GET .../bulk-data/rosbags adds x-medkit.deletable, true when every linked fault is CLEARED or HEALED.
  • Audit. With the audit log on, a delete appends one rosbag_deleted event per linked fault, in one transaction, also when only confirmations are logged. With audit_log.fail_closed: true, a failed append stops the delete.
  • Fault manager:
    • a ~/delete_rosbag service (ros2_medkit_msgs/srv/DeleteRosbag.srv);
    • deletable on ListRosbags.srv;
    • a (DELETE) removal log line.
  • Docs: docs/api/rest.rst, docs/requirements/specs/bulkdata.rst, docs/config/fault-manager.rst, the gateway and fault manager READMEs and design docs.

What changes for users

  • A rosbags DELETE no longer answers 400. Clients that relied on that answer now get 204, 404, 409 or 503.
  • While the storage path is unavailable, a recording the fault manager could not find is neither listed nor downloadable, and its DELETE answers 404. Nothing is deleted.
  • A 503 after a gateway timeout leaves the outcome unknown. List the recordings again before retrying.
  • A plugin that implements FaultServiceTransport keeps building: the new delete_rosbag has a default that answers unavailable (503).

Issue


Type

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

Testing

  • colcon build --packages-up-to ros2_medkit_fault_manager ros2_medkit_gateway ros2_medkit_integration_tests --cmake-args -DPOSTGRES_SUPPORT=ON, then colcon test for ros2_medkit_msgs, the fault manager, the gateway and the integration tests, and colcon test-result --verbose.
  • src/ros2_medkit_integration_tests/test/features/test_rosbag_delete.test.py runs a real gateway and real fault manager. It covers:
    • cleared and healed recordings;
    • active faults (CONFIRMED, PREFAILED, PREPASSED);
    • shared recordings and split recordings;
    • an unknown id, a second DELETE, an entity outside the scope, and the fault manager's App;
    • a lock held by another client, and the fault manager down;
    • deletable and the audit events.
  • test_rosbag_delete_storage_unavailable.test.py covers an unavailable storage, and test_locking_disabled_contract.test.py checks that the 409 stays in the OpenAPI with locking off.
  • In the fault manager package:
    • PostgreSQL cases: a delete on PostgreSQL, a commit cut that keeps the directory, and an unreachable server;
    • an unavailable storage;
    • a status the fault manager does not write.
  • Two in-process gateway tests cover what a real process cannot: the in-scope fault codes sent with the request, and the default of a transport that does not implement the delete.
  • test_scenario_bulk_data_upload.test.py test_13 now expects 404 for an unknown id.
  • I ran this on Jazzy with PostgreSQL 14. Humble and Lyrical run in CI. clang-tidy on the changed files reports nothing new.

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

@bburda
bburda added this pull request to stack #836 December 1, 2026 13:21
@bburda
bburda force-pushed the feat/rosbag-retention-7 branch from 67b4a3d to 1bb8737 Compare December 1, 2026 15:43
@bburda
bburda force-pushed the feat/rosbag-retention-7 branch from 1bb8737 to 5f4526a Compare December 2, 2026 12:15
* feat: delete one rosbag recording through the bulk-data API
* fix: exact delete status rule, 409 without locking, protected-recording docs
* docs: recording-not-found code on unavailable storage, deletable field
* test: protected-recording delete 404 carries x-medkit-recording-not-found
@bburda
bburda force-pushed the feat/rosbag-retention-7 branch from 5f4526a to 32c25b4 Compare December 2, 2026 18:24

This branch has not been deployed

No deployments
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