The Scoped→Singleton DI bug your AI just suggested (and how to catch it)
Of all the bugs that ship to production silently, the captured-dependency lifetime bug is one of the most expensive. It compiles. It passes your tests. It runs fine in dev. Then in production, under load, it starts corrupting data across requests. And AI assistants suggest it constantly. Here's why — and the one Cursor rule that catches it before merge.
The bug, in 30 lines
``
You ask Cursor to add caching to OrderService. It gives you this:









