Skip to content

Fail loudly on null Drivers in DriverRepository#90

Draft
Copilot wants to merge 2 commits intofeat/#55-lintingfrom
copilot/sub-pr-88-again
Draft

Fail loudly on null Drivers in DriverRepository#90
Copilot wants to merge 2 commits intofeat/#55-lintingfrom
copilot/sub-pr-88-again

Conversation

Copy link
Contributor

Copilot AI commented Mar 6, 2026

driverResponse.Drivers ?? [] silently masked mapping/deserialization failures — null Drivers would produce a successful-looking ingestion that wrote nothing.

Changes

  • DriverRepository.cs: Replace null-coalescing fallback with explicit null guards; log + throw on null driverResponse (ArgumentNullException) or null Drivers collection (InvalidOperationException), consistent with the pattern in ResultsRepository.cs
// Before
await cosmosDataRepository.UpsertItemsAsync(driverResponse.Drivers ?? []);

// After
if (driverResponse is null)
{
    logger.LogError("driverResponse is null in WriteDriversAsync.");
    throw new ArgumentNullException(nameof(driverResponse));
}

if (driverResponse.Drivers is null)
{
    logger.LogError("driverResponse.Drivers is null in WriteDriversAsync.");
    throw new InvalidOperationException("Driver response contains a null Drivers collection.");
}

await cosmosDataRepository.UpsertItemsAsync(driverResponse.Drivers);

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…ndling

Co-authored-by: PhilipWoulfe <8867626+PhilipWoulfe@users.noreply.github.com>
Copilot AI changed the title [WIP] Address feedback on linting adjustments from PR #88 Fail loudly on null Drivers in DriverRepository Mar 6, 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