What happened.
Each morning the supplier's product file arrived, and a chain of scripts and manual steps turned it into updates on the company's store. It had grown piece by piece: downloading, decoding, reading, category rules, picture checks and publishing lived in different scripts and in one person's head.
What we found, and the technical detail
It had failed or corrupted data more than once. Each new fault was fixed in one place and broke another. Adding a second supplier meant copying the same fragile steps again.
No single script was the trouble. Nowhere in the chain was a bad file stopped and explained. A file with a changed column, a broken character or a thousand missing prices went straight through to the store.
So we started by writing down each stage: what goes in, what comes out, what is checked and what happens to a file or a row that fails. Then we rebuilt each stage as a small tested step, with a set of made-up test files for every kind of fault the company had seen. Joined together, the stages make a pipeline: a fixed series of automatic checks that every file passes through.
Technical detail. The stages are fetch, decode, parse, category mapping, picture checks where the feed has pictures, a comparison with the previous file, and a decision to hold the file with reasons or release it. Each stage has a written specification and tests against made-up files for its kind of fault. A run produces a hold-or-release report in which the numbers add up: rows read equal rows released plus rows held plus rows rejected.