Skip to content

fix(selections): enforce exact list count in ValidateSelections#119

Merged
PhilipWoulfe merged 2 commits intofeat/#86-retrieve-selectionsfrom
copilot/sub-pr-118
Mar 12, 2026
Merged

fix(selections): enforce exact list count in ValidateSelections#119
PhilipWoulfe merged 2 commits intofeat/#86-retrieve-selectionsfrom
copilot/sub-pr-118

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 12, 2026

ValidateSelections only checked that 5 non-empty drivers were present, allowing payloads with extra empty/whitespace entries (e.g. 6 items: 5 valid + 1 empty) to pass validation and be persisted as-is — inconsistent with ValidateMockSubmission which requires Count == 5.

Changes

  • SelectionService.ValidateSelections: Added upfront selections.Count != 5 guard before the existing non-empty/distinct checks:
if (selections.Count != 5)
{
    throw new SelectionValidationException("Exactly 5 unique drivers must be selected.");
}
  • SelectionServiceTests: Added UpsertSelectionAsync_ShouldReject_WhenMoreThanFiveSelectionsSubmitted covering the 5-valid + 1-empty payload case.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…and add test

Co-authored-by: PhilipWoulfe <8867626+PhilipWoulfe@users.noreply.github.com>
Copilot AI changed the title [WIP] [WIP] Address feedback on "Feat/#86 retrieve selections" PR fix(selections): enforce exact list count in ValidateSelections Mar 12, 2026
@PhilipWoulfe PhilipWoulfe marked this pull request as ready for review March 12, 2026 10:17
@PhilipWoulfe PhilipWoulfe merged commit 77e8b37 into feat/#86-retrieve-selections Mar 12, 2026
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.

2 participants