Skip to content

Conversation

@mlienau
Copy link
Contributor

@mlienau mlienau commented Dec 1, 2025

  • Fixes issue where mapping a PreconditionFailedResult to another type loses the message.
  • Adds unit test to ensure reason and message are preserved when mapping to other failure type.

Fixes #16

Copilot AI review requested due to automatic review settings December 1, 2025 15:17
@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Code Coverage

Package Line Rate Branch Rate Complexity Health
F23.Kernel 94% 88% 133
F23.Kernel.AspNetCore 100% 100% 155
Summary 97% (316 / 327) 97% (198 / 204) 288

@github-actions
Copy link

github-actions bot commented Dec 1, 2025

Test Results

  2 files  ±0    2 suites  ±0   2s ⏱️ -1s
141 tests +3  141 ✅ +3  0 💤 ±0  0 ❌ ±0 
282 runs  +6  282 ✅ +6  0 💤 ±0  0 ❌ ±0 

Results for commit 6052982. ± Comparison against base commit c1fc66c.

Copy link

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 fixes a bug where the Message property of a PreconditionFailedResult was not preserved when mapping to a different generic type. The fix ensures that when MapFailure<TOther>() is called on a PreconditionFailedResult<T>, both the Reason and Message are carried over to the new PreconditionFailedResult<TOther> instance, maintaining consistency with how other failure result types (like UnauthorizedResult) preserve their properties during type mapping.

  • Updated MapFailure<TOther>() to pass both Reason and Message when creating the mapped result
  • Added comprehensive test coverage validating that both properties are preserved across all precondition failure reasons

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/F23.Kernel/Result.cs Fixed MapFailure<TOther>() method to include preconditionFailed.Message parameter when mapping PreconditionFailedResult to another type
src/F23.Kernel.Tests/Results/PreconditionFailedResultTests.cs Added parametrized test to verify that both Reason and Message are preserved when mapping PreconditionFailedResult to another type

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paulirwin paulirwin self-requested a review December 1, 2025 22:35
@paulirwin paulirwin merged commit fe5d51b into main Dec 1, 2025
10 checks passed
@paulirwin paulirwin deleted the issue/16 branch December 1, 2025 22:35
@paulirwin paulirwin added the notes:bug-fix List under Bug Fixes for release notes label Dec 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

notes:bug-fix List under Bug Fixes for release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MapFailure to PreconditionFailed of other type does not include original message

3 participants