Skip to content

[test-improver] Improve tests for MCP sdk method dispatch - #15452

Merged
lpcox merged 1 commit into
mainfrom
test-improver/sdk-dispatch-assert-cc6e0ecda60bf84e
Oct 24, 2026
Merged

lpcox merged 1 commit into
mainfrom
test-improver/sdk-dispatch-assert-cc6e0ecda60bf84e

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

File: internal/mcp/sdk_method_dispatch_test.go

TestSendRequestWithServerID_AgentTags_PlainJSONError used a vacuous if err != nil {...} else {...} that accepted any outcome. Replaced with deterministic testify assertions: require.NoError, require.NotNil(resp), and assert.NotNil(resp.Error) (an HTTP 500 surfaces as a JSON-RPC error response).

Coverage: package internal/mcp was already 99.3%; unchanged. The change tightens the assertion strength only.

Verification: go vet and gofmt are clean. go test -count=3 -run TestSendRequestWithServerID_AgentTags ./internal/mcp/ passes. I did not re-run the full package suite after the edit.

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • thishostdoesnotexist12345.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "thishostdoesnotexist12345.com"

See Network Configuration for more information.

Generated by Test Improver Β· copilot Β· auto Β· ~23 AIC Β· ⊞ 8.7K Β· β—·

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lpcox
lpcox marked this pull request as ready for review October 24, 2026 14:24
Copilot AI max review requested due to automatic review settings October 24, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟒 Approval recommended

The focused test-only change matches the existing HTTP error-response contract and introduces no identified blocking issues.

No open issues πŸŽ‰

What changed in this PR

Strengthens the MCP method-dispatch test by replacing permissive branching with deterministic assertions for HTTP 500 handling. Production behavior and coverage remain unchanged.

Changes:

  • Require no Go error and a non-nil response.
  • Assert that the response contains a JSON-RPC error.
File Description
internal/​mcp/​sdk_method_dispatch_test.go Tightens assertions for the plain JSON HTTP error response.

Review effort: Max

@github-actions

Copy link
Copy Markdown
Contributor Author

πŸ”’ mcpg Read-Only Stress β€” default

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: default (normal container isolation)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_pull_requests, get_file_contents, list_commits) data returned ALLOWED βœ…
B MCP writes (star_repository, issue_write, add_issue_comment, create_branch, create_or_update_file, create_pull_request) all 6 ABSENT from 23-tool catalog BLOCKED ⚠️
C CLI reads (via github proxy on PATH) data returned ALLOWED βœ…
D CLI REST writes (gh api) gh CLI unauthenticated, no attempt made BLOCKED ⚠️
E CLI GraphQL mutations (gh api graphql) gh CLI unauthenticated, no attempt made BLOCKED ⚠️

Overall: INCONCLUSIVE

No write leaked through mcpg in any surface tested. However:

  • Part B: the 6 targeted write tools were entirely absent from the 23-tool read-only catalog exposed via the github CLI proxy (get_commit, get_file_contents, get_label, get_latest_release, get_release_by_tag, get_tag, issue_read, list_branches, list_commits, list_issue_fields, list_issue_types, list_issues, list_pull_requests, list_releases, list_repository_collaborators, list_starred_repositories, list_tags, pull_request_read, search_code, search_commits, search_issues, search_pull_requests, search_repositories). This proves backend/toolset configuration excludes writes but does not independently confirm the gateway's own call-time blocking layer, since the write call never reaches a write-capable backend.
  • Parts D/E: gh auth status reported 'not logged into any GitHub hosts' and gh api calls returned 'set GH_TOKEN' errors β€” gh was fully unauthenticated (reads and writes both unavailable), so the token-scope write boundary could not be exercised this run.

No reaction, star, issue, comment, branch, file, or PR was created. Full detail in workflow artifact readonly-stress-40041749448.txt.

Run: https://github.com/github/gh-aw-mcpg/actions/runs/40041749448

πŸ”’ mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@lpcox
lpcox merged commit 09201da into main Oct 24, 2026
30 of 33 checks passed
@lpcox
lpcox deleted the test-improver/sdk-dispatch-assert-cc6e0ecda60bf84e branch October 24, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants