juxt

p-himik 2019-02-20T19:39:07.001200Z

How do you guys produce an uberjar? uberjar.adoc says to use bin/onejar but it doesn't seem like the specified -A:prod is enough. And bin/uberjar simply doesn't work: java.io.FileNotFoundException: Could not locate io/dominic/krei/alpha/main__init.class or io/dominic/krei/alpha/main.clj on classpath

dominicm 2019-02-20T19:40:47.001700Z

bin/uberjar is probably broken

dominicm 2019-02-20T19:40:55.002Z

We use onejar in production though

dominicm 2019-02-20T19:40:59.002300Z

What's wrong with it?

p-himik 2019-02-20T19:41:50.003300Z

Well, using -A:prod creates a jar that's not runnable since nrepl is missing. Also, there are no generated web resources. Can you tell me what arguments you pass to bin/onejar?

p-himik 2019-02-20T19:44:08.003900Z

Just tried running ../bin/onejar -A:prod:build:prod/build:build/once --args '-m edge.main' project.jar from main. Running java -jar project.jar still results in Could not locate clojure/tools/namespace/repl__init.class or clojure/tools/namespace/repl.clj on classpath.

dominicm 2019-02-20T19:45:04.004400Z

I need to document this better.

p-himik 2019-02-20T19:45:15.005100Z

And probably some tests won't hurt. 🙂

dominicm 2019-02-20T19:45:21.005300Z

I don't know what is requiring tools.namespace via edge.main

p-himik 2019-02-20T19:45:38.005500Z

user.clj is.

dominicm 2019-02-20T19:49:14.005900Z

Nothing should be, unless your code is?

p-himik 2019-02-20T19:49:56.006300Z

As I said - prod/user.clj requires [clojure.tools.namespace.repl :as repl].

p-himik 2019-02-20T19:50:22.006700Z

I'm trying to pack and run vanilla edge, there are no changes.

p-himik 2019-02-20T19:50:33.007Z

Edge/main that is.

dominicm 2019-02-20T19:51:30.007200Z

Oh

dominicm 2019-02-20T19:51:38.007500Z

Don't do anything with edge/main

dominicm 2019-02-20T19:51:42.007700Z

That's deprecated

dominicm 2019-02-20T19:52:07.008200Z

prod/user.clj is a bad idea, for example.

dominicm 2019-02-20T19:52:34.009Z

I need to mark main as deprecated somehow, without breaking the yada documentation.

p-himik 2019-02-20T19:54:55.009600Z

Wait, what am I supposed to be using then?

dominicm 2019-02-20T19:55:27.010200Z

../bin/onejar -A:prod --args '-m edge.main' onejar.jar is how I produce uberjars btw, but that doesn't factor in cljs/css. But will circle back to that.

dominicm 2019-02-20T19:55:40.010400Z

See https://juxt.pro/edge/docs/adaptation.html

p-himik 2019-02-20T19:56:47.011Z

Yes, I've seen that documentation. By "what to use" I meant "is there any test project using edge?" 🙂

dominicm 2019-02-20T19:57:32.011600Z

inside of edge? a good one might be tutorial.vent

dominicm 2019-02-20T19:58:32.012100Z

It may well be that we lack a good example anymore though, vent hasn't been taken into production for example.

dominicm 2019-02-20T19:59:00.012500Z

I often deploy the out-of-the-box fresh app that's generated though.

dominicm 2019-02-20T20:01:39.013Z

the default app has this which can compile the assets: clojure -A:build:build/once

dominicm 2019-02-20T20:04:02.013500Z

okay, vent fails in a way I would basically expect 😄

p-himik 2019-02-20T20:09:44.015300Z

OK, just did:

$ ./bin/app acme/test --sass --cljs
$ cd acme.test
$ ../bin/onejar -A:prod --args '-m edge.main' project.jar
$ java -jar project.jar
It failed with:
22:07:31.889 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.simontuffs.onejar.Boot.run(Boot.java:342)
        at com.simontuffs.onejar.Boot.main(Boot.java:168)
Caused by: clojure.lang.ExceptionInfo: Missing definitions for refs: [:acme.test/index :edge.yada.ig/classpath-name], [:acme.test/assets :edge.yada.ig/resources] {:reason :integrant.core/missing-refs, :config {:acme.test.foo/string "Hello, test!", [:edge.yada.ig/classpath-name :acme.test/index] {:name "index.html"}, [:edge.yada.ig/resources :acme.test/assets] {:path "public/"}, :edge.yada.ig/listener {:handler #integrant.core.Ref{:key :edge.bidi.ig/vhost}, :port 7200}, :edge.bidi.ig/vhost [["<http://localhost:7200>" ["" [["/" #integrant.core.Ref{:key [:acme.test/index :edge.yada.ig/classpath-name]}] ["/hello" #integrant.core.Ref{:key :acme.test.foo/string}] ["" #integrant.core.Ref{:key [:acme.test/assets :edge.yada.ig/resources]}]]]]], :edge.kick/builder {:kick.builder/target "target/prod", :kick/sass {:builds [{:id "test", :source "test.scss", :target "public/test.css"}]}, :kick/figwheel-main {:builds [{:id "app", :main acme.test.frontend.main, :output-to "public/frontend.js", :output-dir "public/frontend.out", :asset-path "/frontend.out", :optimizations :advanced}], :figwheel-config {:ring-server-options {:port 3535}}}}}, :missing-refs ([:acme.test/index :edge.yada.ig/classpath-name] [:acme.test/assets :edge.yada.ig/resources])}
        at integrant.core$missing_refs_exception.invokeStatic(core.cljc:191)
        at integrant.core$missing_refs_exception.invoke(core.cljc:190)
        at integrant.core$build.invokeStatic(core.cljc:320)
        at integrant.core$build.invoke(core.cljc:303)
        at integrant.core$init.invokeStatic(core.cljc:418)
        at integrant.core$init.invoke(core.cljc:410)
        at integrant.core$init.invokeStatic(core.cljc:415)
        at integrant.core$init.invoke(core.cljc:410)
        at edge.main$_main.invokeStatic(main.clj:10)
        at edge.main$_main.doInvoke(main.clj:8)
        at clojure.lang.RestFn.invoke(RestFn.java:397)
        at clojure.lang.AFn.applyToHelper(AFn.java:152)
        at clojure.lang.RestFn.applyTo(RestFn.java:132)
        at clojure.lang.Var.applyTo(Var.java:705)
        at clojure.core$apply.invokeStatic(core.clj:665)
        at clojure.core$apply.invoke(core.clj:660)
        at clojure.main$main_opt.invokeStatic(main.clj:493)
        at clojure.main$main_opt.invoke(main.clj:487)
        at clojure.main$main.invokeStatic(main.clj:598)
        at clojure.main$main.doInvoke(main.clj:561)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at clojure.lang.Var.applyTo(Var.java:705)
        at clojure.main.main(main.java:37)
        ... 6 more

dominicm 2019-02-20T20:10:04.015600Z

yeah, I just hit that. I'm a bit confused actually.

dominicm 2019-02-20T20:10:46.016500Z

especially as this is one of the simpler parts of the codebase, and I can see in the failing system that it has those keys.

p-himik 2019-02-20T20:10:54.016700Z

Why does config.edn use both [:edge.yada.ig/classpath-name :acme.test/index] and [:acme.test/index :edge.yada.ig/classpath-name]?

p-himik 2019-02-20T20:11:09.017100Z

Doesn't feel right.

dominicm 2019-02-20T20:11:42.017400Z

copy/paste error I would suspect 🙂

dominicm 2019-02-20T20:12:02.017600Z

oh, I see.

dominicm 2019-02-20T20:12:33.018100Z

I mean, really, the #ig/ref shouldn't use the composite key I think.

dominicm 2019-02-20T20:13:00.018600Z

but yeah, they should match in the template, else integrant will generate different composite keys for them.

dominicm 2019-02-20T20:13:37.018800Z

does it work if you switch them?

dominicm 2019-02-20T20:24:27.020700Z

Very strange, it's failing to find the edge.yada.ig.resources integrant component when I make them match.

p-himik 2019-02-20T20:24:56.021400Z

Yep. And using just :acme.test/index as a reference fails as well.

p-himik 2019-02-20T20:25:22.022Z

I think it's a recent failure since this part works in my other project that I started earlier.

dominicm 2019-02-20T20:25:41.022200Z

I would assume it is 6de7f049fe26d80c02cfbc339d3479508be0538a

p-himik 2019-02-20T20:26:29.022600Z

But it just changes the template. Whereas the main failure is with matching.

p-himik 2019-02-20T20:27:04.023100Z

I think 8a5be082f72fbdb1ec88035b373d9da49820e329 doesn't have this issue since that's what I use in the other project.

dominicm 2019-02-20T20:27:59.023300Z

Reverting 6de didn't help.

p-himik 2019-02-20T20:28:47.024400Z

As expected. 🙂 Since the issue with with #ig/ref matching, something must've changed in integrant, and then the new version must've been used in edge.

dominicm 2019-02-20T20:29:18.024800Z

maybe the composite keys method changed and I've been doing it wrong the whole time 🙂

dominicm 2019-02-20T20:30:20.025Z

annoyingly, it works in dev?

p-himik 2019-02-20T20:33:25.025800Z

Just checked the versions - I use the same versions of integrant and aero. Hmm. Indeed it works in dev.

dominicm 2019-02-20T20:33:38.026300Z

I can see my println firing indicating that edge.yada.ig is loading from the jar.

p-himik 2019-02-20T20:33:45.026500Z

Ahh, a good old "Bohr bug".

dominicm 2019-02-20T20:34:05.026700Z

that's a novel name for it 😄 I like it

p-himik 2019-02-20T20:34:36.026900Z

Not really novel. 🙂 http://www.catb.org/jargon/html/B/Bohr-bug.html

dominicm 2019-02-20T20:34:59.027100Z

heisenbug is the name I know

p-himik 2019-02-20T20:35:27.027700Z

Yep, also mandelbug and schroedinbug.

dominicm 2019-02-20T20:35:34.027900Z

mandelbug looks useful too, hanging onto that one

dominicm 2019-02-20T20:36:59.028300Z

neat trick with onejars, if you pass -r you get a REPL 😄

p-himik 2019-02-20T20:37:32.028500Z

Will keep in mind. 🙂

dominicm 2019-02-20T20:38:25.028900Z

going to use that to figure out what is going on with the methods

dominicm 2019-02-20T20:40:19.029100Z

hmm, this isn't right

dominicm 2019-02-20T20:40:38.029400Z

user=&gt; (ig/composite-keyword [:acme.test/assets :edge.yada.ig/resources])
:integrant.composite/acme.test.assets+edge.yada.ig.resources_10849
user=&gt; (ancestors :integrant.composite/acme.test.assets+edge.yada.ig.resources_10849)
nil
user=&gt; (descendants :integrant.composite/acme.test.assets+edge.yada.ig.resources_10849)
nil

dominicm 2019-02-20T20:40:49.029900Z

that's particularly suspect as composite-keyword calls derive

dominicm 2019-02-20T20:43:56.030300Z

okay, parents does give me better luck

dominicm 2019-02-20T20:45:05.030500Z

no it doesn't

dominicm 2019-02-20T20:45:18.030900Z

it works for random things like :a/a and :b/b, but not for [:acme.test/index :edge.yada.ig/classpath-name]

dominicm 2019-02-20T20:46:17.031300Z

user=&gt; (ig/composite-keyword [:a/a :c/c])
:integrant.composite/a.a+c.c_45572
user=&gt; (parents *1)
#{:a/a :c/c}
user=&gt; (ig/composite-keyword [:acme.test/index :edge.yada.ig/classpath-name])
:integrant.composite/acme.test.index+edge.yada.ig.classpath-name_10892
user=&gt; (parents *1)
nil

p-himik 2019-02-20T20:47:26.031500Z

WTH

dominicm 2019-02-20T20:47:42.031900Z

I can't even explain this one

dominicm 2019-02-20T20:47:56.032400Z

the code is simple, it shouldn't even be possible to fail.

dominicm 2019-02-20T20:48:03.032600Z

nor is it consistent

dominicm 2019-02-20T20:48:12.032900Z

could it be clojure 1.10 vs 1.9 maybe?

dominicm 2019-02-20T20:48:27.033300Z

and I know that's a stretch, but I'm grasping at straws a little 🙂

dominicm 2019-02-20T20:48:36.033600Z

it's a change that was made after your version

p-himik 2019-02-20T20:49:03.034100Z

Certainly feels like a CLJ bug.

dominicm 2019-02-20T20:51:29.034300Z

still failing on 1.9

dominicm 2019-02-20T20:51:57.034600Z

Hmm, this time I managed to get parents though

dominicm 2019-02-20T20:52:08.034900Z

maybe it's related to requiring the namespace first or not :thinking_face:

p-himik 2019-02-20T20:53:31.035300Z

Just running the same code in a regular CLJ repl works fine.

dominicm 2019-02-20T20:54:23.035800Z

Okay, if I call (edge.system/system-config {:profile :prod}) then when I do parents I get nil.

dominicm 2019-02-20T20:57:21.036300Z

something about requiring the namespaces into the project causes this issue.

p-himik 2019-02-20T20:58:36.036900Z

Not sure it that helps, but running a dev repl and (edge.system/system-config {:profile :prod}) doesn't reproduce the error.

dominicm 2019-02-20T20:58:50.037100Z

it does help, it's very interesting

p-himik 2019-02-20T20:59:41.037300Z

Was running just ../bin/rebel -A:dev:build.

p-himik 2019-02-20T21:02:01.038100Z

From derive doc: "if [hierarchy] not supplied defaults to, and modifies, the global hierarchy". Just a wild guess - maybe at some point the global hierarchy is somehow replaced/wiped.

dominicm 2019-02-20T21:02:45.038400Z

I can't think of anything that would clear the global hierarchy

p-himik 2019-02-20T21:03:39.038600Z

underive madness. 😄

dominicm 2019-02-20T21:05:16.039200Z

If I remove load-namespaces from edge.system, the composite key is valid

dominicm 2019-02-20T21:05:33.039600Z

I guess I try calling load-namespaces now, and see if that clears the global hierarchy anywhere.

dominicm 2019-02-20T21:06:19.039800Z

user=&gt; (parents (ig/composite-keyword [:acme.test/assets :edge.yada.ig/resources]))
#{:edge.yada.ig/resources :acme.test/assets}
user=&gt; (ig/load-namespaces (edge.system/system-config {:profile :prod}))
21:05:53.810 [main] DEBUG io.netty.util.internal.logging.InternalLoggerFactory - Using SLF4J as the default logging framework
Hayo from edge.yada.ig
(acme.test.foo edge.yada.ig edge.bidi.ig)
user=&gt;  (parents (ig/composite-keyword [:acme.test/assets :edge.yada.ig/resources]))
nil

dominicm 2019-02-20T21:06:31.040100Z

well, that is enlightening indeed.

dominicm 2019-02-20T21:06:52.040500Z

I still can't explain it, but we seem to have something.

p-himik 2019-02-20T21:09:39.041600Z

Ideas: 1. Test with manually loading relevant namespaces 2. If that fails as well, maybe try defmethod or some other ways those keys are used.

dominicm 2019-02-20T21:09:58.042Z

this is what the global-hierarchy is after calling load-namespaces: {:parents #:ctx{:return #{:ctx/expr}}, :ancestors #:ctx{:return #{:ctx/expr}}, :descendants #:ctx{:expr #{:ctx/return}}}

dominicm 2019-02-20T21:10:10.042300Z

I wonder what is doing something with :ctx

p-himik 2019-02-20T21:10:54.042600Z

In clojure.tools.analyzer: (derive :ctx/return :ctx/expr).

dominicm 2019-02-20T21:11:09.042800Z

that was quick 😄

p-himik 2019-02-20T21:11:19.043100Z

Full-text search in IDE. 🙂

dominicm 2019-02-20T21:11:25.043500Z

cursive?

p-himik 2019-02-20T21:11:35.043700Z

Almost - IDEA + Cursive plugin.

p-himik 2019-02-20T21:12:09.044300Z

That's kinda strange that they used just :ctx as a namespace there. Seems to have a high chance of colliding with other code.

dominicm 2019-02-20T21:12:27.044600Z

requiring acme.test.foo is sufficient to cause this issue.

p-himik 2019-02-20T21:13:02.045300Z

So now for #2. Does defmethod ruin everything as well?

p-himik 2019-02-20T21:13:30.045900Z

If not, it's probably some of the requires within acme.test.foo.

dominicm 2019-02-20T21:13:32.046Z

I'm going to comment out yada in acme.test.foo

p-himik 2019-02-20T21:16:09.046600Z

OK man, I'm gonna go get some sleep. Have fun and good luck debugging it.

dominicm 2019-02-20T21:16:46.047Z

Thanks for the bug report, appreciate you spending so much time with edge 🙂

dominicm 2019-02-20T21:16:55.047400Z

Looks like it is yada. Requiring yada causes the hierarchy to clear.

p-himik 2019-02-20T21:17:08.047700Z

Yeah, definitely - I find it to be a rather interesting project.

dominicm 2019-02-20T21:18:23.048300Z

It's a bug in yada 1.3.0-alpha7. We haven't put that into production yet, so looks like we have a reason not to 🙂

dominicm 2019-02-20T21:21:33.048500Z

bug isn't present in alpha5

dominicm 2019-02-20T21:23:10.048900Z

alpha6 is good too it seems, great. So a very small set of commits to review.

dominicm 2019-02-20T21:30:16.049200Z

reverting the aleph upgrade solves it

dominicm 2019-02-20T21:30:28.049500Z

aleph 0.4.6 has been so much trouble 😞

dominicm 2019-02-20T21:43:28.049900Z

still a problem in 0.4.7-alpha4

dominicm 2019-02-20T21:54:00.050200Z

Nope. I'm just confused. Bug is present in alpha6.

dominicm 2019-02-20T22:04:10.050700Z

Bug is supposedly present all the way back to 1.2.15, so I've found something weird, but I have no idea what.

dominicm 2019-02-20T22:09:42.051100Z

and there's no code outside of clojure/core.clj which is modifying global-hierarchy...