mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-21 10:13:01 +00:00
No generic CRUD action anywhere: real business - a cross-table order placement, a payment transition - is what the contract surface has to carry, and the actions cover only the single-table case that a real application outgrows immediately. The transaction is Orm.Transaction(), not the Begin/defer shape that app/admin/service/sys_role.go and three other files use. That shape commits a half-written transaction when the body panics, because the deferred check reads err, which a panic leaves nil. The payment transition guards concurrency through the update itself - WHERE status = 'pending' plus RowsAffected - rather than a read followed by a write. The tests cover both rollback paths, because they fail differently: a mid-transaction error returns, a panic unwinds - and the second is what tells Orm.Transaction() apart from the shape it replaces. The concurrency test pins the pool to one writer so sqlite's own single-writer semantics cannot stand in for the guard being tested. The data-scope tests assert the fail-closed direction too: an unrecognised scope must return no rows rather than every row. Claude-Session: https://claude.ai/code/session_01HPTAw8b8tAdFNFn8rKdPYx