active-tx? broken on wrapped connections
bug
**Describe the bug**
I think a bug might have been introduced in the [commit](https://github.com/seancorfield/next-jdbc/commit/b0a640a10150713313af4f9dd9782b4b6f0dbf78) that fixed transactions on distinct connections.
The problem is that *active-tx* always contains a connection unwrapped by raw-connection , but the new version of active-tx? just looks for con in *active-tx* without unwrapping it.
One issue is that it's inconsistent with (contains? *active-tx* raw) checks in the implementation of Transactable , and from the library user's perspective it forces usage like for example (jdbc/active-tx? (#'jdbc-tx/raw-connection conn#)) because if the connection is wrapped, one cannot use the same arg for active-tx? and with-transaction.
I think active-tx? should unwrap the connection, but I'm not 100% sure how the implementation should look like, especially around possibly moving or making raw-connection a public function.
**To Reproduce**
If `conn` is wrapped, then the following returns false:
```
(jdbc/with-transaction [t conn]
(jdbc/active-tx? t))
```
The workaround is to switch to `(jdbc/active-tx? (#'jdbc-tx/raw-connection t))`
**Expected behavior**
☝️ should return true.
**Additional context**
https://clojurians.slack.com/archives/C1Q164V29/p1757494087556439?thread_ts=1720104756.702669&cid=C1Q164V29
关闭于 2025-09-11 1 条评论