A python code base where the way it was built is that the function names contained metadata about how it executed.
for example, a function name called:
extract_metadata
or
run_procedure
would be evaluated, the system would go through the python APIs and get the name of the function and eval each part splitting on the `_` against a set of meta-functions.
The system was big, 10s of modules, 100k`s of LoC, many many many functions. Nobody understood it or how to make a change to it. Simply renaming a function meant that the execution path in the program was different (since function names were part of the API at runtime !).
Since the output of this system was predictable (a JSON file) based in the input (~30 parameters), I ended up running integration tests of expected JSON output vs input in the system and then I rewrote the system having the integration tests passing!
The final system I built is still in the company which I left ~4 years ago used by thousands of people! Certainly proud of fixing that mess.