Fork me on GitHub
#cider
<
2024-04-22
>
fvides15:04:38

Hello I'm experiencing some weirdness with enrich-classpath + flowstorm. I've added flow-storm support to my project like this:

{:extra-paths ["dev" "test"]
   :extra-deps
   {,,,
    com.github.flow-storm/clojure {:mvn/version "1.11.2-4"}
    com.github.flow-storm/flow-storm-dbg {:mvn/version "3.15.2"}}

   ;; for disabling the official compiler
   :classpath-overrides {org.clojure/clojure nil}
   :jvm-opts ["-Dclojure.storm.instrumentEnable=true"
              "-Dclojure.storm.instrumentOnlyPrefixes=ingenieriauno.rsb."]}
If I disable enrich-classpath, the connection string is this:
/usr/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.0.0\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.45.0\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.10.0\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\]\"\]\}\}\} -M:dev:cider/nrepl
And at the REPL:
dev> *clojure-version*
{:major 1, :minor 11, :incremental 2, :qualifier "4"}
But if I enable enrich-classpath, the connection string is now:
;;  Startup: bash /home/fvides/.config/emacs/elpa/cider-1.13.1/clojure.sh /usr/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.0.0\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.45.0\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.10.0\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\]\"\]\}\}\} -M:dev:cider/nrepl
dev> *clojure-version*
{:major 1, :minor 11, :incremental 1, :qualifier nil}
dev> 
It looks like the clojure.sh scripts somehow affects the clojure version used, which causes problems using flow-storm (many thanks to @jpmonettas for his support).

jpmonettas16:04:56

looks related to the creation of a new classpath in this function https://github.com/clojure-emacs/enrich-classpath/blob/f3244ba4ff2282e5ac30a701fa38b0944d75eb00/tools.deps/src/cider/enrich_classpath/clojure.clj#L18 not taking into account this clojure classpath overrides

jpmonettas16:04:34

will take a deeper look at it in a couple of hours

vemv16:04:59

I'm pretty sure I fixed precisely that at some point

vemv16:04:03

Given you're not running cider-nrepl latest, maybe you're not running cider latest either? Or try to determine the enrich-cp version

jpmonettas16:04:32

I was running with 1.19.0

jpmonettas16:04:08

dang, but now I can't reproduce, with the latest

jpmonettas16:04:34

so I guess it is fixed

1
jpmonettas16:04:25

@UM4CBJVLZ can you try with the latest cider, it looks like it is fixed there

fvides16:04:09

Yes, will do and report here

jpmonettas16:04:22

This ended up being my startup log :

;; Connected to nREPL server - 
;; CIDER 1.14.0-snapshot (package: 20240421.1419), nREPL 1.1.1
;; Clojure 1.11.2-4, Java 17.0.10
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;;  Startup: bash /home/jmonetta/.emacs.d/elpa/cider-20240421.1419/clojure.sh /usr/local/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.1.1\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.47.0\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.10.0\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[flow-storm.nrepl.middleware/wrap-flow-storm\,refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\]\"\]\}\}\} -M:dev:cider/nrepl
So, Cider 1.14, it is wrapping the enrich script but it is also loading ClojureStorm 1.11.2-4

jpmonettas16:04:02

oh, but I run it again after changing some deps and now :

;; Connected to nREPL server - 
;; CIDER 1.14.0-snapshot (package: 20240421.1419), nREPL 1.1.1
;; Clojure 1.11.1, Java 17.0.10
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;;  Startup: bash /home/jmonetta/.emacs.d/elpa/cider-20240421.1419/clojure.sh /usr/local/bin/clojure -Sdeps \{\:deps\ \{nrepl/nrepl\ \{\:mvn/version\ \"1.1.1\"\}\ cider/cider-nrepl\ \{\:mvn/version\ \"0.47.0\"\}\ refactor-nrepl/refactor-nrepl\ \{\:mvn/version\ \"3.10.0\"\}\}\ \:aliases\ \{\:cider/nrepl\ \{\:main-opts\ \[\"-m\"\ \"nrepl.cmdline\"\ \"--middleware\"\ \"\[flow-storm.nrepl.middleware/wrap-flow-storm\,refactor-nrepl.middleware/wrap-refactor\,cider.nrepl/cider-middleware\]\"\]\}\}\} -M:dev:cider/nrepl
it loads Clojure 1.11.1 :thinking_face:

vemv16:04:17

The deftests above are easy to extend with real and isolated deps.edn files, feel free to contribute a repro

vemv16:04:29

(no fix expected - should be easy for me)

jpmonettas16:04:46

this dep is what seems to break it :

io.github.nubank/morse {:git/tag "v2023.10.06.02" :git/sha "88b5ff7"}
if I remove it it works

vemv16:04:07

ok, please contribute a full deps.edn in the issue tracker (or PR if you will)

jpmonettas16:04:06

sure, I'll take a deeper look after lunch and try to figure it out

fvides17:04:31

FWIW I also confirm that the bug is still present after updating to last cider version.

👍 1
jpmonettas17:04:31

I already figured out the issue, trying to fix it now

❤️ 2
jpmonettas17:04:24

it works for me after that change

jpmonettas17:04:03

the problem shows up when we use libs with git coordinates

jpmonettas17:04:39

added a small description of the issue on the PR desc

jpmonettas17:04:36

there are also some possibly problematic lines, like this https://github.com/clojure-emacs/enrich-classpath/blob/master/tools.deps/src/cider/enrich_classpath/clojure.clj#L123 which only add exclusions to maven libs

vemv17:04:36

Let's just say that clojure.clj is not my most favorite program 😄 it was simpler originally... Any fix with a repro that can be run in the existing test suite can be merged.

😅 1
jpmonettas17:04:17

I just updated the tests, testing to see it still works

jpmonettas17:04:54

and it didn't, some timed-out test is failing :thinking_face:

vemv18:04:19

what test are you running? Only focus on the tools.deps dir

jpmonettas18:04:30

was running everything, running only tools.deps now

👍 1
jpmonettas18:04:38

ok, done @U45T93RA6, amended the commit with the updated test

vemv18:04:38

Thanks for the PR! I've initiated its release process.

🙌 1
1
vemv20:04:48

We got a Clojars deployment whoopsie so we'll have to wait ~1d till it's all available (you can (setq cider-enrich-classpath nil) in the meantime)

vemv18:04:45

Enrich 1.19.2 is now released. CIDER latest (Git master or melpa unstable) already includes it

🙌 1
Akiz15:04:40

Hi there, is it possible to stop running print to repl?

vemv17:04:40

Hi 👋 You could remove the out middleware from cider-nrepl's default middleware stack - should work

Akiz17:04:00

Thanks, I’ll give it a try.