The payment attribution service I inherited was mostly special cases, and in the rewrite I deleted most of them.
The unmatched pile got bigger, not smaller.
Each branch looked like someone's panic fix. One truncated a reference field before comparing it. One ignored the payer name entirely when amount and timestamp lined up. One treated two same-day transfers as a single obligation. No comments, no tests, nothing written down anywhere.
That wasn't sloppiness: it was production behavior recorded the only way anyone had time to record it. Banks truncate fields. Payers retype references by hand, and a finance team will send one transfer covering two obligations. Every ugly conditional was a bug report from production that I never read.
The cost wasn't an outage, which is what made it slow to admit. A manual reconciliation queue kept growing, people matched payments by eye, and I kept insisting the new code was correct while the balances disagreed.
So before I touch inherited money code now, I stop asking what does this do, and I ask which of these conditions is a requirement I can't see. Every branch gets either a named real-world cause or a historical payment replayed through it to prove it's dead. If it has neither, it stays until it does.
Matching the money is the deliverable. Tidy code is not.
I write these up in longer form here: https://polycratia.com/c/8bee8ffe
I'd bet you have an ugly conditional sitting in your codebase that turned out to be load-bearing.