Earlier quoted context omitted.
Not all functions are refactorable. A 'purely hypothetical' scenario: a numeric routine of several klocs on length, that takes in 20 parameters with 1-3 letter obscure variable names, was written 30 years ago in fortran, was f2c:d 20 years ago into c and has been doing it's 'stuff' correctly ever since somewhere in the bottom of mission critical code in a codebase of millions of lines. Commercial codebase. Only a han…
The scenario you describe is a disaster waiting to happen. Refactor it, preferably yesterday - but make a "shadow deploy". For each set of input / output parameters run both functions and compare them. If they differ, use the old one and go back to figuring out where it went wrong. After some time you can be quite sure that the new clean function works as it should - then you just switch.
http://www.amazon.co.uk/Working-Effectively-Legacy-Michael-F...