Skip to content

fix(crdtagy): emit CommSuccess=Y / CommFailCode=0 on the success path#41

Merged
a2chang merged 2 commits into
mainfrom
polish/crdtagy-success-flags
May 1, 2026
Merged

fix(crdtagy): emit CommSuccess=Y / CommFailCode=0 on the success path#41
a2chang merged 2 commits into
mainfrom
polish/crdtagy-success-flags

Conversation

@a2chang
Copy link
Copy Markdown
Contributor

@a2chang a2chang commented May 1, 2026

Closes #31.

What

On the success path, CrdtagyController previously echoed CommSuccess and CommFailCode straight from the request, so callers could receive a populated CommCreditScore alongside whatever placeholder they originally sent (often blank or "N"/"X").

Now the controller mirrors the convention used by the other Java endpoint controllers (e.g. DbcrfunController, DelaccController): on the success path it sets CommSuccess = "Y" and CommFailCode = "0" unconditionally, so the HTTP response carries terminal indicators that line up with the populated score. CRDTAGY1 itself never touches these flags in COBOL — the parent CRECUST orchestrator does — but at the Java endpoint level they are the natural success/fail flag for the per-agency call.

Failure paths are unchanged: timeouts and async failures still surface as CbsaAbendException(PLOP), validation failures as 400 ProblemDetail.

Tests

CrdtagyControllerWebMvcTest (9 tests, all green):

  • The existing parameterized returnsSuccessfulResponseForEveryAgencyRoute (5 cases) is tightened to also assert CommSuccess == "Y" and CommFailCode == "0".
  • New overridesPlaceholderSuccessFlagsFromRequest: caller sends CommSuccess: "N", CommFailCode: "X"; response still carries Y / 0.

Local ./mvnw verify green: 197/197.

augment review

Closes #31.

The CRDTAGY endpoint previously echoed CommSuccess and CommFailCode
from the incoming commarea, so callers could receive a populated
CommCreditScore alongside whatever placeholder they sent. Mirror the
convention used by DbcrfunController and DelaccController: on the
success path emit terminal Y / 0 so the HTTP response indicators line
up with the populated score.

CRDTAGY1 itself never touches these flags in COBOL — the parent
CRECUST orchestrator does — but at the Java endpoint level they are
the natural per-agency success/fail flag.

Tests: tighten the parameterized success test to assert Y/0 across all
five agencies and add overridesPlaceholderSuccessFlagsFromRequest.
@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 behavioral change (setting CommSuccess="Y" and CommFailCode="0" on the success path) is well-covered by:

  • Enhanced parameterized test asserting the new flag values across all 5 agency routes
  • New dedicated test verifying placeholder override behavior

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. 2 suggestions posted.

Fix All in Augment

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

commarea.commDateOfBirth()
), agencyNumber);

// Mirror the convention used by the other Java endpoint controllers
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The comment cites DELACC as an example, but DelaccController doesn’t use CommSuccess/CommFailCode (it uses DelAccSuccess/DelAccFailCd, etc.), so this may be misleading context for future maintainers.

Severity: low

🤖 Was this useful? React with 👍 or 👎

defaultInt(commarea.commCsReviewDate()),
defaultString(commarea.commSuccess()),
defaultString(commarea.commFailCode())
"Y",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

awaitCreditScore() falls back to 0 when the future completes with Optional.empty(), but this success path now always emits CommSuccess="Y" / CommFailCode="0"; can you confirm Optional.empty() is impossible here (or represents success), so we never return a 0 score with a success indicator?

Severity: medium

🤖 Was this useful? React with 👍 or 👎

1. Comment cited DELACC inaccurately (DelaccController uses DelAccSuccess /
   DelAccFailCd field names, not CommSuccess / CommFailCode). Replace with
   a DBCRFUN-only reference, which is the actual precedent.

2. awaitCreditScore previously fell back to 0 on Optional.empty(). Now
   that the success path always emits CommSuccess=Y / CommFailCode=0,
   that fallback would mean we could return a 0 score with terminal
   success indicators. CreditAgencyService always returns
   Optional.of(score), so refuse Optional.empty() with a PLOP abend
   instead.

Add emptyOptionalScoreSurfacesAsPlopAbend regression test.
@a2chang
Copy link
Copy Markdown
Contributor Author

a2chang commented May 1, 2026

Round-1 review addressed:

  1. (low) Comment cited DELACC inaccurately (DelaccController uses DelAccSuccess / DelAccFailCd, not CommSuccess / CommFailCode). Replaced with a DBCRFUN-only reference.
  2. (medium) awaitCreditScore no longer .orElse(0). CreditAgencyService always returns Optional.of(score), so Optional.empty() now surfaces as a PLOP abend rather than letting CommCreditScore=0 ride out alongside CommSuccess=\Y\ / CommFailCode=\0. New regression test emptyOptionalScoreSurfacesAsPlopAbend covers it.

Local ./mvnw verify green: 198/198. Pushed as 13ba7e8.

augment review

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 b548c20 into main May 1, 2026
1 check passed
@a2chang a2chang deleted the polish/crdtagy-success-flags branch May 1, 2026 20:55
@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.

CRDTAGY follow-up: populate CommSuccess / CommFailCode from outcome

1 participant