Repository navigation
Add award notice recipient and send-path regression coverage - #283
Merged
Merged
Conversation
Cover ContestInstance#award_notice_entries inclusion/exclusion rules and send_award_notices empty/include_amounts/preferences edge cases so the wrong applicants are not emailed after awards changes. Co-authored-by: rsmoke <rsmoke@umich.edu>
Author
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_bff7242b-3ba9-45fe-ba65-cfa6b9681b30) |
There was a problem hiding this comment.
Copilot review overview
🔵 Needs a closer look
The preview test does not assert the exact recipient cohort, leaving incorrect assignments undetected.
Review effort: Lite
Findings: None
What changed in this PR
Adds regression coverage for award-notice recipient selection and controller send/preview edge cases.
Changes:
- Tests recipient inclusion and exclusion rules.
- Covers amount preferences and empty cohorts.
- Verifies preview recipient loading.
| File | Description |
|---|---|
spec/models/contest_instance_spec.rb |
Covers award recipient selection. |
spec/controllers/contest_instances_controller_spec.rb |
Covers sending and preference-screen behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Risky behavior now covered
ContestInstance#award_notice_entriesrecipient selection: winners, finalists, and prize-only entries are included; plain unawarded and soft-deleted winners are excluded.send_award_noticesempty cohort: alerts and does not queue mail or bumpaward_emails_sent_count.include_amountspreference:'0'queues notices with amounts omitted.award_email_preferencesloads the same recipient set for the preview screen.Test files added/updated
spec/models/contest_instance_spec.rb—#award_notice_entriesinclusion/exclusionspec/controllers/contest_instances_controller_spec.rb— send/preferences edge casesWhy these tests materially reduce regression risk
Award notices email applicants based on status and assigned prizes. Prior coverage only exercised the happy-path send. A regression in
Entry.awardedmerge logic or the empty-cohort guard could email the wrong people, skip winners, or silently no-op without a clear alert.Validation
bundle exec rspecon the touched describe blocks: 10 examples, 0 failures.Note
Low Risk
Test-only changes; behavior under test is unchanged and risk is limited to spec maintenance.
Overview
Adds regression specs only—no application code changes.
Model: New examples for
ContestInstance#award_notice_entriesassert winners, finalists, and prize-assigned entries are included, while plain unawarded entries and soft-deleted winners are excluded.Controller: Extends the existing award-notices examples to cover
POST send_award_noticeswithinclude_amounts: '0'(mailer called withinclude_amounts: false), the no-recipients path (flash alert, no mail,award_emails_sent_countunchanged), andGET award_email_preferencesassigning@award_notice_entriesfor the preview screen.Reviewed by Cursor Bugbot for commit ab3ffd6. Bugbot is set up for automated code reviews on this repo. Configure here.