fj pr checks errors with 'invalid type: null, expected a sequence' when a PR has no checks #241
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
fj pr checksfails to deserialize the response when a PR has no statuscontexts, instead of reporting that there are none.
Reproduction
rasterstate/assay-researchhas no CI configured, so PR #1 reports no statuses:The API is returning
nullrather than[]for the status list, and thedeserializer requires a sequence.
Expected
Something like
no checks reported on <sha>, and exit 0. A repo with no CI is anormal state, not an error, and it is the state every new repo starts in.
Why it matters beyond cosmetics
The message names no repo, no PR, and no field, so it reads like a bug in
fj'sown request rather than a description of the PR. When you are checking whether
something is safe to merge, "error" and "there are no checks" call for opposite
decisions, and this conflates them. I hit it while deciding whether a PR was
gated, and had to fall back to
fj api .../statusesto establish that the answerwas simply "none".
Suggested fix
Deserialize the status list with a null-tolerant default (
#[serde(default)]onthe field, or
Option<Vec<_>>unwrapped to empty) and print the empty caseexplicitly. Worth a look at whether other list-shaped responses have the same
assumption;
nullfor an empty array is common in this API.