ORIGINAL COMPANY-CONTEXT PRACTICE
Import branch records without corrupting account identifiers
Original practice scenario: A hypothetical bank receives branch exports with different encodings, leading-zero account identifiers and localized date formats. Design a deterministic import contract.
Written for independent practice using company context; this is not a verified question from a company interview.
A REASONED APPROACH
Model answer.
Treat identifiers as bounded strings and make encoding and format decisions explicit at the file boundary. A convenient numeric conversion can irreversibly alter an account key.
Work through it
- Require declared file encoding, header version and date convention, preserving the original bytes or an authorized immutable reference for later diagnosis.
- Validate field shape and decoded text before applying business rules; reject ambiguous dates and detect normalization collisions rather than silently repairing them.
- Separate whole-file parsing failures from row-level exceptions, returning stable source positions and reason codes without printing sensitive account details.
Tradeoffs to discuss
- Strict contracts make producer changes visible but require coordination; compatibility adapters can help when individually versioned and tested.
Common pitfalls
- Do not strip leading zeros, transliterate names or trim meaningful identifier characters as a universal cleanup step.
- A decoding replacement character may hide corruption even when the resulting CSV still parses.