arachne 2018-01-26

Anyone got a solution to this:

Uncaught TypeError: goog.net.jsloader.load is not a function
    at figwheel$client$file_reloading$reload_file_in_html_env (file_reloading.cljs?rel=1516980062278:208)
    at figwheel$client$file_reloading$reload_file (file_reloading.cljs?rel=1516980062278:250)
    at figwheel$client$file_reloading$blocking_load (file_reloading.cljs?rel=1516980062278:269)
    at file_reloading.cljs?rel=1516980062278:279
    at file_reloading.cljs?rel=1516980062278:277
    at figwheel$client$file_reloading$state_machine__59709__auto____1 (file_reloading.cljs?rel=1516980062278:277)
    at figwheel$client$file_reloading$state_machine__59709__auto__ (file_reloading.cljs?rel=1516980062278:277)
    at cljs$core$async$impl$ioc_helpers$run_state_machine (ioc_helpers.cljs?rel=1516980058153:35)
    at cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped (ioc_helpers.cljs?rel=1516980058153:39)
    at ioc_helpers.cljs?rel=1516980058153:48
I'm trying to get Arachne Figwheel to reload JS, but the first time the changes are pushed to the browser this error occurs, and then code reloading is broken.

@luke any ideas ⬆️ ? I'm using the latest versions of all Arache deps.

org.arachne-framework/arachne-figwheel {:mvn/version "0.2.0-master-0032-bb33280"}
org.arachne-framework/arachne-pedestal {:mvn/version "0.2.0-master-0064-fb2edbc"}
org.arachne-framework/arachne-sass {:mvn/version "0.2.0-master-0034-1769b93"}
org.arachne-framework/pedestal-assets {:mvn/version "0.2.0-master-0019-580de8f"}

I've also had to disable the ::webjars config because I get a spec failure with some ZIP object in place of a directory.

@jcf hmm, I haven’t ever seen that before. Any chance you could post your config script including what your cljs compiler settings are?

That's my config, including the cljs-opts I pulled out of the enterprise SPA template.

and is this in dev or whitespace mode?

er, sorry, dev or advanced?

And here's the exception from webjars not being happy:

ExceptionInfo Call to #'arachne.fileset/add did not conform to spec:
In: [1] val: #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"] fails spec: :arachne.fileset.specs/directory at: [:args :directory] predicate: (fn [f] (and (instance? java.io.File f) (.isDirectory f)))
 {:clojure.spec.alpha/problems [{:path [:args :directory], :pred (clojure.core/fn [f] (clojure.core/and (clojure.core/instance? java.io.File f) (.isDirectory f))), :val #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"], :via [:arachne.fileset.specs/directory :arachne.fileset.specs/directory], :in [1]}], :clojure.spec.alpha/spec #object[clojure.spec.alpha$regex_spec_impl$reify__2436 0x6d2bdcdc "clojure.spec.alpha$regex_spec_impl$reify__2436@6d2bdcdc"], :clojure.spec.alpha/value (#arachne.fileset.impl.TmpFileSet{:tree {}, :blob #object[java.io.File 0x47780f5c "/tmp/arachne-fs1560548959238895091"], :scratch #object[java.io.File 0x31a747 "/tmp/arachne-fs3449467318418299623"], :cache #object[java.io.File 0x6b214f83 "/tmp/arachne-fs283219324983436992"]} #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"]), :clojure.spec.alpha/args (#arachne.fileset.impl.TmpFileSet{:tree {}, :blob #object[java.io.File 0x47780f5c "/tmp/arachne-fs1560548959238895091"], :scratch #object[java.io.File 0x31a747 "/tmp/arachne-fs3449467318418299623"], :cache #object[java.io.File 0x6b214f83 "/tmp/arachne-fs283219324983436992"]} #object[com.sun.nio.zipfs.ZipPath 0x55b26a2b "/META-INF/resources/webjars"]), :clojure.spec.alpha/failure :instrument, :clojure.spec.test.alpha/caller {:file "pipeline.clj", :line 135, :var-scope arachne.assets.pipeline/classpath-fileset, :local-fn fn}}
	clojure.core/ex-info (core.clj:4739)
	clojure.core/ex-info (core.clj:4739)
	clojure.spec.test.alpha/spec-checking-fn/conform!--2938 (alpha.clj:131)
	clojure.spec.test.alpha/spec-checking-fn/fn--2943 (alpha.clj:139)
	arachne.assets.pipeline/classpath-fileset/fn--32336 (pipeline.clj:135)
	clojure.core.protocols/fn--7852 (protocols.clj:168)
	clojure.core.protocols/fn--7852 (protocols.clj:124)
	clojure.core.protocols/fn--7807/G--7802--7816 (protocols.clj:19)
	clojure.core.protocols/seq-reduce (protocols.clj:31)
	clojure.core.protocols/fn--7833 (protocols.clj:75)
	clojure.core.protocols/fn--7833 (protocols.clj:75)
	clojure.core.protocols/fn--7781/G--7776--7794 (protocols.clj:13)

I have (def dev? (constantly true)), and my cljs-opts:

(def cljs-opts {:main 'usr.client
                :optimizations (if (dev?) :none :advanced)
                :asset-path "/js/out"
                :output-to "js/app.js"
                :output-dir "js/out"
                :source-map-timestamp true})

So optimisations will be :none.

Commenting out the ::webjars input-dir and related pipeline entries circumvents the spec error with a ZipPath.

I'm not using any webjars so don't need that for now. I can open an issue/PR that changes the spec so zipped ditties are accepted…

right, so that error is (fairly) straightforward, apparently a directory in a Zip is not considered a directory and therefore can’t be used in Arachne’s asset pipeline. That definitely is something that should be enhanced

although I could have sworn I had that working…

how private is this project? Is it the kind of thing you would be willing to clone and let me reproduce locally? I will continue to think about it but honestly with FactUI and some other client work my head has been out of the asset pipeline for a while.

Yeah, the Zip bit seems straightforward enough to fix if ZipPaths are supported.

I'll open up the repo.

Not production quality! 🙂

Oh, and I'm doing some gnarly stuff with deps.edn mixed with Leiningen because I want to try out something simpler (ultimately Arachne + tools.deps).

I need to go pick up my kid right now but I will to reproduce your problem this afternoon.

Cool! I'll keep an eye on Slack, and keep at trying to fix this myself.

@luke fixed it here: https://github.com/jcf/usr/commit/8281da793b18a95aa3bfcdb1b9a2c76f631b2576 Looks like something's been fixed in a recent release of Figwheel (I read that load was replaced with safeLoad but haven't dug deeper).

Upgrading Figwheel fixed the problem with jsloader.load not being around but now I get this:

Too many open files (I guess something to do with the fs abstraction inspired by Boot?).

THen clicking the error spits out this:

heads_up.cljs?rel=1516991443932:39 Uncaught TypeError: Cannot read property 'figwheelEvent' of undefined
    at heads_up.cljs?rel=1516991443932:39
    at core.cljs:4353
    at cljs.core.keep.cljs$core$IFn$_invoke$arity$2 (core.cljs:4353)
    at cljs.core.LazySeq.sval (core.cljs:3380)
    at cljs.core.LazySeq.cljs$core$ISeqable$_seq$arity$1 (core.cljs:3438)
    at cljs.core.LazySeq.cljs$core$ISeq$_first$arity$1 (core.cljs:3404)
    at cljs$core$first (core.cljs:1220)
    at figwheel$client$heads_up$get_dataset (heads_up.cljs?rel=1516991443932:39)
    at HTMLDivElement.figwheel$client$heads_up$heads_up_onclick_handler (heads_up.cljs?rel=1516991443932:43)

If we've exhausted the number of files we're allowed to open, all bets are off. 😉

List of all the files opened by this Arachne-managed process:

I can up my ulimit etc.

If I change the string in my views/Layout a few times I can reliably max out the open file limit.

$ ulimit -Hn
4096

@jetmind has left the channel

👋 1

@donaldball has left the channel

Is there any way to update a fact in the session?

in factui session

I have a rule that says if A is true then insert-logical B. And, at first, one event-handler inserts the fact that A is true, so B gets inserted. Now, in another event-handler, I want to either set A to false or retract A, so that B can automatically be retracted.

@jcf ok, let me get my head around the open files issue. that came up on another project a couple months ago and we found a workaround, I’ll refresh my memory on that end get back to you.

You should be able to reproduce the too many open files issue using my usr repo. If you trigger a reload by changing a cljs file a few times it pops up. I vauguely remember reloading the system via reset from the user ns contributed but can’t find an example right now.

I’m planning on doing some more work with Arachne and will likely open source most if not all of what I achieve. If you have a roadmap or want to collaborate on something let me know. Thanks, Luke! Catch you later.

@jcf see my message in the main channel

that issue was fixed I think

but possibly not included in a release version yet

glad you’re finding Arachne interesting, eager to see what you do with it. Let me know if there’s anything else I can do to help

💯 1

@amarjeet that should work already if the fact is cardinality one; it will be replaced and the logical rule effect will happen

if it’s cardinality many then the old fact is still true as well, so nothing will be retracted

oh okay, I wasn't setting the cardinality option. I just used (f/transact-logical! [{:db/ui true}])

yeah facts are cardinality many by default

unless you have a schema setting them to one

got it, thats helpful. thanks much luke

It’s possible I forgot/didn’t make a release of that for some reason

what version of arachne-fileset is your project using? (you can check this using lein deps :tree or something like that

@luke https://github.com/jcf/usr/blob/master/deps.edn gets slurped into project.clj. I’ll copy and paste the version now…

@jcf right: the arachne-fileset lib is a transitive dependency of the Arachne assets module

Oh, sorry. Didn’t see you wanted a transitive dependency.

you want version 1.6.1, 1.6.0 has the “open files” bug

I’m AFK at the mo (it’s Friday night and 19:55 here).

for now you can just manually include the newest version of org.arachne-framework/arachne-fileset

I’ll add an explicit dependency to my deps.edn just like Figewheel Sidecar.

I’ll cut a release of Arachne proper upgrading the dependency soon

Awesome. Thanks, @luke.

and include the sidecar version bump which it sounds like I’ll need as well

might be a few days, I will probably port Arachne to deps.edn at the same time.

since I now prefer that approach, since it’s out

Added Figwheel Sidecar in master.

I’ll roll that into the core project

tools.deps is a breath of fresh air. Loving the recent output from the Cognitect guys(I guess mainly Alex??)

Rich has the ideas, Alex does the work 😉

How do I ‘retweet’ a Slack comment? 🤣

you don’t, which is why I can say such things here

🙂 2