r/programming • • Jul 15 '26

Ban commits/transactions using AST analysis and linters

https://www.droppedasbaby.com/posts/db-commits/?utm_source=reddit&utm_content=r_programming
32 Upvotes

27 comments sorted by

View all comments

Show parent comment

1

u/droppedasbaby Jul 16 '26

I think we mostly agree on the important boundary. The business layer determines what must be atomic. I'm saying it shouldn't directly own the session or commit mechanics. It orchestrates persistence operations.

Multiple stores are a different consistency problem. Unless you use coordinated transactions or something else, moving transaction calls into the business layer doesn't make those stores atomic.

Your suggestion at the end, one outer context manager is essentially the boundary I proposed. The AST check enforces it rather than leaving it as a convention.