Skip to content

polish(creacc): drop dead transient-failure path (#14)#45

Merged
a2chang merged 1 commit intomainfrom
polish/issue-14-drop-dead-transient-failure
May 1, 2026
Merged

polish(creacc): drop dead transient-failure path (#14)#45
a2chang merged 1 commit intomainfrom
polish/issue-14-drop-dead-transient-failure

Conversation

@a2chang
Copy link
Copy Markdown
Contributor

@a2chang a2chang commented May 1, 2026

Closes #14.

Why

Issue #14 asked us to decide whether CreaccResult.isTransientFailure()
(and the matching 503 SERVICE_UNAVAILABLE mapping in
CreaccController#failureStatus) is dead code now that the COBOL
ENQ/DEQ around the account-counter row has been replaced with
SELECT ... FOR UPDATE on control.

Audit of every fail-code emission in CREACC:

  • CreaccService.create(...) emits "A" (validation), "1" (customer
    not found), "9" (account-count fetch failed), and "8" (capacity
    reached).
  • CreaccRepository only emits "7" via rollbackFailure(...) for an
    account-insert rollback.
  • CrdbRetry retries 40001 serialization failures, and any
    surviving DataAccessException is wrapped into a
    CbsaAbendException and surfaced as 500/UNEX via the global
    handler.

Nothing in the CREACC path produces fail codes "3" or "5", so the
isTransientFailure() predicate and its 503 mapping are unreachable.

What

  • Drop TRANSIENT_FAIL_CODES and the isTransientFailure() predicate
    from CreaccResult.
  • Drop the if (result.isTransientFailure()) ... 503 branch from
    CreaccController#failureStatus.

If transient counter-lock errors ever do need a domain-level fail
code in the future, they can be reintroduced as a fresh predicate
plus an explicit emission site, rather than being kept as silently
dead code.

Tests

No behaviour change for any reachable code path. ./mvnw verify:
205/205 green locally (no test-suite changes required).

augment review

After replacing the COBOL ENQ/DEQ with SELECT ... FOR UPDATE on
control, the CreaccResult.isTransientFailure() predicate (and the
CreaccController 503 mapping that consumed it) became unreachable.
CreaccService and CreaccRepository only emit fail codes A, 1, 8, 9,
and 7 (rollback) - never 3 or 5. Drop the dead predicate and the
unused TRANSIENT_FAIL_CODES constant, and remove the matching 503
branch from CreaccController#failureStatus. Counter / lock
contention is already either retried by CrdbRetry on 40001 or
surfaced as CbsaAbendException -> 500.
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 cdcfc42 into main May 1, 2026
1 check passed
@a2chang a2chang deleted the polish/issue-14-drop-dead-transient-failure branch May 1, 2026 22:10
@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.

CREACC: review whether transient counter-lock failures should map to a CreaccResult fail code instead of 500

1 participant