fix/repo-list: print partial data when there are graphql errors#1282
fix/repo-list: print partial data when there are graphql errors#1282
Conversation
- errors are treated as warnings when getting partial data - if we have no data and just errors that is a fatal error
ed65bff to
32f7d32
Compare
32f7d32 to
65b9840
Compare
|
Looks good to me though I would opt for verbose-by-default if the errors are severe enough. Amp found the issue below. Feel free to ignore if it's not valid. High: cmd/src/repos_list.go#L83-L113 treats any error whose path starts with repositories.nodes[i] as a reason to drop the entire repo row. That is too aggressive for GraphQL partial-data semantics: this query asks for many fields in the shared fragment, but the default command only prints Name. If defaultBranch, viewerCanAdminister, or keyValuePairs fails for one repo, the repo name/id/url can still be valid and should still be listed with a warning. Instead, the PR silently omits that repo. This also means -first can return fewer repos than requested because filtering happens after the server already applied ordering and limits. The new test at cmd/src/repos_list_test.go#L103-L166 codifies the problematic behavior by expecting a repo to disappear when only viewerCanAdminister errors. |
30858e5 to
e431275
Compare
e431275 to
bd74522
Compare
Fixed it. It will now always print the repos and will print that there are warnings if we got partial data + errors. If we got no data and errors it means it's a hard failure and then we print that. |
Closes CPL-297
Update
src repo listto not fail the whole listing if only some repositories failed.Changes
Test plan
src repo list