-
Notifications
You must be signed in to change notification settings - Fork 8
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
Generator not working for clojurescript > 1.10.520 #22
Comments
Is it possible that this is the same root cause as https://clojure.atlassian.net/browse/TCHECK-157 and can be fixed the same way? I'm wondering if shadow-cljs does too much pre-compilation. Though honestly now that I've said it out loud I can't imagine a way that this would result in the reported symptom, but I'm going to post this comment anyhow. |
I should clarify that the bias you're observing in some of the generators is there by design, and for standard uses of such-that should not be an issue. The repetition I was referring to in the other issue would be from the random-number-generator directly (i.e., using the |
Thanks for the response. A little bit more digging shows that the predicate failure is thrown within a call to 1.10.520 makes it past when that call happens, there's a stack trace like this:
I didn't dig beyond this but maybe this helps orient the problem better. |
I'm not very well versed in the modern cljs ecosystem -- I've never heard of shadow-cljs and I don't know what it does. Reducing the number of tools involved in reproducing a problem is always valuable. |
good point. I've updated the master branch in https://github.com/whacked/sg-issue-repro to use only leiningen + 1 source file. The result looks identical. The latest commit uses clojurescript 1.0.773, which exhibits the predicate exception, commenting out 1.0.520, which does not exhibit the exception.
|
I narrowed this down to the following behavior, which works correctly in 1.10.520 but is broken in 1.10.597:
I.e., this is specifically about records with a field named It's also broken when accessing the field with The specific instance of this in spec is here. This implies that a workaround is to rename that key. I don't know off the top of my head if that key is meant to be user-facing (I suspect not), or if there's any other reason to avoid renaming it. I'd like to check if @w01fe has an opinion before recommending that change. |
I checked that the test suite fails with this error, and it does, but strangely not for cljs version 1.10.597, only for later versions. I'm not sure why that would be. Anyhow, details here: d30f069 |
Probably related: https://clojure.atlassian.net/browse/CLJS-871 |
Thanks for tracking this down. I think it's fine to change the parameter name. |
@whacked if you make a PR to the schema repo to change that name I can help get it released |
Thanks, I'll look over it this coming weekend |
No breakthroughs. Either I'm not going about this correctly or this is trickier than I thought. A few notes:
interesting warnings appear at the top from tests for 741 and not for 597:
for posterity, this is how I'm setting up the testing. suggestions for improved methods welcome. $ pwd
/tmp
$ ls
schema-generators
schema
$ ls -l schema-generators/checkouts/
schema -> /tmp/schema comment out the make changes to e.g. $ cd /tmp/schema
$ lein clean; lein cljx
$ cd /tmp/schema-generators
$ lein test |
Is there any chance that you aren't successfully using the modified version of |
I'm sure there's a chance, but the way I go about it, rather primitively, is that I make breaking changes in the If you have a better method, I'm more than happy to adopt it. |
I haven't tried to sort through the issues you described because it's a big headache, but I did try to fix this on my own and came up with this:
w.r.t. releasing these things the big question is how much version compatibility to try to maintain; in particular A) should the new version of schema work with older versions of schema-generators? (as-is it won't, since the old versions of schema-generators are looking for a I defer to @w01fe on whether it's worth complicating the code to achieve either of these. |
@gfredericks Thanks for looking into this! I guess |
Okay, I'll release the changes above once @whacked confirms that they solve the original problem. |
@whacked do you have any updates about this topic? I am getting the same error when trying to |
@gfredericks I updated the branches you created applying the same change and it worked for me. schema: plumatic/schema#438 It only needs to change the plumatic/schema version used in schema-generators after plumatic/schema is published |
Merged the Schema change and released 1.2.1. Thanks! |
@williammizuta sorry, since my last comment I didn't invest more time into this diagnosis; I have to defer. |
This is related to #21, which helped me trace to clojurescript 1.10.520.
ISSUE
when using clojurescript > 1.10.520, generating for any non-primitive schema seems to fail with
generating for primitives works as expected
REPRO
https://github.com/whacked/sg-issue-repro
workaround
based on #21 I have verified that this issue disappears when building with clojurescript 1.10.520. This is achieved by pulling
npm install [email protected]
, which declares clojurescript1.10.520
as a dependency.[email protected]
declares1.10.597
which begins exhibiting this issue.other notes
I did a very quick check directly against
clojure.test.check.random
based on your comment in #21 (comment)I didn't dig much deeper than this, but when using the 10-sample default for
test.check
generators, there's very high bias for 0 and -1, for example,So this could be related to the repeated random values that you point out in the comment, but the test.check dependency doesn't change across shadow 2.8.72 and 2.8.72, so perhaps the root cause is elsewhere.
The text was updated successfully, but these errors were encountered: