You also definitely shouldn't be using String non-monotonic UUIDs for primary keys in a database, like, literally ever, but what the fuck do I know, I just do databases for a living, I'm not the all-knowing GPT code wizard.
i'm not doing databases for living but the idea of stringifying a perfectly cromulent unique number in order to store it in the database comes as slightly weird to me.
If you’re using a new-to-you ORM, and you don’t ever check the docs to see the basic primary key syntax… it’s SQLAchemy, it’s well documented and there’s tons of prior art.
Also I don’t understand their business case but if a user has a primary key, a unique user ID, and a unique customer ID, then all three of those uniquely identify the customer. (Weird, but there are some plausible explanations.) But then why would you need both the user ID and the customer ID in the subscription table is this some stripe thing I don’t understand or are they just bad at this?
Yes, it's some Stripe thing. Stripe requires you to create a customer to be able to vault payment methods and make charges. However it's possible that not all users in their product require this functionality.
UUIDs make great primary keys in some applications. If you generated 100 trillion UUID4s, there’s about a 1 in a billion chance of finding a duplicate. Thats usually good enough for my databases.
The issue here was that they used a single UUID instead of generating a new one for each record.
There are countless issues here. They didn't do exception handling, they used a string to store their UUIDs (even if this was a DB constraint, you use sqlalchemy.Uuid and let the ORM and DB handle the translation), and as the person you're replying to stressed, they're using non-monotonic UUIDs. Also if you have a unique user_id and you're never exposing your primary keys, you don't need to get fancy, just let the ORM handle it with auto-incrementing, for most use cases. And so many other tragic things about this one tiny blog post.
tl;dr if you're going to copy code you don't understand, copy it from the docs, not from everything in the kitchen thrown into a blender.
Honestly, the evident plethora of poor programming practices is the least notable thing about all this; using roided autocomplete to cut corners was never going to be a well calculated decision, it's always the cherry on top of a shit-cake.
the upside: we can now watch "disruptive startups" go through the aquire funding -> slapdash development -> catastrophic failure -> postmortem cycle at breakneck speeds
The original post was removed, hence the archive link.
HN figures the real issue was the lack of testing/monitoring, not specifically the use of ChatGPT. But the kind of person who's ok with letting spicy autocomplete write their customer acquisition code is probably not the kind of person knowing how to test and monitor.
I actually tried letting ChatGPT-4o write some tests the other day.
Easily 50% of the tests were wrong. They ignored DB uniqueness constrains or even datatypes. In a few cases, they just hallucinated field names that didn't exist.
I ended up spending just as much time cleaning up the cruft as writing them. I could easily see someone just starting out letting the code go through.
Now that's the kind of bad hot take I read awful.systems for! Let's all call ourselves "engineers" but write no documents but emoji laden jokes, and produce no work except for the copy-pasted excreta from a chatbot!
Even with inadequate tests, inadequate monitoring, and an inadequate integration testing environment; how did it not go like this:
"Hmm the web server appears to be working, but maybe the database is making an oopsie we did just do that whole stupid db migration without a gradual ramp up"
"Oh hey here's an idea, why don't we make sure error messages from the database are logged maybe it's silently crying out in pain right now :D"
friend of mine happened to dm me this the other day, and here are my reactions from chat, verbatim (albeit timestamps removed)
fucking sfba method, man
so many things in that post, man, god
linear extrapolation for “lost sales”, doing the double presumption of both constant uptake and that everyone would definitely have been a customer
“whatever you’re thinking, double it” bayfucker advice
and just …. everything
fucking hell
and the code. fuck me the fucking code. it's always "nice" to see just how very very clever all the yc fuckers are. but christ does it give me feelings.
but they gotta go fast! if they're barely approaching redshift, are they even agile?!
It’s okay to copy/paste your basic model structure for SQLAlchemy classes, but copy and paste from the SQLAlchemy docs. Sweet suffering stack overflow, did nobody even look at the docs ever, or did they only trust ChatGPT? SQLAlchemy‘s simple for basic use cases.
Also here is such a nutshell of everything wrong with YC: jackhole prompt fondlers with no tests, no paying customers, who turn on the most important new feature in prod at the end of the day (jesus wept), and yet with all that clown show,
We had eight ECS tasks on AWS, all running five instances of our backend (overkill, yes we know, but to be fair we had AWS credits).
Oh yeah I entirely agree about copying - hell, lord knows how much interlang tools suck, I entirely get copycloning some defs best-match
But yeah indeed they super fucked up :D
With a nice cushy bit of “free” to make the problem go away. Whereas recently a fedi admin got their their instance turboscraped and were stressing about a sub-10k bill that would’ve probably killed their entirely service. My contempt for these bayfucker dickweeds knows no bound.