Skip to content

Load introspection ns once per session on the piggieback path - #64

Merged
bbatsov merged 1 commit into
masterfrom
piggieback-loading-improvements
Jul 18, 2026
Merged

Load introspection ns once per session on the piggieback path#64
bbatsov merged 1 commit into
masterfrom
piggieback-loading-improvements

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 18, 2026

Copy link
Copy Markdown
Member

Three related changes to the dynamic-completion loading/eval path (items toward 0.8.0):

  • Once-per-session loading on the piggieback/cljs.repl path. It re-probed the runtime with goog.getObjectByName on every completion request; now it caches the loaded state per session for node (whose runtime persists), matching what goog.require emitted for every complete request #6 did for shadow. Browser runtimes keep re-checking on each request, since a page reload drops the loaded namespace.

  • Fix a latent ClassCastException. The per-session loaded flag was stored under a keyword key. nREPL's session middleware pushes every session-map key as a thread binding and casts keys to Var, so a keyword key throws on the next message. This bit the piggieback path (caught by the real-nREPL node integration test) and was also latent in the shadow path's flag from goog.require emitted for every complete request #6 - both now use a Var key. The shadow integration test never caught it because it drives complete-for-nrepl with a plain atom, not a real session.

  • Silence a spurious warning. eval-cljs doesn't honor the :warnings opt, so the first dynamic completion logged undeclared Var ...property-names-and-types. Bind cljs.analyzer/*cljs-warnings* around the eval instead.

…ssion key

Three related changes to the dynamic-completion loading/eval path:

- The piggieback/cljs.repl path re-probed the runtime with `goog.getObjectByName`
  on every completion request. Cache the loaded state once per session for node
  (whose runtime persists), matching the shadow path. Browser runtimes keep
  re-checking, since a page reload drops the loaded namespace.

- Store that per-session flag under a Var key, not a keyword. nREPL's session
  middleware pushes every session-map key as a thread binding and casts keys to
  Var, so a keyword key throws a ClassCastException on the next message. This
  also fixes the same latent issue in the shadow path's flag.

- Bind `cljs.analyzer/*cljs-warnings*` around the completion eval to silence the
  spurious `undeclared Var ...property-names-and-types` warning (the :warnings
  eval opt isn't honored by `eval-cljs`).
@bbatsov
bbatsov force-pushed the piggieback-loading-improvements branch from ee6be23 to 5873a9d Compare July 18, 2026 17:20
@bbatsov
bbatsov merged commit c7006a9 into master Jul 18, 2026
8 of 9 checks passed
@bbatsov
bbatsov deleted the piggieback-loading-improvements branch July 18, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant