fix(xfrfun): require XfrfunResult success to carry a null message#40
Merged
fix(xfrfun): require XfrfunResult success to carry a null message#40
Conversation
Closes #29. Tighten the compact constructor: when transferSuccess == true, message must be exactly null (previously '' / ' ' were permitted, which could mask accidental message propagation from a failure path written by hand). The static success/failure factories were already compliant, so no production callers change. Tests: add XfrfunResultTest covering the success/null contract, the new blank rejection, the existing non-blank rejection, and the failure null-message rejection.
Contributor
|
✅ Test coverage looks good. The new/changed behavior in this PR has adequate test coverage. No additional tests needed. The included |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #29.
What
Tighten
XfrfunResult's success invariant onmessage.Before: the compact constructor permitted blank/whitespace strings (
""," ", etc.) on a successful result, which could mask accidental message propagation from a failure path throughnew XfrfunResult(...)written by hand.After:
transferSuccess == truerequiresmessage == nullexactly. The staticsuccess(...)factory still always passesnull, and thefailure(...)factory still requires a non-null/non-blank message, so no production callers are affected — both factories already match the tightened contract.Tests
New
XfrfunResultTest(4 tests, mirroring the pattern inInqaccResultTest/InqcustResultTest/InqacccuResultTest):successFactoryStoresNullMessagesuccessConstructorRejectsBlankMessage—" "on a successful result now throwsIllegalArgumentException("Successful results must not include a message")successConstructorRejectsNonBlankMessage—"leaked"still throws (regression coverage for the existing branch)failureRejectsNullMessage— covers the existing failure factory contractLocal
./mvnw verifygreen: 196/196 (XFRFUN class total: 17/17).augment review