Skip to content

fix: ignore stale log-retention index entries - #15

Merged
codeforester merged 1 commit into
mainfrom
bug/12-20260730-stale-log-retention-index
Jul 30, 2026
Merged

fix: ignore stale log-retention index entries#15
codeforester merged 1 commit into
mainfrom
bug/12-20260730-stale-log-retention-index

Conversation

@codeforester

Copy link
Copy Markdown
Contributor

Fixes #12

Summary

  • discard missing paths from the persisted retention index before calculating the prune count
  • keep the current log path reserved even before the file is created
  • add a regression test for phantom index entries

Root cause

The retention rewrite counted every indexed path, including logs deleted outside the pruning function. A stale entry inflated the excess count and caused extra real logs to be unlinked.

Checks

  • python -m pytest tests/test_app_log_retention.py
  • python -m pytest — 154 passed, 4 subtests passed
  • ./tests/validate.sh

@codeforester
codeforester marked this pull request as ready for review July 30, 2026 20:18
@codeforester
codeforester merged commit 0a6a0c6 into main Jul 30, 2026
11 checks passed
@codeforester
codeforester deleted the bug/12-20260730-stale-log-retention-index branch July 30, 2026 20:18
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.

Prune stale log-retention index entries before enforcing max_log_files

1 participant