Fork me on GitHub
#nbb
<
2022-11-02
>
Daniel Gerson00:11:21

I'm assuming these instructions are out of date? https://github.com/babashka/nbb/tree/main/examples/metosin-malli and that :git/urlis the correct approach?

borkdude10:11:52

That's indeed out of date

👍 1
borkdude10:11:03

PR welcome

👍 1
Daniel Gerson14:11:19

@U04V15CAJ. https://github.com/babashka/nbb/pull/271. That took longer than expected. Didn't work with :mvn/versionof metosin/malli. Thought may it required git/urlso spent some time until I found deps-info-infer to make sure I was on the latest and instructions were easy and up to date, didn't work either. Then noticed borkdude/malli. Still didn't work. Finally noticed that there is a regression in 1.0.140 of nbb. Rant over. 😅

borkdude14:11:32

@U03B2SRNYTY Why didn't :mvn/version work? It should nowadays with nbb.edn

Daniel Gerson14:11:43

The error is

npx nbb example.cljs                                                           main !2 ?2  INT ✘  13:49:30
Downloading dependencies...
Extracting dependencies...
Done.
----- Error --------------------------------------
Message:  Maximum call stack size exceeded
Location: /Users/dmg46664/projects/nbb/examples/metosin-malli/.nbb/.cache/e8c9d0550fbae91f6ce4d0b0519a4237ad4f512d/nbb-deps/malli/core.cljc:1905:79

----- Context ------------------------------------
1901:           (-regex-op? [_] true)
1902:           (-regex-validator [this] (re-validator properties (-vmap (fn [[k _ s]] [k (-regex-validator s)]) (-children this))))
1903:           (-regex-explainer [this path]
1904:             (re-explainer properties (-vmap (fn [[k _ s]] [k (-regex-explainer s (conj path k))]) (-children this))))
1905:           (-regex-parser [this] (re-parser properties (-vmap (fn [[k _ s]] [k (-regex-parser s)]) (-children this))))
                                                                                    ^--- Maximum call stack size exceeded
1906:           (-regex-unparser [this] (re-unparser properties (-vmap (fn [[k _ s]] [k (-regex-unparser s)]) (-children this))))
1907:           (-regex-transformer [this transformer method options]
1908:             (re-transformer properties (-vmap (fn [[k _ s]] [k (-regex-transformer s transformer method options)]) (-children this))))
1909:           (-regex-min-max [this] (re-min-max properties (-children this))))))))
1910:

----- Stack trace --------------------------------
malli.core/-regex-parser - /Users/dmg46664/projects/nbb/examples/metosin-malli/.nbb/.cache/e8c9d0550fbae91f6ce4d0b0519a4237ad4f512d/nbb-deps/malli/core.cljc:80:1
malli.core               - /Users/dmg46664/projects/nbb/examples/metosin-malli/.nbb/.cache/e8c9d0550fbae91f6ce4d0b0519a4237ad4f512d/nbb-deps/malli/core.cljc:1905:79
clojure.core/into        - <built-in>
malli.impl.util/-vmap    - /Users/dmg46664/projects/nbb/examples/metosin-malli/.nbb/.cache/e8c9d0550fbae91f6ce4d0b0519a4237ad4f512d/nbb-deps/malli/impl/util.cljc:22:11
malli.impl.util/-vmap    - /Users/dmg46664/projects/nbb/examples/metosin-malli/.nbb/.cache/e8c9d0550fbae91f6ce4d0b0519a4237ad4f512d/nbb-deps/malli/impl/util.cljc:20:1
...
malli.core/parse         - /Users/dmg46664/projects/nbb/examples/metosin-malli/.nbb/.cache/e8c9d0550fbae91f6ce4d0b0519a4237ad4f512d/nbb-deps/malli/core.cljc:2103:4
malli.core/parse         - /Users/dmg46664/projects/nbb/examples/metosin-malli/.nbb/.cache/e8c9d0550fbae91f6ce4d0b0519a4237ad4f512d/nbb-deps/malli/core.cljc:2099:1
example                  - /Users/dmg46664/projects/nbb/examples/metosin-malli/example.cljs:5:2
clojure.core/prn         - <built-in>
example                  - /Users/dmg46664/projects/nbb/examples/metosin-malli/example.cljs:4:1

Daniel Gerson14:11:58

It might have...

Daniel Gerson14:11:34

re mvn, I actually stopped testing when I got it working. Didn't know the reason for borkdude/malli

borkdude14:11:37

That might be a new issue. At least the code is executing

borkdude14:11:50

borkdude/malli was a fork of malli but now that isn't necessary

Daniel Gerson14:11:58

ok, didn't know

borkdude14:11:12

I'll take a look at the stack overflow, I'll probably know what it is

Daniel Gerson14:11:47

So the instruction can be simplified then to the mvn version.

Daniel Gerson14:11:02

... and I figured out deps-info along the way 😆

Daniel Gerson14:11:25

I'll change that.

borkdude14:11:05

installing #C03KCV7TM6F would be a better suggestion, since that uses that lower level library: neil dep add metosin/malli --latest-sha true

borkdude14:11:41

but I think it should just be an nbb.edn with the mvn/version anyway, so we can leave this out

borkdude14:11:26

neil dep add metosin/malli --deps-file nbb.edn

borkdude14:11:35

$ cat nbb.edn
{:deps {metosin/malli {:mvn/version "0.9.2"}}}

borkdude14:11:17

It works on my machine with Welcome to nbb v1.0.137!

borkdude14:11:23

Still works with 1.0.140 on my machine

borkdude14:11:43

hmm maybe not when I execute the example

Daniel Gerson14:11:52

Pushed the correction.

Daniel Gerson14:11:59

Curious re your experiments...

borkdude14:11:12

yep, can reproduce when executing the example

1
borkdude14:11:14

also seems to happen with 137, I'll backtrack

borkdude14:11:29

ah no my bad, I was on a ^... version so it was still using 1.0.140 - the version before that worked. I'll dig deeper

✔️ 1
Daniel Gerson14:11:15

neil has a --dry-run it seems. Assuming it didn't was why I passed it over. Cheers.

Daniel Gerson14:11:35

... and why is it called neil? :thinking_face:

borkdude14:11:21

I found the commit that introduced the stackoverflow for malli: https://github.com/babashka/sci/commit/edefeda9e6038ab8eb918377dd09ec96f9c73219 Now I still need to found out why

👍 1
borkdude14:11:26

I have no clue why that commit can introduce a stackoverflow - weird!

Daniel Gerson14:11:17

Check out prev version. overlay code difference. revert one chunk at a time and run until it breaks? (I meant or doesn't break)

borkdude14:11:31

yes, doing this now, reverting commit locally

👍 1
borkdude15:11:56

I found the offending bit:

'type (copy-var type #_sci.impl.types/type-impl clojure-core-ns {:name 'type})
The change to type causes the stackoverflow

borkdude15:11:46

but ... why

borkdude15:11:21

oh right, switching away from type caused it

borkdude16:11:22

This part in type-impl causes a loop somehow:

(when (#?(:clj instance?
                :cljs implements?) sci.impl.types.IReified x)
        :sci.impl.protocols/reified)
I still don't understand why though

borkdude16:11:26

oh how funny, remove the keyword it starts working, wtf...

😅 1
borkdude16:11:27

Publishing 1.0.141 now

borkdude16:11:03

Done. Can you test and update the PR?

Daniel Gerson17:11:49

Well done 🙌 sounded gnarly. Will do, might take a little while.

Daniel Gerson11:11:54

@U04V15CAJ I was just thinking, this wasn't caught because the version of nbb is hard coded in the examples. Can Neil update the examples to the last published version of nbb?

Daniel Gerson11:11:34

I guess a lot of deps could be updated, but you don't want it to break based on other projects.

Daniel Gerson11:11:48

Just thinking out loud 😅

borkdude11:11:07

oh wait, nbb version is in package.json - neil doesn't support this, but npm does: npm install nbb@latest

1
borkdude11:11:34

but it's better to add a test with the development version of nbb since the version in development isn't on npm yet

Daniel Gerson11:11:21

I guess one could npm install the build version.

borkdude11:11:36

yes, that's possible

borkdude16:11:28

Just published nbb 1.0.141 which fixes a stackoverflow with malli.

2
😍 1
🙌 2