fix: issue body must report compare.ahead_by, not commits.length#61
Conversation
The smoke run on issue #60 surfaced an inconsistency between the issue title and the body. Title (correct): "Upstream sync: 1521 new commits in ECC since 9db9867". Body (wrong): "has **250** commit(s) ahead of the recorded baseline", and the details summary said "250 total, showing first 50". Root cause: the GitHub compare endpoint caps `commits[]` at 250 per response regardless of the true delta. `formatIssueBody` used `commits.length` for both the intro and the details summary, so any delta above 250 silently displays as 250. The title was already correct because it pulls from `compare.ahead_by`. Fix: - Add required `totalCount` param to `formatIssueBody` and use it for the intro ("has N commit(s) ahead"), the details summary ("showing first X of N"), and the truncation footer ("… and (N - shown) more"). - Pass `compare.ahead_by` from `buildIssueContent` in the entry script. Tests (+3, 33 total in this file): - API-cap case (totalCount=1521, commits.length=250): asserts the body never mentions 250 and uses 1521 everywhere. - Total fits in display case: asserts the simple "Commits (N)" summary form and no truncation footer. - Rejection: negative or non-integer totalCount. - Existing tests updated to pass totalCount. Lint clean. 264/264 across the suite (was 261).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughThe PR updates upstream drift tracking to use GitHub's authoritative commit count (compare API's ChangesAccurate upstream drift reporting
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
Summary
Smoke run after PR #59 merged surfaced a title/body inconsistency on tracking issue #60. Title said "1521 new commits" (correct); body said "has 250 commit(s) ahead" and "250 total, showing first 50" (wrong).
Root cause: the GitHub compare endpoint caps
commits[]at 250 per response regardless of the true delta.formatIssueBodywas usingcommits.lengthfor the intro and the details summary, so any delta above 250 silently displays as 250.Fix
scripts/lib/upstream-drift.js— add requiredtotalCountparam toformatIssueBody. Use it for:scripts/upstream/check-upstream-drift.js—buildIssueContentpassescompare.ahead_byastotalCount.Tests
totalCount=1521,commits.length=250) — body must not mention 250 anywhere.Commits (N)summary, no truncation footer.totalCount.totalCount.Verification
npm run lintcleannpm test→ 264/264 (was 261)Before / after (issue #60 body intro)
Summary by cubic
Fixes incorrect commit counts in the upstream drift tracking issue body when more than 250 commits are ahead. The body now uses
compare.ahead_byfor all counts, matching the title and avoiding the GitHub compare API cap.formatIssueBodynow acceptstotalCountand uses it in the intro, details summary, and truncation text.buildIssueContentpassescompare.ahead_byastotalCountto avoid relying on cappedcommits[].totalCount.Written for commit 2e0c8fb. Summary will update on new commits.
Summary by CodeRabbit