Repository navigation
feat(cli): add --max-total-size flag to audit cleanup - #1819
Merged
SequeI merged 1 commit intoSep 9, 2026
Merged
Conversation
Contributor
PR Review SummarySize
Affected crates
Blast radius — ContainedThis PR touches: source code Updated automatically on each push to this PR. |
christine-at-datadog
force-pushed
the
add-audit-cleanup-max-total-size
branch
from
September 8, 2026 01:21
0a40e85 to
b29d96e
Compare
christine-at-datadog
force-pushed
the
add-audit-cleanup-max-total-size
branch
from
September 8, 2026 01:47
b29d96e to
c125507
Compare
christine-at-datadog
force-pushed
the
add-audit-cleanup-max-total-size
branch
from
September 8, 2026 01:59
c125507 to
df8695b
Compare
Member
|
Hi! Thanks for the PR, let's also add documentation for this new flag so users are aware of the option, and let me know if the nogent comments have been addressed. Overall looks good though, thanks! |
nono audit cleanup only bounds sessions by --keep (count) or --older-than (age). A user with a handful of very large sessions, or a burst of same-week sessions from an unbounded retry loop, has no way to trim the audit tree by disk usage. Add --max-total-size <MB>, applied the same way as --keep: walk the already-sorted (newest-first) removable list, accumulate disk_size, and remove everything past the point the running total exceeds the budget. The budget accounts for sessions already excluded by --keep or --older-than, since those stay on disk too — otherwise the actual remaining total could exceed the configured cap. Patch-Name: reconcile-add-audit-cleanup-max-total-size Signed-off-by: Christine Le <christine.le@datadoghq.com> Signed-off-by: christine.le <christine.le@datadoghq.com>
christine-at-datadog
force-pushed
the
add-audit-cleanup-max-total-size
branch
from
September 8, 2026 18:04
df8695b to
649b4fd
Compare
This was referenced Sep 11, 2026
1 task
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.
Closes #1818
Summary
Adds a
--max-total-size <MB>flag tonono audit cleanup: sorts sessions oldest-first (the same discovery/sort path the command already uses) and removes sessions until the remaining total is under the given size, using the existing per-sessiondisk_sizealready computed for eachSessionInfo. Purely additive — behavior without the flag is unchanged.Deliberately does not compose with
--older-thanas an AND filter in the same invocation; a caller wanting size-bounded pruning of recent-but-large sessions should pass--max-total-sizealone, since combining it with--older-thanwould exclude the very sessions the size bound exists to catch. Noted in the flag's help text.Files changed
crates/nono-cli/src/cli.rs— newmax_total_size: Option<u64>field onAuditCleanupArgs, plus a unit test (test_audit_cleanup_max_total_size).crates/nono-cli/src/audit_commands.rs— size-based pruning pass incmd_cleanup, after the existing--keepfiltering; respects--dry-run.Testing
cargo test,cargo clippy -- -D warnings -D clippy::unwrap_used, andcargo fmt --checkall pass locally.Agent Compliance Check
This contribution was prepared with the assistance of an AI coding agent (Claude Code), reviewed and submitted by a human maintainer of the downstream project referenced in the linked issue.