Repository navigation
Conversation
bburda
force-pushed
the
feat/rosbag-retention-3
branch
from
December 1, 2026 15:43
8931f64 to
5bc6412
Compare
mfaferek93
reviewed
Dec 2, 2026
| : ResolvedRule{}; | ||
| facts.priority = rule.priority; | ||
| facts.over_quota = rule.over_quota; | ||
| facts.cap = rule.max_bags.value_or(limits_.max_bags_per_fault); |
Collaborator
There was a problem hiding this comment.
SqliteFaultStorage::get_fault() returns nullopt for any step() failure, not only SQLITE_DONE, so a failed read lands here as an absent fault and resolves the rule with severity 0. With a severity rule like ERROR: max_bags: 4 and a global max_bags_per_fault: 1, that store trims the fault down to one recording, while the docs and the PR say an unreadable fault keeps all its recordings in that store. The new integration test notes this ("fails in sqlite3_step and reads as absent") and steps around it. Making get_fault() throw on anything other than SQLITE_ROW/SQLITE_DONE would route this case into the existing read-failure path.
bburda
force-pushed
the
feat/rosbag-retention-3
branch
from
December 2, 2026 12:15
5bc6412 to
4e3ee71
Compare
* feat(fault_manager): max_bags and keep_first per rosbag retention rule * fix(fault_manager): one warning per unreadable fault * fix(fault_manager): one line for an unreadable fault over the quota; cooldown warning counts rule caps
bburda
force-pushed
the
feat/rosbag-retention-3
branch
from
December 2, 2026 18:24
4e3ee71 to
97fc473
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
max_bags_per_faultis one cap for every fault code, and it keeps the newest recordings, so the first occurrence of a fault (often the one with the root cause) is lost. Issue 705 asks for the cap per fault code, pattern or severity, and for a way to keep the first recording. This PR adds the rule fieldsmax_bagsandkeep_first.This PR is on top of six 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_bags(integer>= 0) at every rule level. It replacesmax_bags_per_faultfor the faults the rule covers.0means no cap.keep_first(true/false). With an effective cap of 2 or more, the oldest stored recording of the fault code is kept, plus themax_bags - 1newest. With a cap of 0 or 1 it is ignored, and each store logs a warning naming the fault code.auto_cleanup, a clear deletes a fault's recordings when that fault'smax_bagsis 1, as before, but now from its rule. So a rulemax_bags: 3keeps the history on clear, even with a globalmax_bags_per_fault: 1.keep_firstis evicted after the others.snapshots.recapture_cooldown_secworking against the cap also checks the rules'max_bags.docs/config/fault-manager.rst,docs/tutorials/snapshots.rst,config/snapshots.yaml, the example retention file, the fault manager README and design doc.What changes for users
max_bagsandkeep_first. An invalid value is reported asROSBAG_RETENTION_CONFIG_INVALID, and the fault manager runs with the global cap.(its max_bags)instead of(max_bags_per_fault).Issue
Type
Testing
colcon build --packages-up-to ros2_medkit_fault_manager --cmake-args -DPOSTGRES_SUPPORT=ON, thencolcon test --packages-select ros2_medkit_fault_manager(withROS2_MEDKIT_TEST_PG_CONNfor the PostgreSQL cases) andcolcon test-result --verbose.The real-process test is
src/ros2_medkit_fault_manager/test/integration/test_rosbag_max_bags.test.py. It covers:test_rosbag_quota_pg.test.pyhas the PostgreSQL case.The rosbag test helper now waits until the fault manager has taken each published message before it reports the fault. Before, a report could be served between two queued messages and the recording missed one of them.
I ran this on Jazzy with PostgreSQL 14. Humble and Lyrical run in CI. clang-tidy on the changed files reports nothing new.
Checklist