nrepl

carlos hernandez 2025-12-16T13:44:40.541049Z

Hey! I'm using nrepl config to set system-wide default middleware for REPL metrics collection in our deps.edn projects. However, it gets wiped out whenever any tool passes --middleware on the CLI (which CIDER, Calva, etc. all do). This happens because of standard clojure merge semantics - CLI args completely replace the config's :middleware vector. Is there a way for me to deploy company-wide middleware?

Michael Weisser 2025-12-18T22:07:49.370879Z

Hi @bozhidar! We would be super grateful if you could take a look at the PR ☝️. It would unblock some work here at Nubank. 🙇 Can you let us know what you think when you find the time?

bozhidar 2025-12-19T06:39:59.747319Z

@michael.weisser Sure!

1
carlos hernandez 2025-12-17T20:03:33.366339Z

I might have missed some nrepl feature that solves this problem. But in case not, I published this https://github.com/nrepl/nrepl/pull/402 reviewplease

carlos hernandez 2025-12-24T12:58:40.542759Z

Hey @bozhidar, Thank you for your comments on the PR. I’ve addressed all the feedback provided. Could you please take another look when you have a moment? Let me know if there's anything else that needs attention. Thanks!

bozhidar 2025-12-24T14:46:17.194279Z

Will do!

carlos hernandez 2026-01-07T23:14:40.579229Z

Thanks @bozhidar, I saw now it is merged. How can we do the release? I saw the docs and it said I could tag a commit in master branch, but I didn't have permissions.

bozhidar 2026-01-08T05:52:48.018489Z

I’ll do a beta release later today.

2025-12-16T20:38:01.302949Z

I have a ns declarion like this:

(ns
 inference-smollm2
  (:require
   [uncomplicate.diamond.internal.cudnn.factory :refer [cudnn-factory]]
   
   ))
and internaly this does some loading of native libraries. If this fails for some reason, evaluating the ns expressions "hides" the real root cause, which is: (so Calva cannot show it. The nrepl communication does not have it)
; Execution error (UnsatisfiedLinkError) at org.jocl.LibInitializer/initNativeLibrary (LibInitializer.java:74).
; Could not initialize native OpenCL library. Implementation library could not be loaded
It shows instead an error like:
; Execution error at  (info.clj:9).
; No namespace: uncomplicate.clojurecl.internal.constants

2025-12-16T20:39:41.307019Z

Loading the file via load-file or clj xxx shows the correct exception:

Could not load libOpenCL.so, error libOpenCL.so: cannot open shared object file: No such file or directory
Execution error (UnsatisfiedLinkError) at org.jocl.LibInitializer/initNativeLibrary (LibInitializer.java:74).
Could not initialize native OpenCL library. Implementation library could not be loaded
I assume that the exception (= UnsatisfiedLinkError) happens during compilation of he ns macro.

2025-12-16T20:40:38.726789Z

is this a bug in nrepl ?

2025-12-16T20:42:13.534269Z

I have seen this before, working with native libraries and remember having been surprised by just seeing an exception of:

; No namespace: uncomplicate.clojurecl.internal.constants

oyakushev 2025-12-29T17:07:55.735359Z

I've tried it with another dependency that uses native libraries and could not reproduce (meaning that I receive UnsatisfiedLinkError from CIDER). Would you be able to make a small reproducer? I tried adding uncomplicate/deep-diamond {:mvn/version "0.42.0"} to dependencies but it fails to download some transitive ones.

2025-12-29T17:12:54.437769Z

I think it happens only when a macro tries to load the native dependency. So to reproduce it, you need a macro which tries this, and make sure the native library is not present

oyakushev 2025-12-29T17:13:10.311409Z

Gotta try it now

oyakushev 2025-12-29T17:13:51.220899Z

Wait, is the macro supposed to be in one of the internal namespaces?

2025-12-29T17:22:54.536799Z

Internal ? deep diamond loads as far as I know some native libs via macros. I get to these error usually when evaluating my 'ns' declaration which 'requires' some deep diamond ns

oyakushev 2025-12-29T17:25:55.672199Z

I've made a reproducer that triggers the loading of a native lib directly as the top-level form in the namespace. I'm not sure if doing it "via macros" would be any different.

oyakushev 2025-12-29T17:26:19.057959Z

OK, I think I did it via a macro now, if I understand correctly, and I still receive a clear (UnsatisfiedLinkError) from nREPL

2025-12-29T17:30:36.624019Z

Ok. So deep diamond does something special....which triggers it. I play quite a bit with the setup of my native libs, and get it from time again, when I mess up.

2025-12-29T17:33:31.789179Z

Make a 'reproducer' is tricky, as it requires (wrong) native setup. Maybe using Docker