hey. how can I depend on stabile versions of cherry from a deps project? Malli has:
{io.github.squint-cljs/cherry {:git/sha "24635085f3a268e624dee5f6b7ec049323a01173"}}
autoupdated to latest commit, but the malli tests fail with those:
{io.github.squint-cljs/cherry {:git/sha "21ec3e33d7cc5df88ba75bbb563522f843e846fd"}}why isn't this CI step failing then? https://github.com/metosin/malli/actions/runs/7438587140/job/20237501990
I see, you rolled back. I'll have a look
btw, all-ns doesn't exist in CLJS: WARNING: Use of undeclared Var malli.registry/all-ns at line 67 /home/runner/work/malli/malli/src/malli/registry.cljc
I'd fix all the warnings here: https://github.com/metosin/malli/actions/runs/7438032106/job/20236337653#step:7:197 This is not the cause for cherry failing probably, but it's just not so clean
I'm debugging with cherry latest:
$ clj -A:cherry -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "RELEASE"}}}' -M -m cljs.main -re node
ClojureScript 1.11.121
cljs.user=> (require 'malli.cherry)
WARNING: Can't take value of macro cljs.core/ns-publics at line 67 /Users/borkdude/dev/malli/src/malli/registry.cljc
WARNING: Use of undeclared Var malli.registry/all-ns at line 67 /Users/borkdude/dev/malli/src/malli/registry.cljc
nil
cljs.user=> (require '[malli.core :as m])
nil
cljs.user=> (m/validate [:fn '(fn [x] (js/console.log x) x)] 1)
:compiled "(function (x) {\nconsole.log(x);\nreturn x\n})"
1
trueSo what is weird that the function schema is compiled and the function is being called.
(testing "fn schemas"
(doseq [fn ['(fn [x] (js/console.log "fn schema" x (int? x) (< 10 x 18))
(and (int? x) (< 10 x 18)))
"(fn [x]
(js/console.log \"fn schema\" x (int? x) (< 10 x 18))
(and (int? x) (< 10 x 18)))"]]
(let [schema (m/schema [:fn {:description "number between 10 and 18"} fn])]
(js/console.log "pre fail")
(is (true? (m/validate schema 12)) (str "nooo: " (pr-str schema)))
(js/console.log "after fail")
output:
pre fail
fn schema 12 true true
FAIL in (validation-test) (/Users/borkdude/dev/malli/test/malli/core_test.cljc:813:13)
fn schemas
nooo: #object[malli.core.t_malli$core10071]
expected: (true? (m/validate schema 12))
actual: (not (true? false))
after failhm repro:
cljs.user=> (m/validate (m/schema [:fn {:description "dude"} "(fn [x] (js/console.log x (int? x) (< 10 x 18)) (and (int? x) (< 10 x 18)))"]) 12)
12 true true
falseah got it, there is something wrong with a missing return:
cljs.user=> (m/validate (m/schema [:fn {:description "dude"} '(fn [x] (and (int? x) (< 10 x 18)))]) 12)
:compiled "(function (x) {\nlet and__8758__auto__1 = cljs.core.int_QMARK_.call(null, x);\nif (cljs.core.truth_.call(null, and__8758__auto__1)) {\n((10 < x) && (x < 18))} else {\nreturn and__8758__auto__1}\n})"
falseawesome, thanks! I’ll check the all-ns .
interesting
have you got a branch to show where it fails? I'll take a look tomorrow
Every commit on the main branch is supposed to be stable
malli master, bb test-cherry