Repository navigation
fix(bank-accounts): surface app-layer validation as BANK_ACCOUNT_INVALID - #514
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found on TEST after #513 deployed (chart 3.2.83):
bankAccountAddwith an unsupported bank returnedThe app-layer validators used the generic domain
ValidationError, whicherror-mapgroups with internal failures. Every field check (bank, branch, account type, number, currency, length limits, invisible characters, account cap) now returnsBankAccountValidationErrorbuilt from an allowlistedBankAccountValidationReason, so the customer getsBANK_ACCOUNT_INVALIDwith 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
mapErrorand one that keeps the limit text in step with the enforced constants.test:uniton the two touched specs: 119 passed. tsc, eslint, prettier, typos clean.🤖 Generated with Claude Code