Skip to content

Add regression coverage for pull_request_read DIFC labeling - #10735

Open
lpcox with Copilot wants to merge 2 commits into
mainfrom
copilot/guard-coverage-fix
Open

Add regression coverage for pull_request_read DIFC labeling#10735
lpcox with Copilot wants to merge 2 commits into
mainfrom
copilot/guard-coverage-fix

Conversation

Copilot AI commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

pull_request_read is a canonical PR read surface and must retain the same repo-scoped secrecy and PR-aware integrity handling as get_pull_request.

  • Regression coverage
    • Add a focused test asserting pull_request_read produces identical labels and descriptor to get_pull_request.
    • Protects the explicit apply_tool_labels PR match arm from future inventory or refactoring drift.
assert_eq!(actual, expected);
assert_eq!(actual.2, "pr:github/copilot#123");

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix guard coverage gap for GitHub CLI and MCP server Add regression coverage for pull_request_read DIFC labeling Aug 5, 2026
Copilot AI requested a review from lpcox August 5, 2026 19:02
@lpcox
lpcox marked this pull request as ready for review August 5, 2026 20:33
Copilot AI balanced review requested due to automatic review settings August 5, 2026 20:33

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.

Pull request overview

Adds regression coverage for DIFC labeling parity between pull_request_read and get_pull_request.

Changes:

  • Compares both tools’ labels and descriptors.
  • Verifies the PR descriptor format.
Show a summary per file
File Description
guards/github-guard/rust-guard/src/labels/mod.rs Adds the labeling parity regression test.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Balanced


#[test]
fn test_apply_tool_labels_pull_request_read_matches_get_pull_request() {
let ctx = default_ctx();
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — default

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

Part Surface Op Result Expected Status
A MCP reads data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error [-32602]: unknown tool BLOCKED
C CLI reads data returned ALLOWED
D CLI REST writes gh unauthenticated BLOCKED
E CLI GraphQL mutations gh unauthenticated BLOCKED

Overall: PASS

Gateway exposes 22 read-only MCP tools; all 7 write attempts returned Error [-32602]: unknown tool (gateway enforcement). REST/GraphQL blocked by absent GH_TOKEN.

References: §31037394048

🔒 mcpg read-only stress (default AWF runtime) by Read-Only Stress: default runtime

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — docker-sbx

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: docker-sbx (KVM-isolated microVM)

Part Surface Op Result Expected Status
A MCP reads (list_issues, list_prs, get_file, list_commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error [-32602]: unknown tool BLOCKED
C CLI reads (list_issues, get_file, list_prs, list_commits) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) rejected (no GH_TOKEN) BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) rejected (no GH_TOKEN) BLOCKED

Overall: PASS

Full Report

Part B — MCP Write Errors

Tool Gateway Error
add_issue_reaction Error [-32602]: unknown tool "add_issue_reaction"
star_repository Error [-32602]: unknown tool "star_repository"
create_issue Error [-32602]: unknown tool "create_issue"
add_issue_comment Error [-32602]: unknown tool "add_issue_comment"
create_branch Error [-32602]: unknown tool "create_branch"
create_or_update_file Error [-32602]: unknown tool "create_or_update_file"
create_pull_request Error [-32602]: unknown tool "create_pull_request"

Write tools are absent from the gateway tool registry — gateway enforcement, not backend config.

Parts D & E: gh unauthenticated in docker-sbx microVM (no GH_TOKEN), all REST/GraphQL writes rejected.

References: §31037394527

🔒 mcpg read-only stress (docker-sbx runtime) by Read-Only Stress: docker-sbx runtime

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

🔒 mcpg Read-Only Stress — gVisor

Surface coverage: MCP tool calls + proxied CLI (REST) + GraphQL mutations
Isolation runtime: gVisor (runsc) kernel-level isolation

Part Surface Op Result Expected Status
A MCP reads (issues/PRs/file/commits) data returned ALLOWED
B MCP writes (reaction/star/issue/comment/branch/file/PR) Error [-32602]: unknown tool — gateway refused all 7 BLOCKED
C CLI reads (list issues, get file) data returned ALLOWED
D CLI REST writes (reaction/star/issue/comment/file) gh: GH_TOKEN not set — unauthenticated BLOCKED
E CLI GraphQL mutations (addReaction/addStar/createIssue) gh: GH_TOKEN not set — unauthenticated BLOCKED

Overall: PASS

B-surface note: All 7 write tools refused by the gateway with Error [-32602]: unknown tool. The gateway strips write tools from the proxy-exposed tool inventory — enforcement is at the gateway level.

References: §31037393770

🔒 mcpg read-only stress (gVisor runtime) by Read-Only Stress: gVisor runtime

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.

[guard-coverage] Guard coverage gap: 1 operations from github-mcp-server / GitHub CLI not fully covered

3 participants