Skip to content

fault_manager: max_age_sec per rosbag retention rule and the age sweep - #860

Draft
bburda wants to merge 1 commit into
feat/rosbag-retention-4afrom
feat/rosbag-retention-4b
Draft

bburda wants to merge 1 commit into
feat/rosbag-retention-4afrom
feat/rosbag-retention-4b

Conversation

@bburda

@bburda bburda commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Today a recording stays until the quota or a clear removes it, however old it is. Issue 705 asks for an age limit per status. This PR adds the rule field max_age_sec with the keys active, healed and cleared, and a periodic sweep that applies it.

This PR is on top of eight 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:

  • max_age_sec.active|healed|cleared (seconds, default 0 = no limit). A fault's recordings go when the fault is in that status and its last FAILED report is older than the limit. active means PREFAILED, PREPASSED or CONFIRMED. Each key resolves on its own across the four rule levels, so an explicit 0 at a more specific level keeps that key off.
  • sweep_interval_sec (1-86400, default 60). The sweep runs on the retention worker only while some level sets a limit above 0; otherwise there is no timer. The startup policy line says sweep: off or sweep: every <n> s.
  • Per link. The age removes the link of the fault concerned. A recording shared by a burst loses only that link, and the directory goes with its last link.
  • Clock. The age uses the system clock. The docs say to start the fault manager after time synchronisation on a robot without a battery-backed clock. A last FAILED time in the future never deletes.
  • Docs: docs/config/fault-manager.rst, docs/tutorials/snapshots.rst, the example retention file, the fault manager README and design doc.

What changes for users

  • Without retention parameters nothing changes.
  • New rule field max_age_sec and top-level sweep_interval_sec. An invalid value is reported as ROSBAG_RETENTION_CONFIG_INVALID.
  • The age counts from the last FAILED report. A heal or a clear stores no new time, so a fault cleared long after its last FAILED report can lose its recordings at the first pass after the clear.
  • A FAILED report that arrives while a pass runs can lose the recording it would have kept. The next confirmation records again. This is documented.
  • New log lines. Recording removed: <recording_id> (max_age_sec.<status>) per removed recording, and retention sweep: removed=<links> at DEBUG per pass.

Issue


Type

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

Testing

  • colcon build --packages-up-to ros2_medkit_fault_manager --cmake-args -DPOSTGRES_SUPPORT=ON, then colcon test --packages-select ros2_medkit_fault_manager (with ROS2_MEDKIT_TEST_PG_CONN for the PostgreSQL cases) and colcon test-result --verbose.

  • The real-process test is src/ros2_medkit_fault_manager/test/integration/test_rosbag_max_age.test.py. It covers:

    • each status key, counted from the last FAILED report;
    • a new FAILED report restarting the age;
    • an explicit 0 at a more specific level;
    • a shared recording losing one link;
    • a last FAILED time in the future;
    • the sweep running only while a limit is set;
    • invalid values, and no age deletion while the configuration is invalid.

    test_rosbag_quota_pg.test.py has the PostgreSQL case.

  • 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-4b branch from ac25c6c to 26017d1 Compare December 1, 2026 15:43
@bburda
bburda force-pushed the feat/rosbag-retention-4b branch from 26017d1 to 7a1b385 Compare December 2, 2026 12:15
* feat(fault_manager): max_age_sec per rosbag retention rule and the age sweep
* fix(fault_manager): the age sweep logs the time it decided with
@bburda
bburda force-pushed the feat/rosbag-retention-4b branch from 7a1b385 to 54193a6 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