fix: chronological Discord PR-open notification order - #43
Conversation
Batch syncs were posting PR-open channel notices in GitHub API order (newest first). Sort a copy by created_at only for the notify pass so storage and cursors stay unchanged. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Warning Review limit reached
Next review available in: 54 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
WalkthroughThe notification engine now sorts contribution events by creation time before Discord processing. Deterministic tie-breakers define equal-time ordering. The original contribution list remains unchanged. A regression test verifies oldest-first ordering for batch pull request notifications. ChangesNotification ordering
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4✅ 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/ghdcbot/engine/orchestrator.py`:
- Around line 273-286: The _notification_event_sort_key function needs a
deterministic final tie-breaker for events sharing all current key fields.
Append the canonical event identifier, such as payload review_id, to the
returned tuple so equal-time pr_reviewed events with different reviews sort
independently of ingestion order.
In `@tests/test_notifications.py`:
- Around line 1355-1368: Update the test around
_send_notifications_for_new_events to pass a named input list containing newer
and older events, then assert after the call that the list retains the same
element identities and ingestion order. Keep the existing message-order
assertions unchanged.
🪄 Autofix
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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 7e92ea1b-b54a-412a-b6c3-7e88c7af6c7c
📒 Files selected for processing (2)
src/ghdcbot/engine/orchestrator.pytests/test_notifications.py
Append review_id to the sort key for equal-time pr_reviewed events, and assert the notify pass leaves the caller's contributions order untouched. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
run-oncecould post newer PR-open channel notices before older ones (GitHub list order is newest-first).created_atonly inside the notification pass.Test plan
pytest tests/test_notifications.py(includes new oldest-first batch test)Made with Cursor
Summary by CodeRabbit
Bug Fixes
Tests