Repository navigation
fix(protocol): prs_for_issue and issue_for_pr work on a real gh (#89) - #93
Merged
Merged
Conversation
They asked gh pr list and gh pr view for authorAssociation, which is not a PR field in any gh release, so both failed with 'Unknown JSON field'. They now read the REST pull request, which has author_association and user.login, and apply the same trust rule through trusted_jq. issue_for_pr reads GitHub's own issue links with gh 2.72 or newer and still reads the description without it. Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #89.
What
prs_for_issueandissue_for_praskedgh pr listandgh pr viewforauthorAssociation. That is not a PR field in anyghrelease, so on a realghboth fail withUnknown JSON field, and an agent cannot find the PR that belongs to an issue. That is what stopsimplement-github-issuefrom opening a second PR for an issue that already has one, and whatreconcile-github-issuesuses to settleagent:pr-openissues.prs_for_issuereads the REST pull requests (gh api repos/{owner}/{repo}/pulls?state=all, two pages of 100, so the same 200 newest as before). They carryauthor_associationanduser.login, so the existingtrusted_jqapplies unchanged. State is mapped back toOPEN|MERGED|CLOSED, so the output is the same.issue_for_prreads the REST pull request for the description and the author, andgh pr view --json closingIssuesReferencesfor GitHub's own links.closingIssuesReferencesneedsgh2.72 or newer (I checked the release sources: 2.71 lacks it, 2.72 has it). With an olderghonly that "Unknown JSON field" error is tolerated, and the description is still read forCloses #Nand a trusted marker. Any other failure still fails the function._trusted_json_jq, which only existed for this, is removed.ghis. A changeset is included.One behaviour change
issue_for_prnow prints the issue numbers in numeric order (3 15 16), where it sorted them as strings (15 16 3). Nothing in the skills depends on the order.Verified
gh(2.63.2) on this repository, read-only:prs_for_issue 87gives92 MERGED,prs_for_issue 86gives90 MERGED,issue_for_pr 92gives87,issue_for_pr 91gives69, andissue_for_pr 999999fails with exit 1. The old functions fail on the sameghwithUnknown JSON field: "authorAssociation". Myghis older than 2.72, so this exercised the fallback path. The 2.72+ path is covered by the stub tests.tests/lib.test.shagainst the oldlib.sh: 16 checks fail. The stub now refusesauthorAssociationas a PR field the wayghdoes, serves the REST endpoints with paging, and has new checks for a MEMBER's marker, GitHub's own links joined with the description, an oldgh, a missing PR, a PR on the second page, and a PR past the 200 newest.npm run checkpasses: 177 shell tests (168 before), 435 node tests.This is the fix #88 was waiting on: once the stub is replaced by the simulator, which rejects unknown
--jsonfields, these two functions no longer break it.