[test] Add tests for proxy.MatchRoute uncovered route patterns#3115
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
[test] Add tests for proxy.MatchRoute uncovered route patterns#3115github-actions[bot] wants to merge 1 commit intomainfrom
github-actions[bot] wants to merge 1 commit intomainfrom
Conversation
Cover 17 route patterns that were not exercised by existing tests: - Environment-scoped Actions secrets and variables (list_environment_config) - Org-scoped Actions secrets, variables, and named variable (list_org_config) - Individual discussion (list_discussions with discussion_number) - Discussion comments (get_discussion_comments) - Commit check-suites (pull_request_read, same tool as check-runs) - User SSH signing keys and GPG keys (get_me) - Actions variable accessed by name (list_variables optional suffix) - Query string stripping for uncovered routes - Paths that match no route (nil return) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Apr 3, 2026
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.
Test Coverage Improvement:
proxy.MatchRouteFunction Analyzed
internal/proxyMatchRoute(inrouter.go)Why This Function?
MatchRouteis the central REST routing function — every GitHub API request flows through it to determine which DIFC guard tool to apply. Several route categories added to the route table (router.go) had no corresponding tests inproxy_test.goorproxy_coverage_test.go, creating blind spots in route correctness verification.Tests Added
The new file
internal/proxy/router_uncovered_routes_test.goaddsTestMatchRoute_UncoveredRouteswith 17 table-driven test cases covering:/repos/{owner}/{repo}/environments/{env}/secretsand.../variables→list_environment_config/orgs/{org}/actions/secrets,.../variables, and.../variables/{name}→list_org_config/repos/{owner}/{repo}/discussions/{number}→list_discussionswithdiscussion_number/repos/{owner}/{repo}/discussions/{number}/comments→get_discussion_comments/repos/{owner}/{repo}/commits/{sha}/check-suites→pull_request_read(same tool ascheck-runs)/user/ssh_signing_keys,/user/gpg_keys→get_me/repos/{owner}/{repo}/actions/variables/{name}→list_variables?per_page=30suffix/unknown-path,/search/users,/repos,/repos/only-owner,/orgs/myorg/members)Coverage Improvement
Each new test case exercises a distinct code path (route pattern match) in the route table. The nil-return tests also exercise the "no match" branch of
MatchRoute's loop which previously had no test coverage.Test Pattern
Tests follow the established table-driven pattern in the codebase (
proxy_test.go,proxy_coverage_test.go), usingtestify/assertandtestify/requirefor consistent assertion style.Generated by Test Coverage Improver
Next run should target: environment-scoped and org-scoped route patterns in handler tests, or
callBackendToolDIFC propagate-mode edge cases