Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.2: Possible issue with Clojure 1.9+? #135

Closed
ptaoussanis opened this issue May 22, 2017 · 4 comments
Closed

v2.0.2: Possible issue with Clojure 1.9+? #135

ptaoussanis opened this issue May 22, 2017 · 4 comments

Comments

@ptaoussanis
Copy link
Member

Hi there,

Have a project that's using [clojurewerkz/cassaforte "2.0.2"] against [org.clojure/clojure "1.8.0"].

Would like to update to [org.clojure/clojure "1.9.0-alpha16"] but this appears to be generating a spec violation against Cassaforte (clojurewerkz/cassaforte/query.clj:85)?

Actually, I think it might be referring to line 97:

([& {:keys [key last-key per-page where] :or {:page 0}}]

Clojure 1.9 is using Spec against compiled code, so I think the defn here is tripping.

Is this a known problem? Am surprised Cassaforte isn't listed at: https://dev.clojure.org/display/design/Errors+found+with+core+specs

Would a PR be welcome for this against 2.0.2? Was the intention for {:page 0} to read {per-page 0}?

Thanks!

Stacktrace follows:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at clojure.main.<clinit>(main.java:20)
Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/defn did not conform to spec:
In: [2] val: ([& {:keys [key last-key per-page where], :or {:page 0}}] {:limit per-page, :where (if last-key (conj (vec where) [> key last-key]) where)}) fails spec: :clojure.core.specs.alpha/arg-list at: [:args :bs :arity-1 :args] predicate: vector?
In: [2 0 1] val: {:keys [key last-key per-page where], :or {:page 0}} fails spec: :clojure.core.specs.alpha/local-name at: [:args :bs :arity-n :bodies :args :varargs :form :sym] predicate: simple-symbol?
In: [2 0 1] val: {:keys [key last-key per-page where], :or {:page 0}} fails spec: :clojure.core.specs.alpha/seq-binding-form at: [:args :bs :arity-n :bodies :args :varargs :form :seq] predicate: vector?
In: [2 0 1 :or :page 0] val: :page fails spec: :clojure.core.specs.alpha/or at: [:args :bs :arity-n :bodies :args :varargs :form :map :or 0] predicate: simple-symbol?
:clojure.spec.alpha/args  (paginate "Paginate through the collection of results\n\n   Params:\n     * `where` - where query to lock a partition key\n     * `key` - key to paginate on\n     * `last-key` - last seen value of the key, next chunk of results will contain all keys that follow that value\n     * `per-page` - how many results per page" ([& {:keys [key last-key per-page where], :or {:page 0}}] {:limit per-page, :where (if last-key (conj (vec where) [> key last-key]) where)}))
 {:clojure.spec.alpha/problems ({:path [:args :bs :arity-1 :args], :pred vector?, :val ([& {:keys [key last-key per-page where], :or {:page 0}}] {:limit per-page, :where (if last-key (conj (vec where) [> key last-key]) where)}), :via [:clojure.core.specs.alpha/defn-args :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/arg-list :clojure.core.specs.alpha/arg-list], :in [2]} {:path [:args :bs :arity-n :bodies :args :varargs :form :sym], :pred simple-symbol?, :val {:keys [key last-key per-page where], :or {:page 0}}, :via [:clojure.core.specs.alpha/defn-args :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/arg-list :clojure.core.specs.alpha/arg-list :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/local-name], :in [2 0 1]} {:path [:args :bs :arity-n :bodies :args :varargs :form :seq], :pred vector?, :val {:keys [key last-key per-page where], :or {:page 0}}, :via [:clojure.core.specs.alpha/defn-args :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/arg-list :clojure.core.specs.alpha/arg-list :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/seq-binding-form], :in [2 0 1]} {:path [:args :bs :arity-n :bodies :args :varargs :form :map :or 0], :pred simple-symbol?, :val :page, :via [:clojure.core.specs.alpha/defn-args :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/args+body :clojure.core.specs.alpha/arg-list :clojure.core.specs.alpha/arg-list :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/binding-form :clojure.core.specs.alpha/map-binding-form :clojure.core.specs.alpha/map-special-binding :clojure.core.specs.alpha/or], :in [2 0 1 :or :page 0]}), :clojure.spec.alpha/args (paginate "Paginate through the collection of results\n\n   Params:\n     * `where` - where query to lock a partition key\n     * `key` - key to paginate on\n     * `last-key` - last seen value of the key, next chunk of results will contain all keys that follow that value\n     * `per-page` - how many results per page" ([& {:keys [key last-key per-page where], :or {:page 0}}] {:limit per-page, :where (if last-key (conj (vec where) [> key last-key]) where)}))}, compiling:(clojurewerkz/cassaforte/query.clj:85:1)
	at clojure.lang.Compiler.load(Compiler.java:7441)
	at clojure.lang.RT.loadResourceScript(RT.java:374)
	at clojure.lang.RT.loadResourceScript(RT.java:365)
	at clojure.lang.RT.load(RT.java:455)
	at clojure.lang.RT.load(RT.java:421)
	at clojure.core$load$fn__7831.invoke(core.clj:6008)
	at clojure.core$load.invokeStatic(core.clj:6007)
	at clojure.core$load.doInvoke(core.clj:5991)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invokeStatic(core.clj:5812)
	at clojure.core$load_one.invoke(core.clj:5807)
	at clojure.core$load_lib$fn__7776.invoke(core.clj:5852)
	at clojure.core$load_lib.invokeStatic(core.clj:5851)
	at clojure.core$load_lib.doInvoke(core.clj:5832)
	at clojure.lang.RestFn.applyTo(RestFn.java:142)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$load_libs.invokeStatic(core.clj:5889)
	at clojure.core$load_libs.doInvoke(core.clj:5873)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$require.invokeStatic(core.clj:5911)
	at clojure.core$require.doInvoke(core.clj:5911)
	at clojure.lang.RestFn.invoke(RestFn.java:436)
	at clojurewerkz.cassaforte.cql$eval9297$loading__7717__auto____9298.invoke(cql.clj:15)
	at clojurewerkz.cassaforte.cql$eval9297.invokeStatic(cql.clj:15)
	at clojurewerkz.cassaforte.cql$eval9297.invoke(cql.clj:15)
	at clojure.lang.Compiler.eval(Compiler.java:6977)
	at clojure.lang.Compiler.eval(Compiler.java:6966)
	at clojure.lang.Compiler.load(Compiler.java:7429)
	at clojure.lang.RT.loadResourceScript(RT.java:374)
	at clojure.lang.RT.loadResourceScript(RT.java:365)
	at clojure.lang.RT.load(RT.java:455)
	at clojure.lang.RT.load(RT.java:421)
	at clojure.core$load$fn__7831.invoke(core.clj:6008)
	at clojure.core$load.invokeStatic(core.clj:6007)
	at clojure.core$load.doInvoke(core.clj:5991)
	at clojure.lang.RestFn.invoke(RestFn.java:408)
	at clojure.core$load_one.invokeStatic(core.clj:5812)
	at clojure.core$load_one.invoke(core.clj:5807)
	at clojure.core$load_lib$fn__7776.invoke(core.clj:5852)
	at clojure.core$load_lib.invokeStatic(core.clj:5851)
	at clojure.core$load_lib.doInvoke(core.clj:5832)
	at clojure.lang.RestFn.applyTo(RestFn.java:142)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$load_libs.invokeStatic(core.clj:5893)
	at clojure.core$load_libs.doInvoke(core.clj:5873)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$require.invokeStatic(core.clj:5911)
	at clojure.core$require.doInvoke(core.clj:5911)
	at clojure.lang.RestFn.invoke(RestFn.java:805)
ptaoussanis pushed a commit to ptaoussanis/cassaforte that referenced this issue May 22, 2017
Just guessing at the original intention here.
@michaelklishin
Copy link
Member

@ptaoussanis a PR would definitely be welcome :)

ptaoussanis pushed a commit to ptaoussanis/cassaforte that referenced this issue May 22, 2017
ptaoussanis pushed a commit to ptaoussanis/cassaforte that referenced this issue May 22, 2017
- Just guessing at the original intention here.
- Have yet to confirm that this is the *only* change necessary for 1.9+ support.
ptaoussanis pushed a commit to ptaoussanis/cassaforte that referenced this issue May 22, 2017
- Just guessing at the original intention here.
- Confirmed that this seems to be the only change necessary for 1.9+ support.
@ptaoussanis
Copy link
Member Author

PR at #136

michaelklishin added a commit that referenced this issue May 22, 2017
[#135] Typo preventing use with Clojure 1.9+
@michaelklishin
Copy link
Member

@ptaoussanis done.

@ptaoussanis
Copy link
Member Author

Awesome, thanks Michael!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants