Leading Zeros in Bin Codes Resolve to the Wrong Storage Location
Level 2 · node · Data · Identifier collision caused by numeric coercion of string codes
Scenario
A fictional equipment warehouse identifies storage bins with string codes. '007' and '7' refer to different bins, and alphabetic codes are also valid. The lookup service currently converts codes into numbers before comparing them, which can return the wrong storage location. Trace the identifier contract through the repository and controller.
Requirements
Compare bin codes as their original strings and return only an exact match. Do not coerce numeric inputs or differently padded codes. Return null for unknown codes, preserve inventory ordering and code values, and keep the existing API and repository interfaces without external dependencies.
Acceptance criteria
- A code with leading zeros resolves independently from its unpadded counterpart.
- Existing alphanumeric and hyphenated bin codes remain searchable.
- An unknown bin code returns null.
- Numeric inputs and differently padded numeric strings do not alias stored codes.
- The inventory listing preserves original code strings and order.
- An empty inventory returns null for lookups.