The Validator That Took A Mode Parameter
Decide what you would do from the brief alone, including whether you would change anything at all. Everything below it is available, but the exercise stops working if you open it first.
Six months ago two near-identical 60-line validation functions — one for self-signup, one for the bulk admin import — were merged into validateUser(input, mode). It is now 200 lines with if (mode === 'import') in eleven places, and a signup bug fix has broken the importer twice this quarter.
Adding a third mode. The importer needs a dry-run variant, mode already exists, and mode === 'import-dry-run' ships the same afternoon with two lines changed. It is the cheapest possible next step and it is what makes the collapse permanent: three modes turn eleven branches into a lattice nobody can enumerate, and the tests — written per mode — now cover three paths through a function that has considerably more. The signal to watch is not branch count but authorship: when requirements for one function arrive from two different people who never talk to each other, the function is holding two rules.
Read this even if you are confident. It is here rather than behind a button because it is the answer most teams actually ship, it passes review, and the cost of it does not arrive until the change after this one.