Skip to content

fix(xfrfun): require XfrfunResult success to carry a null message#40

Merged
a2chang merged 1 commit intomainfrom
polish/xfrfun-result-invariant
May 1, 2026
Merged

fix(xfrfun): require XfrfunResult success to carry a null message#40
a2chang merged 1 commit intomainfrom
polish/xfrfun-result-invariant

Conversation

@a2chang
Copy link
Copy Markdown
Contributor

@a2chang a2chang commented May 1, 2026

Closes #29.

What

Tighten XfrfunResult's success invariant on message.

Before: the compact constructor permitted blank/whitespace strings ("", " ", etc.) on a successful result, which could mask accidental message propagation from a failure path through new XfrfunResult(...) written by hand.

After: transferSuccess == true requires message == null exactly. The static success(...) factory still always passes null, and the failure(...) 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 in InqaccResultTest / InqcustResultTest / InqacccuResultTest):

  • successFactoryStoresNullMessage
  • successConstructorRejectsBlankMessage" " on a successful result now throws IllegalArgumentException("Successful results must not include a message")
  • successConstructorRejectsNonBlankMessage"leaked" still throws (regression coverage for the existing branch)
  • failureRejectsNullMessage — covers the existing failure factory contract

Local ./mvnw verify green: 196/196 (XFRFUN class total: 17/17).

augment review

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.
@augmentcode
Copy link
Copy Markdown
Contributor

augmentcode Bot commented May 1, 2026

Test Coverage Guardian 🧪

Test coverage looks good. The new/changed behavior in this PR has adequate test coverage. No additional tests needed.

The included XfrfunResultTest comprehensively covers the tightened validation invariant with 4 focused tests covering success factory, blank message rejection, non-blank message rejection, and failure contract validation.

Copy link
Copy Markdown

@augment-app-staging augment-app-staging Bot left a comment

Choose a reason for hiding this comment

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

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@a2chang a2chang merged commit cf987e6 into main May 1, 2026
1 check passed
@a2chang a2chang deleted the polish/xfrfun-result-invariant branch May 1, 2026 20:40
@a2chang a2chang mentioned this pull request May 1, 2026
22 tasks
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.

XFRFUN follow-up: tighten XfrfunResult.success invariant on message

1 participant