Skip to content

Fix test suite for GitHub MCP toolset permission validation#2800

Merged
pelikhan merged 4 commits into
mainfrom
copilot/lint-and-fix-tests
Oct 30, 2025
Merged

Fix test suite for GitHub MCP toolset permission validation#2800
pelikhan merged 4 commits into
mainfrom
copilot/lint-and-fix-tests

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 30, 2025

Recent introduction of GitHub MCP toolset permission validation broke 150+ tests. Tests using default GitHub toolsets (issues, pull_requests, repos) now require corresponding permissions but lacked them.

Changes

Test fixtures updated

  • Added issues: read and pull-requests: read to 120+ test workflows
  • Fixed malformed frontmatter (missing closing --- markers)
  • Replaced deprecated allowed: with toolsets: in checkout optimization tests

JSON formatting

  • Fixed pkg/workflow/schemas/github-workflow.json formatting

Results

  • ✅ All linting passes
  • ✅ pkg/cli: 100% tests passing (was 0%)
  • ✅ pkg/workflow: 87% tests passing (was ~13%)

Remaining 26 failures are edge cases requiring individual investigation (network-dependent tests, complex integration scenarios).

Example fix

# Before - fails validation
permissions:
  contents: read

# After - passes validation  
permissions:
  contents: read
  issues: read
  pull-requests: read

The default GitHub MCP configuration enables [context, repos, issues, pull_requests, users] toolsets, which require corresponding permissions.

Original prompt

lint and fix tests


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits October 30, 2025 15:00
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Fix JSON formatting in pkg/workflow/schemas/github-workflow.json
- Add required permissions (issues: read, pull-requests: read) to test workflows
- Update test frontmatter to comply with default GitHub MCP toolset requirements
- Fix missing frontmatter closing markers in some tests

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Replace `allowed:` with `toolsets:` in checkout optimization tests
- Fix JSON formatting for github-workflow.json schema
- Tests now use appropriate GitHub MCP toolsets matching their permissions
- TestCheckoutOptimization now passes completely

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Lint and fix issues in test files Fix test suite for GitHub MCP toolset permission validation Oct 30, 2025
Copilot AI requested a review from pelikhan October 30, 2025 15:43
@pelikhan pelikhan marked this pull request as ready for review October 30, 2025 15:43
Copilot AI review requested due to automatic review settings October 30, 2025 15:43
@pelikhan pelikhan merged commit 01ad8a5 into main Oct 30, 2025
6 checks passed
@pelikhan pelikhan deleted the copilot/lint-and-fix-tests branch October 30, 2025 15:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes 150+ test failures caused by GitHub MCP toolset permission validation that was introduced recently. The default GitHub toolsets (issues, pull_requests, repos) now require corresponding permissions, which were missing from test workflows.

Key Changes:

  • Added issues: read and pull-requests: read permissions to 120+ test workflows
  • Fixed malformed YAML frontmatter (missing closing --- markers)
  • Updated deprecated allowed: syntax to toolsets: in checkout optimization tests
  • Updated action SHA pins in generated workflow files

Reviewed Changes

Copilot reviewed 61 out of 61 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workflow/*_test.go (40+ files) Added missing issues: read and pull-requests: read permissions to test workflow fixtures
pkg/workflow/reaction_outputs_test.go Removed duplicate closing frontmatter delimiter
pkg/workflow/permissions_import_test.go Fixed malformed frontmatter and added missing permissions
pkg/workflow/compiler_template_validation_test.go Removed duplicate closing frontmatter delimiters
pkg/workflow/checkout_optimization_test.go Replaced deprecated allowed: with toolsets: syntax
pkg/cli/*_test.go (3 files) Added missing permissions to CLI test fixtures
.github/workflows/*.lock.yml (3 files) Updated actions/setup-node SHA pin

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

---
pull-requests: read
# Content`,
expected: `{"contents":"read","issues":"write"}`,
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

The expected permissions JSON doesn't match the actual test input. The test input now includes pull-requests: read on line 298, but the expected output still only includes contents and issues. This should be updated to {\"contents\":\"read\",\"issues\":\"write\",\"pull-requests\":\"read\"}.

Suggested change
expected: `{"contents":"read","issues":"write"}`,
expected: `{"contents":"read","issues":"write","pull-requests":"read"}`,

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants