Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix(gl): route the status repo sections through read_json and pin the…
… file (#186)

`gl status` was hardened in this PR with section_unavailable_line and
trust_line, so a denied section prints "unavailable ({status})" instead of
rendering as empty. But it was hardened by hand rather than through read_json,
so status.rs carried no marker, never entered the completeness gate's derived
set, and was never scanned. Deleting the helper call would have restored the
denial-as-empty bug with the gate still green: the one file written to fix this
bug was the one converted file the gate did not cover.

The two repo-section parses now route through read_json and status.rs is
pinned in CONVERTED_IN_186. Exactly two source lines change.
section_unavailable_line takes the response by reference and reads only its
status, so read_json sits underneath it with no restructuring, and the outer
if-let shape still stops one denied section from aborting the others. All 35
status tests pass unchanged, including the eight denial tests and their exact
rendered strings.

trust_line stays hand-rolled on purpose. It needs a three-way split (2xx,
exactly 404, other non-2xx) that read_json collapses into a single Err, and it
already carries a literal status check the scan can see.

A second pinned const naming hand-rolled guards was considered and rejected. It
would enforce only that a symbol is spelled somewhere in the file: deleting the
println while keeping the call would stay green. A structural anchor already
exists, which is read_json, and the repo's own guard-design note is explicit
that a name-keyed filter must never be the membership predicate when one does.

Proven, not assumed. Pinning status.rs before converting it turned the gate red
naming the file. Reverting even one of the two read_json calls afterwards turns
it red again, on the unguarded check rather than the pin, because the issues
parse has no full status guard in its lookback window. The one gap worth
naming: deleting both section_unavailable_line call sites while keeping
read_json still scans green, and the denied section would then print nothing
rather than a false "no open pull requests". Probed it, and clippy catches that
case as a dead function under -D warnings, so CI would fail. That backstop
holds only while the helper has no other caller.

Verified: gate 2 passed, cargo test -p gl --bin gl status 35 passed. fmt clean.
  • Loading branch information
beardthelion committed Sep 1, 2026
commit 73a75f623d82f369efa86bd5d2085a98400c0a8e
4 changes: 2 additions & 2 deletions crates/gl/src/status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub async fn run(args: StatusArgs) -> Result<()> {
if let Some(line) = section_unavailable_line("PRs", &pr_resp) {
println!("{line}");
} else if let Ok(r) = pr_resp {
if let Ok(body) = r.json::<Value>().await {
if let Ok(body) = crate::http::read_json(r, "pull requests").await {
let prs = body["pulls"].as_array().cloned().unwrap_or_default();
let open: Vec<_> = prs
.iter()
Expand Down Expand Up @@ -105,7 +105,7 @@ pub async fn run(args: StatusArgs) -> Result<()> {
if let Some(line) = section_unavailable_line("issues", &issue_resp) {
println!("{line}");
} else if let Ok(r) = issue_resp {
if let Ok(body) = r.json::<Value>().await {
if let Ok(body) = crate::http::read_json(r, "issues").await {
let issues = body["issues"].as_array().cloned().unwrap_or_default();
let open: Vec<_> = issues
.iter()
Expand Down
1 change: 1 addition & 0 deletions crates/gl/tests/no_parse_before_status.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const CONVERTED_IN_186: &[&str] = &[
"register.rs",
"repo.rs",
"star.rs",
"status.rs",
"sync.rs",
"task.rs",
"visibility.rs",
Expand Down