mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-07 16:18:29 +08:00
- user_repo.create(): keep the TxFromContext fast path, but restore tolerance for dbent.ErrTxStarted in the self-owned-transaction branch. ent's Client.Tx only inspects the driver type, so a repository built from a tx-bound client (client-injected transactions, e.g. the integration fixture testEntTx + tx.Client()) hits ErrTxStarted; reuse that client instead of failing. Fixes the two red integration tests in allowed_groups_contract_integration_test.go. - createUserAndClaimInvitation: roll back via defer (matching the OAuth registration precedent) so a panic inside the transaction cannot leak the connection. - settingRepoStub: guard call counters and state with a mutex; the new concurrency regression test exercises it from multiple goroutines and the unsynchronized counters were flagged by -race.