Skip to content

Keep 45 daily validation logs and delete the rest - #43

Merged
myobie merged 2 commits into
mainfrom
fix/bounded-log-retention
Aug 4, 2026
Merged

Keep 45 daily validation logs and delete the rest#43
myobie merged 2 commits into
mainfrom
fix/bounded-log-retention

Conversation

@myobie

@myobie myobie commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Approved by cos. Fabric never deleted a validation log.

Measured, not assumed

On a live machine:

total logs 2.4 GB
daily files 20, back to 2026-07-16
largest single day 587 MB
recent rate 8.8 / 9.0 / 10.3 MB/day

tracing_appender::rolling::daily rotates and deletes nothing, and there is no retention, pruning, or max-age logic anywhere in the tree.

cos checked the urgency honestly and corrected me: that volume has 836 GiB free, so 2.4 GB is ~0.3% and nobody is close to being hurt. The work still stands — unbounded growth with nobody at the keyboard is a defect whatever today's number is, and disk is shared, so fabric exhausting it degrades the machine, not just fabric.

45 is derived, not rounded

Retention has to outlast a month away from the machine, or a fault in the first week is deleted before the only person who investigates it gets home. That is a floor near 31 days; two more weeks covers the gap between returning and looking. At the observed rate that is roughly 420 MB.

A test pins the number and asserts it exceeds a month-long trip, so moving it requires changing an assertion and saying why.

Failing open would be the worst outcome

An unparseable FABRIC_LOG_RETENTION_DAYS falls back to the bound, not to unbounded. On an unattended machine a typo would otherwise restore the defect silently and look like the fix never worked. An explicit 0 still disables deletion, for an operator who would rather spend disk than lose history.

The resolved value is recorded in diagnostic_logging_init, so the running config is checkable rather than assumed.

Filename format verified, not trusted

Swapping rolling::daily for the Builder could have changed the filename. I ran a daemon on a scratch home and confirmed it still writes validation.log.<date>. A changed name would have broken every existing grep, including ones this network already uses.

What this does not do

It bounds the file count, which is what stops indefinite growth. It does not bound bytes — one day reached 587 MB — and capping that is a question about log volume, not retention. Logs written before this bound are not reclaimed; that is an operator's call.

Documented plainly in the README and CHANGELOG, because silently removing a file someone might want is its own hazard.

Ordering note

This lands before enabling pathwatch on purpose. Pathwatch roughly doubles the daily log rate, so enabling it first would have shipped a disk problem while fixing an observability one.

Tests

201 lib tests green (4 new), plus lifecycle and provisioning. Changed files pass rustfmt.

myobie added 2 commits August 4, 2026 02:51
Three remote branches are neither merged into main nor known to be obsolete, so
git branch --merged will never retire them and the question comes back to
whoever next tidies the repository.

They belong to the af8fb02 line, whose four pull requests were absorbed by a
separate reconciliation rather than merged directly. main is BELIEVED to contain
their substance. Nobody has proven it, and this note says so plainly rather than
implying the matter is settled.

Deleting a remote branch that is not an ancestor of main is not reversible for
anyone else, and keeping one costs nothing, so the trade favours leaving them.
Proving equivalence is archaeology that needs judgement per branch, and nobody
needs these branches today.

The next person now meets a recorded fact instead of a puzzle, and knows what
would have to be true before deleting is safe.
The daemon wrote one validation log per day and never removed any of them, so
the directory grew for as long as the daemon ran. Measured on a live machine:
2.4 GB across 20 daily files going back to 2026-07-16, with a single noisy day
at 587 MB. I searched the tree for retention, pruning, or a maximum age and
there was none.

Unbounded growth with nobody at the keyboard is a defect whatever today's number
is. Disk is shared, so fabric exhausting it does not degrade fabric, it degrades
the machine.

FORTY-FIVE IS DERIVED, NOT ROUNDED. Retention has to outlast a month away from
the machine, or a fault in the first week is deleted before the only person who
investigates it gets home. That is a floor near 31 days. Two more weeks covers
the gap between returning and looking. At the observed 8.8 to 10.3 MB per day
that is roughly 420 MB. A test pins the number and asserts it exceeds a
month-long trip, so moving it requires saying why.

FAILING OPEN WOULD BE THE WORST OUTCOME, so an unparseable override falls back
to the bound rather than to unbounded. On an unattended machine a typo would
otherwise restore the defect silently and look like the fix never worked. An
explicit 0 still disables deletion, for an operator who would rather spend disk
than lose history. The resolved value is recorded in diagnostic_logging_init so
the running configuration is checkable rather than assumed.

THE FILENAME FORMAT IS UNCHANGED, and I verified that rather than trusting the
builder's documentation: I ran a daemon on a scratch home and confirmed it still
writes validation.log.<date>. A changed name would have broken every existing
grep, including the ones this network already uses.

WHAT THIS DOES NOT DO. It bounds the file COUNT, which is what stops indefinite
growth. It does not bound bytes, because one day has reached 587 MB. Capping
that is a question about log volume, not retention, and it is not solved here.
Logs written before this bound are not reclaimed; that is an operator's call.

201 lib tests green.
@myobie
myobie merged commit 1b12604 into main Aug 4, 2026
2 checks passed
@myobie
myobie deleted the fix/bounded-log-retention branch August 4, 2026 01:08
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