babashka

richiardiandrea 2026-01-12T21:07:45.938869Z

Dear @borkdude - I can open an issue for this if required - but wanted to make sure. Have you ever tried using editscript in bb? I see the following error: clojure.lang.ExceptionInfo: defrecord/deftype currently only support protocol implementations, found: IPersistentCollection (that's a Java interface - https://github.com/juji-io/editscript/blob/a259a8c8e1346a5b8e400abd2200422fcd6997de/src/editscript/util/pairing.cljc#L71) What do you think a patch to editscript should look like? Is there a way to add stuff to the clojure built-in data structures?

✅ 1
borkdude 2026-01-12T21:19:26.089089Z

Permalink to relevant source please

richiardiandrea 2026-01-12T21:26:32.859419Z

This guy - sorry I thought I added it https://github.com/juji-io/editscript/blob/a259a8c8e1346a5b8e400abd2200422fcd6997de/src/editscript/util/pairing.cljc#L71

borkdude 2026-01-12T21:26:34.319039Z

bb has a priority map impl built-in so it could be replaced with that one

👍 1
borkdude 2026-01-12T21:27:08.399909Z

$ bb -e '(find-ns (quote clojure.data.priority-map))'
#object[sci.lang.Namespace 0x4716da1f "clojure.data.priority-map"]

richiardiandrea 2026-01-12T21:27:21.479099Z

Thank you - I'll ask the maintainer

borkdude 2026-01-12T21:27:52.245409Z

probably it's best to experiment yourself in a local branch first before bothering the maintainers to see if it's going to work out

richiardiandrea 2026-01-12T21:28:52.927379Z

yeah well on the other end if there is no will to do that I have to drop my hopes (or maintain my own fork) we'll see

richiardiandrea 2026-01-12T21:29:18.640559Z

thanks you though, I am going to play a bit with it

borkdude 2026-01-12T21:54:17.113669Z

nextjournal clerk also uses editscript. if it works in bb, then it would also be useful for that

borkdude 2026-01-12T21:54:20.428609Z

since clerk now also works in bb

👍 1
borkdude 2026-01-12T22:15:52.479789Z

I have a branch here which makes at least the code load in bb, but it isn't working yet. https://github.com/borkdude/editscript/tree/bb-support • hashCode on Object: this can be supported in SCI, so something I'm going to add in SCI • Comparable: not sure about this one yet, but we can work around this by making a custom compare function for stuff

❤️ 1
borkdude 2026-01-12T22:16:25.207109Z

$ bb -cp src -e "(require '[editscript.core :as e]) (e/diff [1 2 3] [1 2 4])"
[[[2] :r 4]]

borkdude 2026-01-12T22:16:57.618299Z

(this is without alterations to bb, surprised that worked)

💯 1
borkdude 2026-01-12T22:18:03.302269Z

cc @huahaiy

borkdude 2026-01-12T22:23:35.559879Z

@richiardiandrea perhaps you can tell more about your use case of editscript in bb

richiardiandrea 2026-01-12T22:28:09.677569Z

@borkdude I have a piece of code in my service that diffs with editscript and I have to bulk-modify (cause there was a bug) some data ...currently, we do these kinds of data migrations with bb here - so JVM cannot be used.

borkdude 2026-01-12T22:29:40.262409Z

with the above branch I'm getting this with the core tests:

26 failures, 0 errors.
{:test 11, :pass 43, :fail 26, :error 0, :type :summary}
I'm sure the failing tests have to do with the hashCode / compare stuff

richiardiandrea 2026-01-12T22:30:29.029909Z

wow that's cool - let's see what @huahaiy thinks about it and thanks for trying it out

Huahai 2026-01-12T22:32:00.469839Z

So what's in editscript that bb doesn't support right now? We can probably work around.

borkdude 2026-01-12T22:34:30.309409Z

@huahaiy With these changes I get the code to load: https://github.com/borkdude/editscript/commit/05c85b3e5b8c91fa7c50d05d5671e826a2b4b1ee The hashCode thing I can fix in bb / SCI itself. The Comparable thing: probably not, but we can make a custom compare function perhaps to work around this... The priority map: we can fall back on clojure.data.priority-map in bb for this.

borkdude 2026-01-12T22:35:23.700149Z

I can take a better look at this tomorrow

Huahai 2026-01-12T22:36:02.865549Z

Ok thx, I am open to a PR

❤️ 2
borkdude 2026-01-13T16:23:51.039749Z

I added hashCode on deftype to bb. Guess what. This fixes the remaining issues.

$ bb -cp "$(lein with-profiles +dev classpath)" "(require '[editscript.core :as e]) (e/diff [1 2 3 6] [1 2 4]) (require '[editscript.core-test]) (clojure.test/run-tests 'editscript.core-test)"

Testing editscript.core-test
{:result true, :num-tests 2000, :seed 1768321398287, :time-elapsed-ms 1608, :test-var "a-star-end-2-end-generative-test"}
{:result true, :num-tests 2000, :seed 1768321399896, :time-elapsed-ms 1850, :test-var "combine-edits-generative-test"}
{:result true, :num-tests 2000, :seed 1768321401746, :time-elapsed-ms 1167, :test-var "quick-end-2-end-generative-test"}

Ran 11 tests containing 69 assertions.
0 failures, 0 errors.
{:test 11, :pass 69, :fail 0, :error 0, :type :summary}

borkdude 2026-01-13T16:24:09.841659Z

at least for the core tests. Apparently Comparable wasn't needed to make those tests work.

❤️ 1
borkdude 2026-01-13T16:24:50.099539Z

I'll try the other tests as well

richiardiandrea 2026-01-13T16:26:03.068669Z

Really? wow that's cool

richiardiandrea 2026-01-13T16:26:12.019669Z

I'll definitely play around with this

richiardiandrea 2026-01-13T16:28:45.127419Z

this is the location https://github.com/juji-io/editscript/blob/a259a8c8e1346a5b8e400abd2200422fcd6997de/src/editscript/diff/a_star.cljc#L45 it is actually working against hashCode but java.lang.Comparable is a java class that we extend...wondering if creating a editscript.diff.a-star/Coord works and compares fine

borkdude 2026-01-13T16:28:48.624669Z

all tests working without further changes.

$ bb -cp "$(lein with-profiles +dev classpath)" "(require '[editscript.core :as e]) (e/diff [1 2 3 6] [1 2 4]) (require '[editscript.core-test] '[editscript.edit-test] '[editscript.util.pairing-test] '[editscript.diff.a-star-test] '[editscript.diff.quick-test]) (clojure.test/run-tests 'editscript.core-test 'editscript.edit-test 'editscript.util.pairing-test 'editscript.diff.a-star-test 'editscript.diff.quick-test)"

Testing editscript.core-test
{:result true, :num-tests 2000, :seed 1768321703402, :time-elapsed-ms 1411, :test-var "a-star-end-2-end-generative-test"}
{:result true, :num-tests 2000, :seed 1768321704814, :time-elapsed-ms 1705, :test-var "combine-edits-generative-test"}
{:result true, :num-tests 2000, :seed 1768321706519, :time-elapsed-ms 1008, :test-var "quick-end-2-end-generative-test"}

Testing editscript.edit-test

Testing editscript.util.pairing-test

Testing editscript.diff.a-star-test

Testing editscript.diff.quick-test

Ran 23 tests containing 158 assertions.
0 failures, 0 errors.
{:test 23, :pass 158, :fail 0, :error 0, :type :summary}

richiardiandrea 2026-01-13T16:30:07.092489Z

I can add a test in editscript.diff.a-star-test

richiardiandrea 2026-01-13T16:30:26.876779Z

can I be a contributor to your branch 😉

richiardiandrea 2026-01-13T16:30:41.832489Z

or wait maybe I can do it quickly here and paste it

richiardiandrea 2026-01-13T16:31:52.748559Z

no, scratch that

borkdude 2026-01-13T16:31:57.812799Z

OK, paste it. All tests are now passing on my end without any further changes.

$ bb -cp "$(lein with-profiles +dev classpath)" "(require '[editscript.core :as e]) (e/diff [1 2 3 6] [1 2 4]) (require '[editscript.core-test] '[editscript.edit-test] '[editscript.util.pairing-test] '[editscript.diff.a-star-test] '[editscript.diff.quick-test]) (clojure.test/run-tests 'editscript.core-test 'editscript.edit-test 'editscript.util.pairing-test 'editscript.diff.a-star-test 'editscript.diff.quick-test)"

Testing editscript.core-test
{:result true, :num-tests 2000, :seed 1768321703402, :time-elapsed-ms 1411, :test-var "a-star-end-2-end-generative-test"}
{:result true, :num-tests 2000, :seed 1768321704814, :time-elapsed-ms 1705, :test-var "combine-edits-generative-test"}
{:result true, :num-tests 2000, :seed 1768321706519, :time-elapsed-ms 1008, :test-var "quick-end-2-end-generative-test"}

Testing editscript.edit-test

Testing editscript.util.pairing-test

Testing editscript.diff.a-star-test

Testing editscript.diff.quick-test

Ran 23 tests containing 158 assertions.
0 failures, 0 errors.
{:test 23, :pass 158, :fail 0, :error 0, :type :summary}

richiardiandrea 2026-01-13T16:32:16.704739Z

the Coord type is part of the a-start algorithm so I don't need to test it explicitly

borkdude 2026-01-13T16:32:46.421429Z

pushed my hashCode change to my branch

borkdude 2026-01-13T16:32:53.390479Z

you can test the dev version of bb with this

👍 1
borkdude 2026-01-13T16:33:43.185819Z

(check if the main branch has built the version for your OS, you might be getting the old one)

👍 1
borkdude 2026-01-13T16:33:52.733329Z

meanwhile I can make a PR for editscript. Exciting!

richiardiandrea 2026-01-13T16:35:55.243739Z

yeah that's great to have this thank you for working on it

richiardiandrea 2026-01-13T17:41:47.839449Z

sorry @borkdude how to get the dev version ... I guess it is not in the Releases ...did you mean building bb here locally?

borkdude 2026-01-13T17:44:08.814489Z

Search history or check changelog, afk now

borkdude 2026-01-13T17:44:17.290579Z

I've explained it before :-)

borkdude 2026-01-13T17:46:39.522219Z

bash <(curl )  --dev-build --dir .

borkdude 2026-01-13T17:46:51.031429Z

(and now my wife is getting mad at me so back to dinner)

richiardiandrea 2026-01-13T17:49:15.308709Z

duh apologies to wife 😄

richiardiandrea 2026-01-13T18:03:19.304159Z

Ok here is what I did to test my code • Downloaded bb from above • Cloned your repo - checked out your branch • Added an {} deps.edn • Added :local/rootreference to your branch in my :deps • Required my test namespace and ran tests

Testing unit.utils.history-test

Ran 2 tests containing 4 assertions.
0 failures, 0 errors.
{:test 2, :pass 4, :fail 0, :error 0, :type :summary}
Mine are not (yet) as extensive as the ones in editscript but it all works nicely.

🎉 1
borkdude 2026-01-13T19:44:09.114179Z

@huahaiy Do you mind if I add a deps.edn to the project? I can do without it, but it's a bit easier for bb to run tests that way

borkdude 2026-01-13T19:46:46.548189Z

actually I take that back, this is all I need to get bb tests running:

{:tasks
 {test:bb {:extra-paths ["src" "test"]
           :extra-deps {io.github.cognitect-labs/test-runner
                        {:git/tag "v0.5.0" :git/sha "b3fd0d2"}
                        org.clojure/test.check {:mvn/version "1.1.1"}}
           :task cognitect.test-runner/-main}}}

borkdude 2026-01-13T19:47:00.432989Z

seems ok enough

richiardiandrea 2026-01-13T19:49:47.273189Z

deps.edn is nice to have cause you don't need to release for us to try things out 🙂

borkdude 2026-01-13T19:51:51.244569Z

that's true!

borkdude 2026-01-13T19:51:52.834589Z

https://github.com/juji-io/editscript/pull/42

borkdude 2026-01-13T19:52:47.234679Z

ok let me add one deps.edn so we can use editscript as a git dep...

💯 2
Huahai 2026-01-13T19:54:37.681199Z

go ahead

borkdude 2026-01-13T19:56:46.051219Z

I notice the CLJS tests are failing (due to some advanced error). Want me to fix it? Separate PR?

Huahai 2026-01-13T19:56:57.255729Z

sure, thanks

borkdude 2026-01-13T19:57:17.051409Z

ok, deps.edn added for this PR. ready for review

borkdude 2026-01-13T19:57:44.925249Z

oh lol, already merged :)

borkdude 2026-01-13T19:57:48.967359Z

I'll add the deps.edn in another PR

borkdude 2026-01-13T19:59:24.781229Z

here's the deps.edn PR: https://github.com/juji-io/editscript/pull/43

borkdude 2026-01-13T19:59:31.159999Z

now going to look at solving the CLJS issue

borkdude 2026-01-13T19:59:33.303469Z

in another PR

👍 1
borkdude 2026-01-13T20:07:44.364029Z

After merging this, I can make a new bb release but a new editscript release would also be nice since we're also using editscript in clerk and clerk has bb support, but I worked around editscript not working in bb :)

richiardiandrea 2026-01-13T20:08:03.001359Z

this is awesome to see - and so quickly 😄

richiardiandrea 2026-01-13T20:08:11.400989Z

thank you both - really

Huahai 2026-01-13T20:08:19.948729Z

will do

❤️ 1
borkdude 2026-01-13T20:13:09.822369Z

hmm, weird, the tests seem to not work in CI and seem to download an older bb.

Message:  Unable to resolve symbol: sci.impl.deftype/hashCode
Locally it works though and also on @richiardiandrea’s sytem :-s

borkdude 2026-01-13T20:14:53.677949Z

ah found the culprit. I had an expired token in bb CI but the build didn't fail on that, so for linux the dev build wasn't updated

👍 1
borkdude 2026-01-13T20:15:18.048679Z

let me update this so we can re-run editscript's CI

borkdude 2026-01-13T20:16:19.179599Z

of course it's because of bash...

😅 2
borkdude 2026-01-13T20:17:43.968219Z

I'll get back to this in 15 minutes or so

Huahai 2026-01-13T20:19:44.267829Z

it's no hurry, take your time

borkdude 2026-01-13T20:47:59.473669Z

ok, if you can rerun editscript github actions, it should work now

👍 1
Huahai 2026-01-13T21:19:09.291289Z

All work now. Thanks!

borkdude 2026-01-13T21:20:29.087859Z

nice!

borkdude 2026-01-13T21:21:09.774119Z

I'll release bb now. will make another PR to remove dev build from your build and then you can make a release if you want

❤️ 1
Huahai 2026-01-13T21:21:22.947529Z

cool

borkdude 2026-01-13T22:01:34.860739Z

https://github.com/juji-io/editscript/pull/45

Huahai 2026-01-13T22:05:33.890319Z

I am not sure if we want to require java 21.

borkdude 2026-01-13T22:06:18.762799Z

CI broke because you upgraded CLJS which requires it as a mininum JVM now due to Google Closure.

borkdude 2026-01-13T22:07:01.235539Z

I can revert that

Huahai 2026-01-13T22:07:01.737639Z

I know. I can downgrade CLJS for now. I think there are still people not ready for 21 yet

borkdude 2026-01-13T22:07:18.517879Z

sure

borkdude 2026-01-13T22:07:41.650629Z

revert pushed

borkdude 2026-01-13T22:08:10.371229Z

you know what

borkdude 2026-01-13T22:08:14.535509Z

I can make a separate job for CLJS

borkdude 2026-01-13T22:08:16.213609Z

in this PR

borkdude 2026-01-13T22:08:17.566449Z

if you want

Huahai 2026-01-13T22:08:53.829379Z

that would be good

borkdude 2026-01-13T22:10:11.200019Z

pushed

borkdude 2026-01-13T22:10:46.505699Z

I can also split out bb if that makes sense

Huahai 2026-01-13T22:11:27.655969Z

sure, if in the future it needs its own JVM etc.

borkdude 2026-01-13T22:14:31.063459Z

ok all passing now

Huahai 2026-01-13T22:15:23.568959Z

Awesome, I will cut a release

🎉 1
Huahai 2026-01-13T22:26:20.222769Z

Thanks!