learn: gh --json merged is invalid; zsh word-split silently breaks id loops - #1371
Conversation
…s id loops Two cross-repo facts measured live on wai#57, 2026-08-09. memories/github.md: `gh pr view --json merged` errors (Unknown JSON field); the existing entry already covered state/mergedAt as the gh --json fix, so this adds that the merged boolean itself is real via REST and the MCP pull_request_read get method, cross-referencing github-mcp-tools.md. memories/tools.md: extends the existing zsh-does-not-word-split entry with a second variant where the unsplit loop's consumer (GraphQL) rejects the concatenated string outright, and a resolve-and-echo pattern makes the single failed call read as several partial successes -- verified by ground-truth recount, not by the loop's own printed lines.
|
Working on this --- paws off until I'm done. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Review finding on #1371: 'it' had no unambiguous antecedent. Its nearest grammatical antecedent was the REST endpoint, which does not wrap a GraphQL field -- the two are sibling APIs. Per shared/writing/ambiguous-reference.md, the remedy is to name the referent rather than reword around the pronoun. Names GraphQL's PullRequest.merged directly, and drops the 'wraps' claim about gh's internals rather than restating it, since it was not load-bearing and I had not verified it. Added the GraphQL query as a second deriving command beside the REST one; both verified against wai#57, which returns true on each.
|
Claude finished review — View run Based on my independent verification of this re-review round, here is my complete review. Code Review: PR #1371Context: This is round 2 of review. The prior round (posted 2026-08-10T01:42:49Z) found the diff technically sound but flagged one non-blocking ambiguity: the pronoun "it" in "the GraphQL field it wraps" ( What changed since: A new commit ( Verification of the fix:
This names both referents explicitly instead of using "it" to bridge them, which resolves the flagged ambiguity — the "wrap" framing that made the pronoun's antecedent unclear is dropped entirely rather than reworded around, per the author's own note that the "wraps" claim about I independently re-verified the substantive technical claims in the full diff (not just the changed sentence), since a prose fix can accidentally break something adjacent:
No new findings from this round's fix, and nothing else in the diff ( VerdictReady for merge — the one non-blocking finding from the prior review round has been correctly addressed (pronoun replaced with named referents, per this repo's own ambiguous-reference guidance), and no new issues were introduced by the fix or found elsewhere in the diff. |
Records two verified, cross-repo technical facts measured live on 2026-08-09 while working
Morrison-Lab/wai#57.memories/github.mdgh pr view --json mergedfails withUnknown JSON field: "merged"(reproduced here againstMorrison-Lab/wai#57withgh2.96.0). This was already documented in the existing bullet at line 100 (state/mergedAtas the fix undergh --json), so this is an update to that entry, not a new one.The addition: the
mergedboolean itself is real, just not undergh --json's field spelling. Verified independently:gh api repos/Morrison-Lab/wai/pulls/57 --jq '{merged, merged_at, merged_by: .merged_by.login, state}'returns{"merged":true, ...}-- REST's single-PR endpoint carries a genuinemergedboolean.memories/github-mcp-tools.mdalready documents that the GitHub MCP tool'spull_request_readgetmethod reportsmergedcorrectly too (onlylist_pull_requestsis the broken one, alwaysfalse).Cross-referenced the two entries so a reader hitting the
gh --jsonerror knows the field exists elsewhere.memories/tools.mdExtends the existing "The Bash tool runs zsh here, and zsh does not word-split unquoted expansions" entry with a second variant. The existing entry's case is "nothing errors, every row of a report reads the same wrong value" (a
[ "$2" = "MERGED" ]test going uniformly false). This is the sharper case: a stricter consumer (a GraphQL mutation expecting one node id) rejects the unsplit, newline-joined string outright and errors -- but a resolve-and-echo pattern inside the loop body can make that single failed call read as several partial successes in the transcript, since the error message itself named every id on its own line.Reproduced the underlying mechanism directly in this session's own shell:
One iteration over the whole concatenated string, confirming the same root cause the existing entry already names.
Where each landed and why
memories/github.md-- updates the existinggh pr view --jsonfield-list entry (dupe-checked viagrep -rniE "gh pr view.*--json|--json merged|Unknown JSON field|mergedAt|mergeCommit"acrossmemories/andshared/).memories/tools.md-- extends the existing zsh word-split entry (dupe-checked viagrep -rniE "word.split|word-split|IFS\b|zsh.*split|unquoted.*expansion|for id in \$"acrossmemories/andshared/; found the exact section atmemories/tools.md:570).Both files checked against
scripts/check-memory-file-size.py's 1200-line ceiling (github.md: 1075, tools.md: 1052 -- both well under; re-derived at head 6838e31 after the round-1 prose fix, which moved github.md by 3 lines).Pre-push checks run (after committing, three-dot range against
origin/main, per this corpus's own diff-scoped-check ordering)check-new-line-breaks.py(from a locald-morrison/ghacheckout, since it was retired from this repo's ownscripts/per ai-config#703): flagged one compound sentence ingithub.md, fixed, re-ran clean.python3 scripts/check-memory-file-size.py: no memory file exceeds 1200 lines.#heading-collision scan over added lines: 0 hits.python3 scripts/validate-skills.py: clean (181 skills, 181 Codex wrappers in sync).python3 scripts/check-links.py: 0 broken relative links (confirmed the new[github-mcp-tools.md](github-mcp-tools.md)link resolves).npx markdownlint-cli2@0.22.1: 0 errors.What in the framing turned out to be wrong when checked
Nothing in the framing was wrong. One thing was worth independently re-verifying rather than trusting as reported (per this corpus's own metacognitive-monitoring conventions): I reproduced both underlying mechanisms myself rather than only transcribing the report -- the
gh --json mergederror directly againstwai#57, the RESTmergedboolean directly against the same PR, and the zsh non-word-splitting directly in this session's own shell. All three matched what was reported. I also confirmedwai#57is real (docs/offline-agent-corrections, merged) rather than assuming the PR number cited in the framing was accurate.