Skip to content

Stop auto-wiring piggieback via :requires magic #443

Description

@bbatsov

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 — 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions