fix(worker): prefer newest refs when applying the 64 revision cap#1122
fix(worker): prefer newest refs when applying the 64 revision cap#1122GitBalake wants to merge 2 commits intosourcebot-dev:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
WalkthroughSorts Git refs before truncation: Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Line 12: The Unreleased changelog bullet "Fixed revision selection so the
64-revision cap prefers the newest matching branches and tags instead of pruning
by ref-name order." is missing the required PR link suffix; edit CHANGELOG.md
and append the PR reference in the required format for this entry, e.g. add "
[`#1122`](https://github.com/sourcebot-dev/sourcebot/pull/1122)" to the end of
that line so it follows the project's changelog guideline.
In `@packages/backend/src/git.test.ts`:
- Around line 69-131: Update the tests for getTags and getBranches to first
assert the expected refs exist (use assertions on getTags/getBranches like
expect(tags).toContain("z-newest") and expect(tags).toContain("a-oldest") /
expect(branches).toContain("zzz-newest") and
expect(branches).toContain("aaa-oldest")) before comparing order, then compare
ordering (either check indices as before or assert the first element equals the
newest ref) so a missing ref (indexOf == -1) cannot make the test pass; update
the assertions in the tests referencing getTags and getBranches accordingly.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 881525c5-fc19-433c-86e7-25a497bc3a9d
📒 Files selected for processing (4)
CHANGELOG.mdpackages/backend/src/git.test.tspackages/backend/src/git.tspackages/backend/src/repoIndexManager.test.ts
Part of #1016
Summary
Sourcebot currently caps explicit branch/tag indexing at 64 revisions. Before this change, matching refs were effectively pruned in ref-name order, which could cause older tags to be kept while newer tags were dropped.
This change applies sorting before truncation so the cap keeps the newest matching refs by default:
Verification
Summary by CodeRabbit
Bug Fixes
Tests
Documentation