Fork me on GitHub
#cider
<
2024-05-20
>
oyakushev05:05:41

The latest MELPA (non-stable) version of CIDER brings many improvements to the Inspector. Most of them are not user-facing but rather target the stability and consistency of the UX. • New customizable variable cider-inspector-max-nested-depth (defaults to 5) limits the number of levels printed in a nested collection in the inspector, similar to *clojure.core/*print-depth* . It also has an accompanying keybinding C in the inspector window. • Many small prettifications in the inspector are related to rendering Java classes, fields, and such. • Evaluation results that are too long to be usefully presented to the user are now truncated earlier in the pipeline which greatly improves Emacs responsiveness. This applies to showing results in the minibuffer and stepping through large data structures in the debugger. Note that CIDER has now dropped support for Clojure 1.9 and now targets Clojure 1.10 and onward. If you rely on that particular Clojure version, leave a comment. Please also share any possible breakages or changes that are significant to your workflow.

❤️ 6
vemv13:05:34

(melpa-unstable or Git master, that is)

oyakushev13:05:51

Melpa is melpa, I assume. The other one is usually referred to melpa stable.

vemv13:05:43

Normally I try to maximize clarity in communications as not everyone is familiar with melpa intricacies. For that matter, people keep re-discovering 'the bad way' (start the work day with a bug, etc) that most often what they want is to use Stable for most packages (or the equivalent Git tag)

👍 1
vemv13:05:45

Anyway, we have a stable release around the corner! In big part thanks to your awesome streak of contribs 🙌

❤️ 1
teodorlu13:05:46

Hi! I observed some surprising behavior. After installing https://github.com/magnars/kaocha-runner.el in my Emacs, M-x cider-test-run-project-tests appears to run my unit tests twice (or more than twice). I recorded a video of what I’m seeing. I believe the dark-green output on the bottom comes from CIDER, and the light-green output comes from kaocha-runner.el. Is this a bug? Should I report anyhwere?

vemv13:05:11

What happens if you run kaocha-runner-run-tests and the like? Seems its intended usage

teodorlu13:05:13

Then I just see the bright green text, and it finishes in about 100 ms (or less).

vemv14:05:59

Nice Maybe you have some extra setup code that bridges kaocha with cider? Like an advice-add I don't see anything in https://github.com/magnars/kaocha-runner.el/blob/master/kaocha-runner.el that would do something 'magical', fortunately

👀 1
teodorlu14:05:17

Here’s pure kaocha-runner.el:

teodorlu14:05:47

Note: I’m on Doom Emacs, I should have included that piece of information. Doom may be doing something weird.

GNU Emacs     v29.1            nil
Doom core     v3.0.0-pre       HEAD -> master 9620bb45 2024-04-18 14:20:48 -0400
Doom modules  v24.04.0-pre     HEAD -> master 9620bb45 2024-04-18 14:20:48 -0400

vemv14:05:49

I'd grep for kaocha within all your emacs files (doom and otherwise)

👍 1
teodorlu14:05:46

Within my Emacs config, this is all I’ve got:

Exported grep results:

config.el:194:  (kaocha-runner-run-all-tests)
config.el:506:(use-package! kaocha-runner)
packages.el:56:(package! kaocha-runner)
I’ll look into Doom’s Clojure layer — good idea.

vemv14:05:21

config.el:194:  (kaocha-runner-run-all-tests)
What's this one?

teodorlu14:05:49

It’s inside a function I use to run my tests from a REPL:

(defun teod-reload+test ()
  (interactive)
  (auto-revert-mode 1)
  (projectile-save-project-buffers)
  (cider-interactive-eval "(do (require 'clj-reload.core) (clj-reload.core/reload))")
  (kaocha-runner-run-all-tests)
  ;; (cider-test-run-project-tests nil)
  )

(map! :g "M-RET" #'teod-reload+test)

teodorlu14:05:09

I can’t find find any references to kaocha from within the Doom Emacs mode for Clojure. I looked through the code, didn’t see anything that looked weird. https://github.com/doomemacs/doomemacs/tree/9620bb45ac4cd7b0274c497b2d9d93c4ad9364ee/modules/lang/clojure/

vemv14:05:16

I ran out of ideas Maybe this scenario is familiar to @U07FCNURX?

vemv14:05:12

Quick idea, M-x describe-function cider-test-run-project-tests might reveal any present advice

💯 1
teodorlu14:05:05

I’m seeing this:

cider-test-run-project-tests is an interactive byte-compiled Lisp function in
'cider-test.el'.

(cider-test-run-project-tests PROMPT-FOR-FILTERS)

Run all tests defined in all project namespaces, loading these as needed.

If PROMPT-FOR-FILTERS is non-nil, prompt the user for a test selectors to
filter the tests with.
does that mean no advice present?

vemv14:05:20

Yeah looks normal -- Another idea, maybe it's related to Kaocha itself? The JVM side, that is I'm not too familiar with it, but perhaps there's a watcher or hook, something like that

teodorlu14:05:14

Perhaps — but then I’d have a hard time explaining why kaocha-runner.el-styled test output shows up in my Emacs!

vemv14:05:31

Does it happen if you never used kaocha-runner.el in the current emacs session?

vemv14:05:14

Also, feel free to paste here the nrepl logs: • restart emacs • (setq nrepl-log-messages t) • repro bug • grab contents of *nrepl-messages-<repl name>*

teodorlu14:05:32

Sorry, got distracted. I’ll try without using kaocha-runner.el and get the nrepl logs.

teodorlu15:05:37

> Does it happen if you never used kaocha-runner.el in the current emacs session? No.

👀 1
teodorlu15:05:52

1. I do not observe a double test run when I’ve never loaded kaocha-runner 2. I do not observe a double test run when I’ve loaded kaocha-runner but never used it 3. I do observe a double test run when I’ve run a kaocha-runner test run first (`M-x kaocha-runner-run-all-tests`), and then later run the tests with CIDER (`M-x cider-test-run-project-tests`) NREPL logs attached. They are a bit longer than they could be, I had to mess around a bit in order to reproduce the double test run. I’ll try make a shorter one next.

teodorlu15:05:30

Shorter reproduction. I did the following: 1. Turned on NREPL logs 2. Ran tests with kaocha-runner once 3. Ran tests with cider-test once

vemv15:05:20

Thanks! I'll take a look later today My theory is that Kaocha's cider-nrepl-request:eval never completes (this is a usual characteristic of nrepl requests - they keep waiting for stdout indefinitely) and captures output triggered by later cider-test-run-project-tests calls

❤️ 1
👍 1
teodorlu15:05:53

Awesome! And thanks for CIDER; CIDER is still awesome. I’m happy try more things to reproduce if that’s helpful.

cider 1
magnars18:05:38

That is interesting. It's almost like asynchronous callback based code is hard to get right. 😅 I wonder why it never completes, tho. One solution would be to add a timeout, I guess, but that would only be treating symptoms.

magnars19:05:21

Even adding a timeout is a problem, given I don't know how long your tests are supposed to run. From what I can tell judging by this thread, the different cider-nrepl-requests are receiving each others callbacks, is that right? In that case, how do other libs work around this issue?

1
vemv10:05:12

Thanks! I haven't had the proper chance to take a look at the whole thing again, sorry

teodorlu15:05:02

I strongly agree with this statement CIDER gave me when I just connected to a REPL! :hugging_face:

💪 3
vemv15:05:22

If it was easy, everyone would do it 🔥

❤️ 2
emacs-spin 2
clojure-spin 2
🔥 2
mjhika18:05:07

"I ask not for a lighter burden, but for broader shoulders." -Unknown

❤️ 2