Skip to content

feat: add max historical entries per repo#25

Merged
smnatale merged 1 commit into
mainfrom
feat/history-configure
May 21, 2026
Merged

feat: add max historical entries per repo#25
smnatale merged 1 commit into
mainfrom
feat/history-configure

Conversation

@smnatale
Copy link
Copy Markdown
Owner

@smnatale smnatale commented May 21, 2026

Description

Add max historical entries cap for code reviews

Screenshots/Images

Summary by CodeRabbit

  • New Features

    • Added configurable history management for saved reviews with a new history.max_entries configuration option (defaults to 50 entries per repository).
    • Automatically prunes older reviews when the maximum entry limit is reached.
    • Setting max_entries to 0 retains all saved reviews indefinitely.
  • Documentation

    • Updated configuration examples and help documentation to reflect the new history settings.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 21, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 77857482-763f-4584-a85b-56c8d83c19f6

📥 Commits

Reviewing files that changed from the base of the PR and between e81bd51 and 7c59a88.

📒 Files selected for processing (5)
  • README.md
  • doc/coderabbit.txt
  • lua/coderabbit/config.lua
  • lua/coderabbit/storage.lua
  • tests/coderabbit/storage_spec.lua

📝 Walkthrough

Walkthrough

This PR adds history limits to review persistence. Configuration introduces history.max_entries (default 50) to cap saved reviews per repository. Storage refactors filename handling to support deterministic chronological ordering and pruning, whilst tests verify correct behaviour when the limit is exceeded.

Changes

Review history limit and storage pruning

Layer / File(s) Summary
History configuration definition
lua/coderabbit/config.lua, README.md, doc/coderabbit.txt
New history.max_entries configuration (default 50) is defined and documented in setup examples and reference sections.
Storage pruning and filename handling
lua/coderabbit/storage.lua
Review files are now parsed to extract timestamps and sorted deterministically. M.save uses next_filename() to avoid collisions and calls prune_old_reviews() after each write. M.list, M.load, and M.ids all use sorted_review_files() for consistent chronological ordering, ensuring saved review retrieval respects the history limit.
History pruning test verification
tests/coderabbit/storage_spec.lua
Config import and test helper with_history_max() enable temporary configuration. New test verifies that saving 5 reviews with max_entries = 3 leaves only the 3 most recent branches in the list.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • smnatale/coderabbit.nvim#19: Changes to storage.list/load/ids ordering and pruning directly affect review restoration and the "most recent saved review" selection behaviour.
  • smnatale/coderabbit.nvim#23: Updates to storage.ids() and review file ordering impact quickfix feature command completion and saved review loading.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: add max historical entries per repo' directly and clearly describes the main change: introducing a configurable limit for historical review entries per repository.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@smnatale smnatale merged commit 67e85cf into main May 21, 2026
5 checks passed
@smnatale smnatale deleted the feat/history-configure branch May 21, 2026 19:40
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