4rshil opened a new pull request, #1762: URL: https://github.com/apache/casbin/pull/1762
… writes Closes #1702. When a caller runs business-table writes and policy changes inside the same database transaction (e.g. via gorm-adapter), both must be atomic. Without a shared transaction the policy row gets committed even if the surrounding business operation rolls back, leaving permissions and application data out of sync. The two new tests demonstrate this contract using a mock adapter that models the commit/rollback boundary explicitly: - TestSharedTransactionRollback: a business error after AddGroupingPolicy must leave neither the policy nor the business row in the store. - TestSharedTransactionCommit: on success both the policy rules and the business row must land atomically, and the enforcer model must reflect the inherited permission immediately. *How to reproduce the problem (without a shared transaction)-* <img width="588" height="116" alt="Screenshot 2026-09-10 at 3 54 18 PM" src="https://github.com/user-attachments/assets/ac2a0176-aee2-46a9-a3e5-c807365830f3" /> <img width="557" height="178" alt="Screenshot 2026-09-10 at 3 54 27 PM" src="https://github.com/user-attachments/assets/9a707dcc-21ea-4f6a-9b39-c77aa46c6f82" /> *What the new tests cover* <img width="772" height="179" alt="Screenshot 2026-09-10 at 3 55 00 PM" src="https://github.com/user-attachments/assets/64935ace-9566-4754-b131-bce1eb9b6116" /> The mock models the commit/rollback boundary explicitly: writes land in an inflight buffer that only drains to the persisted map on Commit(). Rollback() discards it. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
