Skip to content

migrate(DELACC): translate DELACC to Java#25

Merged
a2chang merged 3 commits intomainfrom
migrate/DELACC
May 1, 2026
Merged

migrate(DELACC): translate DELACC to Java#25
a2chang merged 3 commits intomainfrom
migrate/DELACC

Conversation

@a2chang
Copy link
Copy Markdown
Contributor

@a2chang a2chang commented May 1, 2026

Summary

Translate the DELACC COBOL flow into Spring Boot with jOOQ-backed account deletion, audit persistence, and REST exposure.

  • Source program: https://github.com/augment-solutions/cics-banking-sample-application-cbsa/blob/main/src/base/cobol_src/DELACC.cbl
  • Mapped REST endpoints:
    • DELETE /api/v1/delacc/remove/{accno}
  • Notable decisions:
    • Reused the existing AccountDetails domain model instead of introducing DELACC-specific duplicate account records.
    • Locked the target account row with SELECT FOR UPDATE and wrapped the delete/audit sequence with CrdbRetry + TransactionTemplate so Cockroach serialization failures retry at the full business-operation level.
    • Preserved the COBOL-style failure model with DELACC-specific result codes for not-found vs delete failure, and mapped audit-write failures to CbsaAbendException code HWPT.
    • Wrote the PROCTRAN deletion audit with transaction type ODA and the established account-deletion description format already used by DELCUS account cleanup.
    • Kept the REST contract aligned to the z/OS Connect commarea shape, including the ACCT eyecatcher and numeric COBOL date formatting in the success payload.
    • Updated CbsaApplicationTests to mock the new DELACC repository/service beans so the database-free bootstrap smoke test still passes when jOOQ auto-configuration is excluded.
  • Test coverage:
    • Unit: DelaccServiceUnitTest
    • @SpringBootTest: DelaccServiceIntegrationTest
    • MockMvc: DelaccControllerWebMvcTest

@a2chang
Copy link
Copy Markdown
Contributor Author

a2chang commented May 1, 2026

augment review

@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.

Coverage highlights:

  • Service layer: comprehensive unit tests covering happy path, failures, edge cases, and abend scenarios
  • Integration layer: end-to-end tests with real database interactions
  • Web layer: MockMvc tests covering all response types and validation

Nice work on the thorough testing! 🎉

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.

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. 1 suggestion posted.

Fix All in Augment

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

) {

public DelaccRequestDto {
Objects.requireNonNull(delAcc, "delAcc must not be null");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Objects.requireNonNull(delAcc, ...) throws during JSON binding, which can bypass the validation error path and surface to clients as a generic 500 (via the catch-all exception handler) instead of a 400 validation response.

Severity: medium

🤖 Was this useful? React with 👍 or 👎

@a2chang
Copy link
Copy Markdown
Contributor Author

a2chang commented May 1, 2026

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

Fix All in Augment

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

toCobolDate(account.nextStatementDate()),
account.availableBalance(),
account.actualBalance(),
"",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

In the success payload, DelAccSuccess / DelAccFailCd are currently returned as empty strings; if clients treat these as commarea-level status flags, this can look like an unsuccessful call even though DelAccDelSuccess is Y. Is the intent to populate the program-level success/fail fields consistently with the other endpoints?

Severity: medium

🤖 Was this useful? React with 👍 or 👎


try {
int deletedRows = delaccRepository.deleteAccount(sortcode, request.accountNumber());
if (deletedRows != 1) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since the account row was just locked and read, deletedRows != 1 represents an unexpected state; returning a failure result here can still commit the transaction (and skip audit) if any rows were deleted. That can leave persistence/audit out of sync in the face of data integrity issues.

Severity: medium

🤖 Was this useful? React with 👍 or 👎

@a2chang
Copy link
Copy Markdown
Contributor Author

a2chang commented May 1, 2026

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. 1 suggestion posted.

Fix All in Augment

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

) {
Objects.requireNonNull(requestDto, "requestDto must not be null");

DelaccResult result = delaccService.delete(new DelaccRequest(accountNumber));
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

DelaccRequestDto is validated but its fields aren’t used (the delete is driven solely by the {accno} path variable), so a mismatched body (e.g., different DelAccAccno/sortcode) would still delete the path account. Consider rejecting inconsistent requests (or documenting that the body is ignored) to reduce the risk of accidental deletions.

Severity: medium

🤖 Was this useful? React with 👍 or 👎

@a2chang a2chang merged commit 87cef31 into main May 1, 2026
1 check passed
@a2chang a2chang deleted the migrate/DELACC branch May 1, 2026 12:35
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.

1 participant