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
.dhallb ergonomics #656
Comments
@sjakobi we used to have these files encoded in JSON, and we moved them to binary in #393, due to reasons detailed in #384 (TL;DR: encoding them in JSON doesn't work because JSON is imprecise) To have decent ergonomics you should use |
Update: I added this recommendation to the README for the test suite in #657 |
Thanks for the pointers and the docs improvement, @f-f! 👍 I still think that it would be more ergonomic to include textual representations in this repo. |
You're welcome 🙂 I wouldn't like to version another representation of these files, because:
|
So how do you currently review PRs that change a |
@sjakobi yes, it's slightly uncomfortable (as e.g. I cannot review on mobile), but I prefer it to having generated files checked in |
I think the confusing discussion in #655 is a good case in point why we need a textual representation of As the JSON representation has drawbacks as @f-f pointed out, the diagnostic format of |
Diagnostic format is nice but it can cause confusing diffs because the right hand side is indented at different levels depending on the full content of the left. This means you can get a lot of whitespace-only diffs when changing dhallb files. (For what it's worth, I'm pretty neutral on this change. Overall I think that there's a minor benefit to having a human readable format checked in to the repo, but there's a minor drawback which is that my spec tests will need to call out to |
I support this, because rom a code review perspective this will make it easier to catch bugs in the binary files. I also think there is a way to do this without requiring implementations to support the diagnostic format. What we can do is something similar to what our CI currently does to ensure that the Prelude is linted and internally cached. Specifically, we would:
|
Fixes #656 This adds a human-readable `.diag` file containing the CBOR diagnostic representation for the corresponding `.dhallb` file, for ease of reviewing changes to encoded expressions. This also adds: * A new `./scripts/generate-diagnostic-files.sh` script for keeping the `*.diag` files up-to-date * A new CI check to ensure the contributor hasn't forgotten to update those files This also removes the `./tests/diff-binary.sh` script since it's no longer necessary.
Fix is up here: #659 |
Fixes #656 This adds a human-readable `.diag` file containing the CBOR diagnostic representation for the corresponding `.dhallb` file, for ease of reviewing changes to encoded expressions. This also adds: * A new `./scripts/generate-diagnostic-files.sh` script for keeping the `*.diag` files up-to-date * A new CI check to ensure the contributor hasn't forgotten to update those files This also removes the `./tests/diff-binary.sh` script since it's no longer necessary.
Working with tests for the binary encoding and reviewing changes to
.dhallb
files is currently tricky as the binary files are hard to read and GitHub can't show the diffs.I think it would be better to include the JSON representations of the binaries. We could
Replace the
.dhallb
with.json
files produced bycbor-tool dump --json
. Implementations would then have to encode the JSON files to check their binary decoders.Add the JSON files in addition to the
.dhallb
files and use CI to check their equivalence.The text was updated successfully, but these errors were encountered: