• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mroderick / codebar-planner / 24199732747
96%
master: 95%

Build:
Build:
LAST BUILD BRANCH: fix/invitation-log-retry-v2
DEFAULT BRANCH: master
Ran 09 Apr 2026 04:10PM UTC
Jobs 1
Files 182
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

09 Apr 2026 03:52PM UTC coverage: 95.526%. First build
24199732747

push

github

mroderick
fix: handle duplicate InvitationLogEntry on retry

Second attempt at fixing the "Member has already been taken" validation error
when re-sending workshop invitations.

Problem:
The previous fix (PR #2556) used find_or_initialize_by with the status included
in the query. However, the InvitationLogEntry uniqueness constraint only validates
(member_id, invitation_type, invitation_id), NOT status. This means:

- A member can have ONE success entry AND ONE failure entry for the same invitation
- find_or_initialize_by(member, invitation, :success) would return a persisted
  entry with status=:failed if one existed, causing the wrong status to be used
- Or if building a new entry with status=:success when status=:failed already
  existed, the uniqueness validation would fail

Fix:
1. Split the check: first find any existing entry by (member, invitation),
   ignoring status
2. If found, return it (either success or failure)
3. Only if no entry exists, create a new one with the specified status

Additionally, add autosave: false to the has_many :entries association to prevent
Rails from attempting to autosave unpersisted entries when fail_batch is called,
which was causing "Validation failed: Entries is invalid" errors.

Changes:
- app/services/invitation_logger.rb: Separate find_or_build_entry logic
- app/models/invitation_log.rb: Add autosave: false to entries association

Tests:
- All 41 existing tests pass
- Retry behavior tests verify no duplicate entries are created

4 of 4 new or added lines in 2 files covered. (100.0%)

3480 of 3643 relevant lines covered (95.53%)

45.99 hits per line

Jobs
ID Job ID Ran Files Coverage
1 24199732747.1 09 Apr 2026 04:10PM UTC 1092
69.86
GitHub Action Run
Source Files on build 24199732747
  • Tree
  • List 182
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #24199732747
  • 4bd3c78f on github
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc