Does anyone here use assertions in anger in a web app? I sort of feel that frontend app that is jock-full with assertions and logs every assertion failure to a Sentry type service, would be much easier to get error-free. Almost to the point of needing significantly fewer unit tests, maybe. Is there any downsides to this approach? Do people do this?
Having worked on multiple systems that have done similar things to this, I'd fall on the side of no!
If you're not really careful the assertions will quickly obscure the actual logic (as does logging), a careless engineer can easily add a bad assertion and fill up your monitoring system, another careless engineer can write a complicated but broken assertion without any tests - they've all happened to me on multiple production systems.
Eiffel style pre and post conditions might be a solution as the assertions are kept away from the main code path in the method signatures - but at that point a modern statically typed language might give you more value (preferably with null safety and sum types).
My worst nightmare are abandoned assertions/errors. People logs them "just in case" and forget about them, years later you have huge volume in the logging system that nobody looks at.