-
Notifications
You must be signed in to change notification settings - Fork 39
Fix #397: gl renders node denials as empty lists / silent success across list commands #404
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -221,12 +221,14 @@ async fn cmd_list(repo: String, node: String, dir: Option<PathBuf>) -> Result<() | |
|
|
||
| let client = signed_client(&node, dir.as_deref()); | ||
| let path = format!("/api/v1/repos/{owner}/{name}/issues"); | ||
| let resp: Value = client | ||
| .get_authed(&path) | ||
| .await? | ||
| .json() | ||
| .await | ||
| .context("failed to list issues")?; | ||
| let resp_raw = client.get_authed(&path).await?; | ||
| let status = resp_raw.status(); | ||
| let resp: Value = resp_raw.json().await.context("failed to list issues")?; | ||
|
Comment on lines
+224
to
+226
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Read non-success bodies before JSON deserialization.
Read the body once. For non-success responses, extract Also applies to: 358-364 🤖 Prompt for AI Agents |
||
|
|
||
| if !status.is_success() { | ||
| let msg = resp["message"].as_str().unwrap_or("unknown error"); | ||
| anyhow::bail!("list failed ({status}): {msg}"); | ||
| } | ||
|
|
||
| let issues = resp["issues"].as_array().cloned().unwrap_or_default(); | ||
|
|
||
|
|
@@ -353,14 +355,18 @@ async fn cmd_issue_comments( | |
| let (owner, name) = resolve_repo(&repo, &node, dir.as_deref()).await?; | ||
| let client = signed_client(&node, dir.as_deref()); | ||
|
|
||
| let resp: Value = client | ||
| let resp_raw = client | ||
| .get_authed(&format!( | ||
| "/api/v1/repos/{owner}/{name}/issues/{id}/comments" | ||
| )) | ||
| .await? | ||
| .json() | ||
| .await | ||
| .context("invalid JSON")?; | ||
| .await?; | ||
| let status = resp_raw.status(); | ||
| let resp: Value = resp_raw.json().await.context("invalid JSON")?; | ||
|
|
||
| if !status.is_success() { | ||
| let msg = resp["message"].as_str().unwrap_or("unknown error"); | ||
| anyhow::bail!("comments list failed ({status}): {msg}"); | ||
| } | ||
|
|
||
| let comments = resp["comments"].as_array().cloned().unwrap_or_default(); | ||
| if comments.is_empty() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resp_raw.json()fails before the status branch runs, so the command reports a generic decoding error without the captured HTTP status. The changed comments-list handler has the same ordering.