A six-hundred-line deploy script rewritten in a compiled language in 2024, and a second rewrite back to shell.
what the compiled version fixed:
typed errors, tests, and a retry loop that was
written once rather than twice
what it cost:
a build step in the deploy of the deploy
a binary to distribute to four hosts
nobody except the author could change it quickly
what we ended up with:
180 lines of shell that orchestrates commands, plus
a small binary for the one part that has data
structures in it
The rewrite was correct about the problem and wrong about the boundary — the six hundred lines were not uniformly unsuitable for shell, and about eighty of them were. Splitting at the point where data structures appear left the orchestration in the language that orchestrates and moved only the part that was genuinely a program.