facebook / facebook/relay

`relay-compiler --validate` not working properly with persisted query generation

Open
#4,665 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

When `relay-compiler --validate` is run, typically any incorrect or missing artifacts lead to a non-zero exit code and no changes to the filesystem. I use this in a github workflow to ensure that the author ran `relay` before submitting the PR.

However, with persisted queries, it silently regenerates the file instead, and does not give any error.

I would expect any mismatches to not modify the filesystem, and instead exit with non-zero exit code. Otherwise a PR can corrupt this file without any validation error being flagged.

Additionally if possible, I would like for this comparison to ignore the order of keys in the file, although perhaps thats a separate discussion. My relay scripts sort the persisted queries by query name to minimize merge conflicts from query hashes moving around, so that would trigger an error potentially. Perhaps this should be built-in as a config option for generating the persisted queries file though.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.