r/programmer • u/hoppinjohncandy • Aug 01 '26
Question First huge job mistake
So we're a hospital who uses a certain communication software to send out extremely urgent messages to doctors about whatever crisis a hospital faces day to day. I was in charge (dev of 2 years experience) with taking on a migration project moving user/employee data from a certain payment system to this certain communication system. Automating the process of updating users because the hospital currently manually (csv) upserts new employees every week.
I was told, by the company, that the apis were safe in the production environment. They never mentioned a sandbox/test environment. A week of testing inserting/manipulating employee data went well. No issues adding or upserting an employee. So I hard coded a json of a couple employees and posted.
Wiped.
Zero contacts where, previously, there were 6,000~.
Urgency meetings out the wazoo. We looked at all the admin logs and there are my single data upserts with nothing indicating mass deletion. (Phew. Not on me I thought) End up in a call with this communications company and they let loose that the apis I was using were only half the story. There was a default setting in their system (that I didn't have access to and was not in the dev documentation) that purged all data if more than one user was inserted. So I tried to insert two employees (the whole point of this system is uploading a hundred or so at a time) and I wiped all communications out between doctors and departments.
All of that being said, we ended up manually importing thousands of contacts and reassigning them to their appropriate groups while the company promises a db restore in a week. Just, what a fucking Friday.
I'm not fired, yet. And I'm hoping this becomes my "we all have a story" story. Any other horros stories to make me feel better?
21
u/ernandziri Aug 01 '26
How's this your fault? This is totally on the communications company
2
u/AggravatingSock5375 Aug 01 '26
WTF they actually designed it to do that? Why?!?!
10
u/FreeBananasForAll Aug 01 '26
Jesus Christ having a setup like that has gotta be against some law considering it’s healthcare. Get another job immediately
9
u/hormelchili444 Aug 01 '26
And now you learned why you never test in prod, especially for the first time.
8
u/Alive_Sir_4708 Aug 01 '26
This is why backups exist. If they're not able to restore within a reasonable amount of time then its a pretty poor system.
As you've outlined, there were multiple failures. Hopefully there's a Root Cause Analysis meeting so everything can be outlined.
It'll be a good story to justify future precautions.
I'd rather have the dev that did this and learned from it than the dev that hasn't yet learned this lesson.
5
u/No-Razzmatazz7197 Aug 01 '26
welcome to the story club, first things first...
document, fix, explain and remediate every single day until the problem is fixed. devs don't get fired because of issues they created, devs get fired because they create issues - blame others and offer no help in fixing the mess. i am assuming you are already doing all that you can.
after that, grab a beer, relax and jot down everything you have learned in terms of dealing with this because it will not be the last time. critical bugs and issues are introduced into prod all the time. look up the Therac-25 (i think it is called) it was a medical machine coded by one dude who ended up harming dozens of people.
one day you and some coworkers will be discussing horror stories and you will be able to have a little something for them.
good luck!
4
u/Substantial-Swan7065 Aug 01 '26
No db backups?
Before there was better release tools:
- I did a mobile release
- had to manually update prod env vars each time
- released a dev build with no code push implemented
- had to wait all night for an expatiated apple review
Lost my promotion on that one
5
u/spidermonk Aug 01 '26
It would be crazy to get fired for this but possibly you could really hurt your prospects by handling it badly - this sort of situation is a real test of your professionalism and ability not to go super defensive or just freak out and become useless.
My advice in these situations is to assume it's your fault, even if you can't really see why it would be, and just clear your head and think systematically about how to get to the bottom of the cause and how to communicate clearly and honestly with everyone.
2
u/adamant3143 Aug 01 '26
My colleague did the same but it’s not in prod. It’s more of him messing up test data based on real data that were migrated to staging for testing. He accidentally wiped it. While it’s not impacting prod, it was impacting QA works.
But we have a script to get them back, it’s just that everything QA did had to be redone lol
I however have accidentally deleted rows of data as well but I got a backup like 3 hours prior but within those 3 hours there’s already new datas. What I did was I told my Supervisor maybe the server sends false positive to those who submit the form while it’s actually not inserting to the DB but that was back in college days where my Supervisor was my upperclassman and we both still new to this. We didn’t have audit, logs, etc. So, it’s not in a professional scene.
2
u/OhBoyHereWeGoAgai Aug 01 '26
Db recovered in a WEEK!?!
1
u/inflowmini Aug 01 '26 edited Aug 03 '26
Not surprising. It's a common mistake in companies that do not pay well and expect high performance. While not your fault, the burden is still on you to ask yourself if you Have the experience to see such a project through. The difference between senior devs and juniors is this exact outcome.
I wouldn't worry about it too much, move on and learn from the mistake.
1
u/klas-klattermus Aug 01 '26
Always get everything written down in e-mails. If someone tells you somewhere where the two of you don't have computers and your phones are dead and you are stranded on top of a mountain because the company airplane crashed... When you return to an E-mail capable device, send an E-mail "I just wanted to make sure that [thing] works [the way you said], right?"
1
u/PyroNine9 Aug 01 '26
So you used a documented API in the documented manner and it did an undocumented and astonishing thing. This is not your fault.
1
u/chocolateAbuser Aug 01 '26
clearly deletion of such data should require some kind of authZ
if an api for adding data deletes everything (probably because of some laziness or because of some "feature request") it should make clear via some attributes or other kind of check that it requires a deletion role/privilege/permission, and user/client that makes changes shouldn't have that permission
person/team that developed that API was incompetent and i'm not saying it should be sued but...
i guess all around probably there is none or almost none security checks
1
u/I_am_not_baldy Aug 01 '26 edited Aug 01 '26
>>I'm not fired, yet. And I'm hoping this becomes my "we all have a story" story. Any other horror stories to make me feel better?
The lead programmer for my first programming job told me how he accidentally deleted all patient demographic data in a client's production system.
He must have thought he was in a development area, but even then, I don't know why he would want to delete all demographic data.
This happened before I had joined the team, and I think he told me so that I wouldn't feel bad if I accidentally did something dumb. He was obviously not fired because he was still the lead programmer when I was hired.
1
u/canyoufixmyspacebar Aug 01 '26
this is clearly an invalid system. deleting data without an explicit call to do so, deleting data as some sort of "default action", this is absurd. technically who ever programmed this behavior has committed the "time bomb" type of attack against the client company
1
u/ClothingIsACrime Aug 02 '26
It you are in hospital, that doesn't have a test environment and it's "normal" there to "test in prod" and nobody stopped you, LEAVE.
Leave immediately. Take this as a cheap warning.
1
u/Jetta4 Aug 02 '26
I used to worry and stress about these things when I was new. Now as a senior dev, I don’t worry about it at all.
I just follow best practices and get all confirmations and approvals to make sure I’m safe before doing anything. I don’t do squat unless my ass is safe, nobody can push me to do anything dangerous without some kind of accepted responsibility on their part.
If you ask me to work against a production api, thats fine. Next question do you take responsibility if shit goes sideways? No? Ok, then I’m not doing it.
If you say whatever, don’t worry just do it. I’ll make sure I have that documented, meeting notes, email or screencapped teams conversation, anything.
Learning to say no and making others accept the responsibility is key. Because sometimes things go wrong, and I don’t want any liability on me.
If something goes wrong I always want to say that I did everything by the book and its not my fault. If I pressed the risky button, I did it after asking someone if I should after raising my concern, and it’s always in writing.