Refactor duplicated owner/repo/number parsing in REST backend caller#6751
Merged
Conversation
Closed
6 tasks
Copilot
AI
changed the title
[WIP] Refactor duplicate numeric argument extraction in restBackendCaller
Refactor duplicated owner/repo/number parsing in REST backend caller
May 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors duplicated REST backend argument parsing for GitHub issue and pull request reads into a shared helper, reducing copy/paste while preserving existing API path behavior and error shapes.
Changes:
- Added
extractOwnerRepoNumberto parseowner,repo, and string/JSON-number resource IDs. - Updated
pull_request_readandissue_readbranches to use the helper. - Added focused unit coverage for helper behavior and error formatting.
Show a summary per file
| File | Description |
|---|---|
internal/proxy/proxy.go |
Introduces shared owner/repo/number parsing and applies it to PR and issue read tool calls. |
internal/proxy/rest_backend_caller_tool_test.go |
Adds table-driven tests for string IDs, float64 IDs, and missing argument errors. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 0
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.
restBackendCaller.CallToolhad duplicated logic for extractingowner,repo, and numeric resource IDs from JSON args in thepull_request_readandissue_readbranches. Both paths implemented the same string/float64fallback behavior, which made future changes easy to miss and encouraged more copy/paste as REST tools expand.Shared argument parsing
internal/proxy/proxy.goto parse:ownerrepoCall site cleanup
pull_request_readto delegatepullNumberparsing to the helper.issue_readto delegateissue_numberparsing to the same helper.Focused coverage
float64JSON number input