Nothing is easy everything is hard or how to feel better about how long this ticket is taking you
TL:DR don’t dive into “that should be easy” tasks without allowing for the fact they may not be easy
“Its just a string change”
Someone wanted to change the options in a dropdown select on our website. The options were helpfully collected in a localisation file similar to this one https://github.com/rails/rails/blob/main/activemodel/lib/active_model/locale/en.yml and so expected to be a simple single file change. Shockingly it was not.
But it wasn’t
It turns out the form select with those options was in a few different places. And some of those places did use the localisation file to pull the select options but some places did not and they were hardcoded.
So we updated the code so all the places this dropdown appeared pulled from the same list of options.
Then we discovered there were some tests which depended on one of the options being a specific value which was now gone. So we updated the tests.
Then it all worked.
IT SHOULDN’T BE THIS HARD… and yet it is
This is the go-to response to this kind of thing. “But if things were done properly it’d be easy to change.”
I’ve learned and re-learned that nothing is done “properly” or works as you’d expect. (unless you’re working alone and have just written it, then its an absolute masterpiece of simplistic sensible design).
I’ve stopped being discouraged by this and instead understand that it might be a simple change OR it might be many hours. The fact something looks easy doesn’t mean it is and I’ve stopped feeling bad about that.
POSTSCRIPT: ONE WEEK LATER
It got even worse then this. This change stopped users resetting their passwords!
A few days later we discovered user’s weren’t able to reset their password. This was because the values in the dropdown went into a column on the users table which then had ActiveRecord model validations on them to make sure we were only using approved values.
But of course all the old users still had the old values so the validation failed and they couldn’t update their account with a password_reset_token.
This validation had sat happily for 6 years without any of the values being changed!
And the validation was actually an effort to follow best practice and keep our user data clean and only contain approved values.
everything is hard, nothing is easy.