sql

Michael Gardner 2023-09-15T22:24:31.659989Z

is it intentional that next.jdbc/with-transaction only supports literal maps for opts? When I try to pass a var, I get this: > opts - failed: map? at: [:binding :opts] spec: :next.jdbc.specs/opts-map

seancorfield 2023-09-15T22:26:27.587909Z

Try it without instrumentation. I think that may just be a bug in the spec.

Michael Gardner 2023-09-15T22:26:59.996489Z

afaik I'm not instrumenting 🤷

seancorfield 2023-09-15T22:27:34.284409Z

Yes, you are. That spec check only happens if you have instrumentation enabled.

Michael Gardner 2023-09-15T22:28:09.971539Z

I know, but there's nowhere in the code base that should be instrumenting right now. Going to have to track down what's doing that

seancorfield 2023-09-15T22:31:58.535609Z

I've had a couple of reports over the years that a few of the specs in next.jdbc are overly strict. You're the first one to report with-transaction's spec tho'...

Michael Gardner 2023-09-15T22:35:57.294229Z

wait, doesn't Clojure itself now check macro specs automatically?

seancorfield 2023-09-15T22:36:17.273699Z

Only core stuff. Because of clojure.core.specs.

seancorfield 2023-09-15T22:40:32.833069Z

Hmm, maybe you're right... I'm... surprised by that... I thought you needed to explicitly call instrument to turn on checking but it does look like macro expansion checks some level of fdef if it is present.

seancorfield 2023-09-15T22:43:05.977009Z

Yup, confirmed!

Clojure 1.12.0-alpha4
user=> (require '[clojure.spec.alpha :as s])
nil
user=> (s/fdef foo :args (s/cat :a int?))
user/foo
user=> (defmacro foo [a] `(* ~a ~a))
#'user/foo
user=> (foo 1)
1
user=> (foo "2")
Syntax error macroexpanding user/foo at (REPL:1:1).
"2" - failed: int? at: [:a]
user=> (let [x 1] (foo a))
Syntax error macroexpanding user/foo at (REPL:1:12).
a - failed: int? at: [:a]
user=>

seancorfield 2023-09-15T22:43:09.148649Z

TIL...

seancorfield 2023-09-15T22:43:37.131159Z

OK, I'll open a bug against next.jdbc to fix that -- and I'll double-check any other macros in there that have specs...

Michael Gardner 2023-09-15T22:43:45.576789Z

that's a TIL for me too. And thank you!

seancorfield 2023-09-15T22:55:58.634389Z

https://github.com/seancorfield/next-jdbc/issues/257

seancorfield 2023-09-15T23:07:08.956749Z

OK, fix is in https://clojars.org/com.github.seancorfield/next.jdbc/versions/1.3.999-SNAPSHOT (or you can depend on the develop branch via git deps).

1
Michael Gardner 2023-09-15T23:07:46.643559Z

awesome, thanks for the super-quick turnaround

seancorfield 2023-09-15T23:08:34.565979Z

I'm embarrassed by both the bug and my misdiagnosis of your issue 😕

Michael Gardner 2023-09-15T23:09:03.728349Z

no worries! Just glad I wasn't going crazy