fix: only count preview branches toward the preview branch limit#4283
Conversation
The Limits page counted development branches toward the preview-branch limit, showing inflated and sometimes over-limit values. Filter the count on type PREVIEW with a parent environment to mirror checkBranchLimit. Closes #4281
|
WalkthroughUpdated the Limits presenter to count only 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Problem
On the org Manage/Limits page, the "Preview branches" usage count included development branches, not just preview branches. Because the count is rendered against the preview-branch limit, it could show nonsensical over-limit values (e.g. "12 / 5" when most were dev branches).
This is display-only — actual quota enforcement is correct.
checkBranchLimitenforces two separate limits (PREVIEW ->branches, DEVELOPMENT ->branchesDev); dev branches never consumed the preview quota, only the displayed number was wrong.Root cause
The count in
LimitsPresenter.server.tsfiltered only onbranchName \!= null/archivedAt: nullwith notypefilter, so it counted DEVELOPMENT branches too.Fix
Add
type: "PREVIEW"andparentEnvironmentId: { not: null }to the count's where clause, mirroringcheckBranchLimit(also excludes the branchable parent env).Closes #4281.
TRI-12199