compiler icon indicating copy to clipboard operation
compiler copied to clipboard

error with bump/diff when docs.json line is longer than 65535 (in 0.19.1 but not 0.19.0)

Open ianmackenzie opened this issue 4 years ago • 3 comments

It seems that the elm executable is unable to properly download/parse the docs for elm-geometry 3.4.0 (3.3.0 seems fine), which interferes with diffing/publishing.

SSCCE

If you run

elm diff ianmackenzie/elm-geometry 3.3.0 3.4.0

you should get

-- PROBLEM LOADING DOCS --------------------------------------------------------

I need the docs for 3.4.0 to compute this diff, so I fetched:

    https://package.elm-lang.org/packages/ianmackenzie/elm-geometry/3.4.0/docs.json

I got the data back, but it was not what I was expecting. The response body
contains 520257 bytes. Here is the beginning:

    [{"name":"Arc2d","comment":" An `Arc2d` is a section of a circle, defined...

Does this error keep showing up? Maybe there is something weird with your
internet connection. We have gotten reports that schools, businesses, airports,
etc. sometimes intercept requests and add things to the body or change its
contents entirely. Could that be the problem?

whereas

elm diff ianmackenzie/elm-geometry 3.2.0 3.3.0

works fine. The docs on the package web site (https://package.elm-lang.org/packages/ianmackenzie/elm-geometry/3.4.0/) seem to load/render fine, so this looks like an issue with the CLI and not the server. I also downloaded the docs.json file manually from the URL mentioned in the error message above, and it appears to be well-formed (not truncated or anything).

I'm using Elm 0.19.1 on Windows 10, but I also tested on Linux and Mac and got the same error.

Additional Details

I actually first ran into the error when trying to use elm diff (without arguments) in a local checkout of elm-geometry to prepare for publishing version 3.5.0; that and elm publish report the same error as above.

Could this be another issue with docs larger than 512 kb? I took a brief look through the elm/compiler code and my best guess is that there's some issue with decoding large byte strings using fromByteString in src/Parse/Primitives.hs.

ianmackenzie avatar May 02 '20 23:05 ianmackenzie

Thanks for reporting this! To set expectations:

  • Issues are reviewed in batches, so it can take some time to get a response.
  • Ask questions a community forum. You will get an answer quicker that way!
  • If you experience something similar, open a new issue. We like duplicates.

Finally, please be patient with the core team. They are trying their best with limited resources.

github-actions[bot] avatar May 02 '20 23:05 github-actions[bot]

@ianmackenzie This is most likely related to #2055, which is a regression in 0.19.1 likely due to some parser optimizations.

A work-around for now is to run elm diff, elm bump or elm publish with 0.19.0.

rlefevre avatar May 02 '20 23:05 rlefevre

Thanks! And yes, elm publish etc. work fine with 0.19.0 so that's a good workaround for now.

ianmackenzie avatar May 03 '20 15:05 ianmackenzie