Skip to content

fix(bank-accounts): surface app-layer validation as BANK_ACCOUNT_INVALID - #514

Merged
islandbitcoin merged 2 commits into
mainfrom
fix/bank-account-validation-code
Sep 23, 2026
Merged

islandbitcoin merged 2 commits into
mainfrom
fix/bank-account-validation-code

Conversation

@islandbitcoin

Copy link
Copy Markdown
Contributor

Found on TEST after #513 deployed (chart 3.2.83): bankAccountAdd with an unsupported bank returned

UNEXPECTED_CLIENT_ERROR: Unexpected error occurred, please try again or contact support if it persists (code: ValidationError: Bank is not supported.)

The app-layer validators used the generic domain ValidationError, which error-map groups with internal failures. Every field check (bank, branch, account type, number, currency, length limits, invisible characters, account cap) now returns BankAccountValidationError built from an allowlisted BankAccountValidationReason, so the customer gets BANK_ACCOUNT_INVALID with the specific message. No schema change.

Tests: the existing rejection table retargeted to the new class (same messages asserted), plus a regression test that runs the unsupported-bank path through mapError and one that keeps the limit text in step with the enforced constants. test:unit on the two touched specs: 119 passed. tsc, eslint, prettier, typos clean.

🤖 Generated with Claude Code

bobodread876 and others added 2 commits September 23, 2026 12:41
The add/update validators returned the generic domain ValidationError,
which error-map treats as internal, so a customer entering an unsupported
bank saw "Unexpected error occurred ... (code: ValidationError: Bank is
not supported.)" (seen live on TEST, chart 3.2.83). They now return
BankAccountValidationError with allowlisted reasons and map to
BANK_ACCOUNT_INVALID carrying the reason text.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…e reason allowlist

Review fixes for #514:
- BankAccountValidationError now only accepts BankAccountValidationReasonText,
  so free text fails to compile instead of silently degrading to the generic
  message in error-map.
- Reword the class comment: the error now comes from the app layer as well as
  banking.py.
- Tests: add a @ts-expect-error compile-time guard; runtime-fallback tests keep
  their free-text inputs via an explicit cast.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@islandbitcoin
islandbitcoin merged commit 3a1832a into main Sep 23, 2026
15 checks passed
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.

2 participants