Skip to content

Use Enum.TryParse with ignoreCase fallback in IssueEntity.ToDomain#25

Merged
mpaulosky merged 3 commits into
feature/dto-refactor-and-soft-deletefrom
copilot/sub-pr-23-again
Feb 21, 2026
Merged

Use Enum.TryParse with ignoreCase fallback in IssueEntity.ToDomain#25
mpaulosky merged 3 commits into
feature/dto-refactor-and-soft-deletefrom
copilot/sub-pr-23-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Feb 20, 2026

  • Apply Enum.IsDefined check after Enum.TryParse to handle numeric strings like "999"
  • Expose IssueEntity internals to Unit test project via InternalsVisibleTo
  • Add unit tests for IssueEntity.ToDomain() fallback behavior (unknown, empty, numeric, differently-cased status values)
  • Build and run tests to validate
  • Code review and security check

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

…IssueEntity.ToDomain

Co-authored-by: mpaulosky <60372079+mpaulosky@users.noreply.github.com>
Copilot AI changed the title [WIP] WIP Address feedback on DTOs refactor and audit trail changes Use Enum.TryParse with ignoreCase fallback in IssueEntity.ToDomain Feb 20, 2026
Copilot AI requested a review from mpaulosky February 20, 2026 23:59
@mpaulosky mpaulosky marked this pull request as ready for review February 21, 2026 00:07
Copilot AI review requested due to automatic review settings February 21, 2026 00:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens MongoDB → domain mapping by preventing IssueEntity.ToDomain() from throwing when status values stored in MongoDB are empty, unknown, or differently cased, avoiding unhandled 500s during reads.

Changes:

  • Replaces Enum.Parse<IssueStatus>(Status) with a case-insensitive Enum.TryParse in IssueEntity.ToDomain().
  • Adds a fallback to IssueStatus.Open when parsing fails.

Comment thread src/Api/Data/IssueRepository.cs Outdated
Comment thread src/Api/Data/IssueRepository.cs Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 21, 2026

Test Results Summary

0 tests   0 ✅  0s ⏱️
0 suites  0 💤
0 files    0 ❌

Results for commit cd7fc58.

♻️ This comment has been updated with latest results.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mpaulosky
Copy link
Copy Markdown
Owner

@copilot apply changes based on the comments in this thread

@mpaulosky
Copy link
Copy Markdown
Owner

@copilot apply changes based on the comments in this thread

1 similar comment
@mpaulosky
Copy link
Copy Markdown
Owner

@copilot apply changes based on the comments in this thread

@mpaulosky mpaulosky merged commit 81cb6c0 into feature/dto-refactor-and-soft-delete Feb 21, 2026
10 of 12 checks passed
@mpaulosky mpaulosky deleted the copilot/sub-pr-23-again branch February 21, 2026 00:20
Copilot stopped work on behalf of mpaulosky due to an error February 21, 2026 00:20
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