Scientist: A Ruby library for carefully refactoring critical paths
github.com
github.com
Example in the transferring a bank balance, you have some storage DB you interact with, but that is an abstraction and when you run the dry run of the new code you can have an implementation that just does verification on the data from the real implementation.
Anyways, it does take discipline and effort, but you can still safely make changes in this manner.
I used my implementation to replace number parsing in my work project: https://kodare.net/2021/04/04/safe_number_parsing.html