Skip to content

Add award notice recipient and send-path regression coverage - #283

Merged
rsmoke merged 1 commit into
stagingfrom
cursor/award-notice-coverage-9c2e
Sep 28, 2026
Merged

rsmoke merged 1 commit into
stagingfrom
cursor/award-notice-coverage-9c2e

Conversation

@cursor

@cursor cursor Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

Risky behavior now covered

  • ContestInstance#award_notice_entries recipient selection: winners, finalists, and prize-only entries are included; plain unawarded and soft-deleted winners are excluded.
  • send_award_notices empty cohort: alerts and does not queue mail or bump award_emails_sent_count.
  • include_amounts preference: '0' queues notices with amounts omitted.
  • award_email_preferences loads the same recipient set for the preview screen.

Test files added/updated

  • spec/models/contest_instance_spec.rb — #award_notice_entries inclusion/exclusion
  • spec/controllers/contest_instances_controller_spec.rb — send/preferences edge cases

Why 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.awarded merge logic or the empty-cohort guard could email the wrong people, skip winners, or silently no-op without a clear alert.

Validation

bundle exec rspec on the touched describe blocks: 10 examples, 0 failures.

Open in Web View Automation 

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_entries assert 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_notices with include_amounts: '0' (mailer called with include_amounts: false), the no-recipients path (flash alert, no mail, award_emails_sent_count unchanged), and GET award_email_preferences assigning @award_notice_entries for the preview screen.

Reviewed by Cursor Bugbot for commit ab3ffd6. Bugbot is set up for automated code reviews on this repo. Configure here.

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>
@rsmoke
rsmoke marked this pull request as ready for review September 28, 2026 12:54
@rsmoke
rsmoke self-requested a review as a code owner September 28, 2026 12:54
Copilot AI lite review requested due to automatic review settings September 28, 2026 12:54
@cursor

cursor Bot commented Sep 28, 2026

Copy link
Copy Markdown
Author

Bugbot couldn't run - usage limit reached

Bugbot 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)

@rsmoke
rsmoke merged commit d5c2e98 into staging Sep 28, 2026
8 checks passed
@rsmoke
rsmoke deleted the cursor/award-notice-coverage-9c2e branch September 28, 2026 12:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants