On foolproofing and the success of failure

I’ve been on a project which covid basically sank, but like an orca deruddered yacht languishing in the Mediterranean it’s still sort of moving with the odd wave and breeze. The project is one of a series I have worked on which have used a roughly similar process. I get sent a CSV, I import the CSV into WordPress. Done.

This time, however, I’m not importing, which means I have to rewrite the code. Now file upload is easy, but file upload with data checking is not. I have to make sure the data passes before I risk turning it into content, but then what is passes> How do I decide on the level of foolproofing I need, how do I choose which tests to build and which tests to skip. Is the encoding of latin characters important enough to be concerned if they differ? Do I accept new line characters in a title where they’ll never display. So I need to see the potential problems, but also know the potential problems which may be generated.

“Program testing can be used to show the presence of bugs, but never to show their absence!”

Edsger W. Dijkstra

Which is interesting in a world of test driven development and so on, Does developing around tests mean we can forsee the issues ahead of getting to them, or just those we perceive to be possible. We live with linters as critical friends and type checkers. The zenith would be code that never failed, but if the speed of that code was (due to checking) too slow, then it would fail, and I suppose the logic is to choose the most important failures, the successful failures. This could be all pareto, or perhaps predator prey, but it feels an interesting design approach to build out errors, rather than adding a layer (tests) which are themselves, potentially, an error.