cljdoc

Sam Ritchie 2023-01-23T18:31:17.121499Z

can anyone help me see why I’m getting “We could not find the git repository for your project or link a commit to this release. API docs work regardless of this but consider https://github.com/cljdoc/cljdoc/blob/master/doc/userguide/for-library-authors.adoc#git-sources.” on https://cljdoc.org/builds/65430, for #emmy? obviously something is wrong, since clojars also agrees: https://clojars.org/sicmutils

Sam Ritchie 2023-01-23T18:32:01.908409Z

but the scm entry in the pom.xml seems okay? https://gist.github.com/sritchie/226dc7d2e57458e2f84c30ef7e98ae92

Sam Ritchie 2023-01-23T18:34:13.091539Z

hmm, analysis failed too… looks like cljdoc’s analyzer is taking the clj path in the forked macro: https://github.com/sicmutils/sicmutils/blob/main/src/sicmutils/util/def.cljc#L139

lread 2023-01-23T19:21:27.899509Z

Sure @sritchie09, I can take a peek!

lread 2023-01-23T19:28:28.977059Z

If I look https://repo.clojars.org/sicmutils/sicmutils/0.23.0/sicmutils-0.23.0.pom, I see the following for scm config:

<scm>
    <tag>v0.23.0</tag>
  </scm>
The tag looks good, I see it on the https://github.com/sicmutils/sicmutils/tags, but the other entries are missing from scm , which means cljdoc (and clojars for that matter) won't know where your sources are.

1️⃣ 1
lread 2023-01-23T19:30:48.841939Z

Oh right.. 2nd problem API analysis failure... please hold...

2️⃣ 1
lread 2023-01-23T19:33:59.023169Z

Ok... Clojure analysis is passing. It is ClojureScript analysis that is failing...

2️⃣ 1
lread 2023-01-23T19:36:45.438439Z

Huh, you are attempting import-vars-ish-ness for cljs. At one point, I did have an import-vars version working for cljs. It is buried in the history of rewrite-cljc. But as part of that effort I also updated cljdoc to understand such manipulations for cljs.

2️⃣ 1
lread 2023-01-23T19:38:17.296619Z

(personally, I abandoned load time import-vars due to too many oddities, I got fed up and went for code generation instead)

2️⃣ 1
lread 2023-01-23T19:47:03.826379Z

@sritchie09 how do you run our cljs unit tests for sicmutils?

2️⃣ 1
lread 2023-01-23T19:50:06.492769Z

I'd like to see stuff in cljs passing/working before taking a deeper peek into what might be happening with cljdoc here.

❤️ 1
2️⃣ 1
lread 2023-01-23T20:00:15.836899Z

Back to problem 1, https://github.com/sicmutils/sicmutils/blob/02e7a6edaab345e5c6a516f663ecaeb6507cda26/build.clj#L42. That's fine if you also have a pom.xml that specifies the other scm values, but you don't seem to have that.

1️⃣ 1
Sam Ritchie 2023-01-23T20:03:18.920409Z

“Npm run test “ will do it!

👍 1
Sam Ritchie 2023-01-23T20:16:26.017369Z

Ohhh @lee nice catch. Locally weirdly the entries from my Pom.xml template were making it in, vs getting bumped by what you found. That would have taken me forever to find, thank you!

lread 2023-01-23T20:17:17.927409Z

My pleasure. That's some extensive test suite @sritchie09, it is still running...

Sam Ritchie 2023-01-23T20:17:34.968419Z

Close to 7300 and counting

Sam Ritchie 2023-01-23T20:17:58.127549Z

Lots of generative tests too… it is a little nuts for sure

lread 2023-01-23T20:18:05.624559Z

Ah done after 11m!

lread 2023-01-23T20:18:35.382369Z

One person's crazy, is another person's thorough! simple_smile

😉 1
lread 2023-01-23T20:19:36.009609Z

So... dunno yet about the cljs failure. Can take a peek. One diff is that cljdoc uses the plain old ClojureScript compiler, and your test runs under shadow-cljs.

Sam Ritchie 2023-01-23T20:19:37.590399Z

I’m happy to rewrite that macro- I really just want (def something somewhereelse.something) in cljs, nothing fancier

lread 2023-01-23T20:20:23.310849Z

Yeah, it seems so simple, I remember. simple_smile

Sam Ritchie 2023-01-23T20:21:00.743429Z

Haha I definitely found other trip reports of clojurists dashed against these surprisingly rocky shores, just like us

lread 2023-01-23T20:21:39.389439Z

The parenthe-seas can be rough!

😂 1
Sam Ritchie 2023-01-23T20:22:21.275049Z

Woah, mind blown

😂 1
lread 2023-01-23T20:24:53.792819Z

Not sure if it is agreeable to you, but you could https://github.com/cljdoc/cljdoc/blob/master/doc/userguide/for-library-authors.adoc#api-languages.

Sam Ritchie 2023-01-23T20:28:01.115699Z

That’s fine, the APIs are the same so I’ll turn it off for now, fix the scm entry and publish an incremental version

Sam Ritchie 2023-01-23T20:28:10.752419Z

Do you want me to file a ticket with the build etc,

Sam Ritchie 2023-01-23T20:28:12.783609Z

?

lread 2023-01-23T20:32:27.594939Z

You can do it in your https://github.com/sicmutils/sicmutils/blob/main/doc/cljdoc.edn, you have to fix that pom anyway, so would get will get picked in next release.

lread 2023-01-23T20:34:31.915669Z

I don't know much about how shadow-cljs works but I'm thinking that might be the difference. If I try to run sicmutils under plain old (outside cljdoc) ClojureScript I get a similar error.

Sam Ritchie 2023-01-23T20:35:34.107799Z

Okay I can use that info to make a small repro. What command do you use to run it with vanilla cljs?

lread 2023-01-23T20:38:57.867529Z

Lemme get back to you on that. I'm just pasting from other projects to explore. Have to knock the rust off my cljs knowledge, it has been a while!

Sam Ritchie 2023-01-23T20:39:33.502189Z

No problem

lread 2023-01-23T20:57:34.155109Z

Ok, this seems like a maybe a simple way to trigger the issue in sicmutils with plain old ClojureScript: First, I added a :lee-cljs alias to sicmutils deps.edn

:lee-cljs
  {:extra-deps {org.clojure/clojurescript {:mvn/version "1.11.60"}}}
Then I fired up a REPL using this alias:
❯ clj -M:lee-cljs -m cljs.main --repl-env node 
ClojureScript 1.11.60
Then I required the namespace I saw failing on cljdoc to see a similar error:
❯ clj -M:lee-cljs -m cljs.main --repl-env node
ClojureScript 1.11.60
cljs.user=> (require '[pattern.rule :as rule])
Unexpected error (AssertionError) macroexpanding cljs.core/resolve at (def.cljc:140:14).
Assert failed: Argument to resolve must be a quoted symbol
(core/and (seq? quoted-sym) (= (quote quote) (first quoted-sym)))
Very possible I am missing something you are doing via some shadow config...

Sam Ritchie 2023-01-23T20:59:22.704809Z

I can make a tiny version of that macro and get a repro up

Sam Ritchie 2023-01-23T20:59:35.137889Z

thanks for this, @lee, I should have some time this evening and I’ll see what the cljs folks think

lread 2023-01-23T21:06:56.186249Z

Here's me naively trying the same thing under shadow-cljs:

❯ npx shadow-cljs node-repl 
shadow-cljs - config: /home/lee/proj/oss/sicmutils/sicmutils/shadow-cljs.edn
shadow-cljs - starting via "clojure"
shadow-cljs - server version: 2.20.14 running at 
shadow-cljs - nREPL server started on port 32805
cljs.user=> shadow-cljs - #4 ready!
cljs.user=> (require '[pattern.rule :as rule])
nil

lread 2023-01-23T21:07:31.747349Z

(no assert fail this time)

lread 2023-01-23T21:17:03.764309Z

Lemme know how it goes. If you are really married to roughing the choppy seas with an import-vars type approach, I can dig up my old rewrite-cljc work for you.

lread 2023-01-23T21:18:40.175249Z

(my advice: don't do it, but you are the captain of your ship, sir!)

😂 1
Sam Ritchie 2023-01-23T21:19:58.680859Z

I have to do it to give folks a namespace that has everything , so they can use it as a replacement for the original scheme library… and MIT scheme has no namespaces at all

lread 2023-01-25T21:29:02.119709Z

@sritchie09 interesting recent https://clojurians.slack.com/archives/CQT1NFF4L/p1674180518666799 about import-vars that might interest you

❤️ 1