clojure-emacs / clojure-emacs/refactor-nrepl

Stop auto-wiring piggieback via :requires magic

Open
#443 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Clojure
Stars
262
Forks
68
PR merge metrics
No merged PRs in 30d

Description

Right now `refactor-nrepl.middleware/wrap-refactor` declares `#'cider.piggieback/wrap-cljs-repl` in its descriptor's `:requires` set whenever piggieback happens to be on the classpath. nREPL responds to this by warning that piggieback isn't in the middleware list and then injecting it automatically (`extended-descriptors` in `nrepl.middleware`, marked `TODO: stop adding missing deps in future versions.`).

This is exactly the kind of magic that cider-nrepl 0.59 set out to remove with [PR #971](https://github.com/clojure-emacs/cider-nrepl/pull/971) — they deprecated their own `requires-piggieback` helper to a no-op for the same reason. We're currently leaning on the deprecated nREPL behavior instead, just inlined locally.

Cleaner direction:

1. Delete `maybe-require-piggieback` and don't put piggieback into `:requires`. The `wrap-refactor` descriptor stays piggieback-free.
2. The only test that needs cljs is `refactor-nrepl.ns.resolve-missing-test`. Its fixture already passes piggieback to `default-handler`, but the rebinding happens after `session-fixture` has already started the server, so the binding doesn't take effect. The fixture currently "works" only because nREPL auto-injects piggieback. Restructure it to start the server inside the binding (or stop composing with the default `session-fixture` for this test).
3. Optional: inline `cider.nrepl.middleware.util.cljs/grab-cljs-env` inside `refactor-nrepl.ns.resolve-missing` so we no longer depend on cider-nrepl's `util/cljs` namespace at all.

Not urgent — the current setup works on cider-nrepl 0.59 and the test passes locally and in CI. But `extended-descriptors` is on borrowed time so it's worth doing before nREPL drops it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.