Skip to content

Add GitHubMCPMode string enum and replace githubTool any with map[string]any#38945

Merged
pelikhan merged 5 commits into
mainfrom
copilot/deep-report-add-githubmcpmode-enum
Jun 13, 2026
Merged

Add GitHubMCPMode string enum and replace githubTool any with map[string]any#38945
pelikhan merged 5 commits into
mainfrom
copilot/deep-report-add-githubmcpmode-enum

Conversation

Copilot AI commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

pkg/workflow/mcp_github_config.go had ~19 functions accepting githubTool any that each immediately asserted to map[string]any, and MCP mode values were passed as bare strings with no compile-time checking.

Type enum

Added GitHubMCPMode string type with named constants to tools_types.go:

type GitHubMCPMode string

const (
    GitHubMCPModeLocal   GitHubMCPMode = "local"
    GitHubMCPModeRemote  GitHubMCPMode = "remote"
    GitHubMCPModeGHProxy GitHubMCPMode = "gh-proxy"
    GitHubMCPModeCLI     GitHubMCPMode = "cli"
)

GitHubToolConfig.Mode updated from stringGitHubMCPMode. tools_parser.go casts the parsed string at the single ingestion point.

Parameter type narrowing

All githubTool any params across mcp_github_config.go and its callers changed to map[string]any. The single .(map[string]any) assertion now happens once at each call site (from tools["github"]) rather than inside every helper. Nil maps are safe — Go returns zero values on reads.

getGitHubReadOnly() had its unused parameter removed (always returns true).

normalizeGitHubType / getGitHubType return GitHubMCPMode instead of string. All bare string comparisons (== "remote", != "gh-proxy") replaced with the typed constants.

Files changed

  • Core: tools_types.go, mcp_github_config.go
  • Renderers/compiler: mcp_renderer_github.go, mcp_renderer_types.go, mcp_renderer_factory.go, mcp_renderer.go, docker.go, compiler_yaml.go, compiler_difc_proxy.go, compiler_github_mcp_steps.go
  • Engine/env: mcp_environment.go, mcp_setup_generator.go, copilot_engine_execution.go, codex_mcp.go, claude_tools.go
  • Parsing/validation: tools_parser.go, agent_validation.go
  • Tests: 11 test files updated — struct fields narrowed to map[string]any, non-map test inputs replaced with nil

Copilot AI changed the title [WIP] Add GitHubMCPMode enum and reduce githubTool any params Add GitHubMCPMode string enum and replace githubTool any with map[string]any Jun 12, 2026
Copilot AI requested a review from pelikhan June 12, 2026 22:25
@pelikhan pelikhan marked this pull request as ready for review June 12, 2026 22:28
Copilot AI review requested due to automatic review settings June 12, 2026 22:28

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

This pull request strengthens the GitHub MCP configuration surface by introducing a typed GitHubMCPMode enum (instead of bare strings) and by narrowing many githubTool parameters from any to map[string]any, removing repeated type assertions across the workflow/MCP rendering and compilation codepaths.

Changes:

  • Add GitHubMCPMode string enum and update GitHubToolConfig.Mode from string to GitHubMCPMode.
  • Replace repeated githubTool any.(map[string]any) assertions by accepting map[string]any in helpers/renderers and asserting once at call sites.
  • Update affected workflow compilation, MCP rendering, environment, and test code to use the narrower type and typed mode comparisons.
Show a summary per file
File Description
pkg/workflow/tools_validation_test.go Updates test inputs to use map[string]any for GitHub tool config.
pkg/workflow/tools_types.go Introduces GitHubMCPMode and updates GitHubToolConfig.Mode type.
pkg/workflow/tools_parser.go Casts parsed mode string into GitHubMCPMode at ingestion.
pkg/workflow/safeoutputs_guard_policy_test.go Adjusts guard-policy tests for narrowed GitHub tool type.
pkg/workflow/mcp_setup_generator.go Asserts GitHub tool config once and uses typed mode comparisons for gateway setup behavior.
pkg/workflow/mcp_renderer.go Narrows GitHub renderer input to map[string]any via single assertion at dispatch.
pkg/workflow/mcp_renderer_types.go Updates renderer function signatures to accept map[string]any for GitHub.
pkg/workflow/mcp_renderer_github.go Updates GitHub MCP rendering to accept map[string]any and typed mode comparisons.
pkg/workflow/mcp_renderer_factory.go Updates renderer factory closures to match narrowed GitHub signature.
pkg/workflow/mcp_github_config.go Refactors GitHub tool helpers to accept map[string]any and return typed GitHubMCPMode.
pkg/workflow/mcp_environment.go Uses map[string]any GitHub tool config when deriving MCP env vars.
pkg/workflow/mcp_config_test.go Updates MCP config tests for narrowed GitHub tool config type.
pkg/workflow/github_toolset_test.go Updates toolset tests for narrowed GitHub tool config type.
pkg/workflow/github_toolset_expansion_test.go Updates toolset expansion tests for narrowed GitHub tool config type.
pkg/workflow/github_readonly_test.go Simplifies read-only test to match getGitHubReadOnly() no-arg behavior.
pkg/workflow/github_lockdown_test.go Updates lockdown test to assert GitHub tool config once.
pkg/workflow/engine_helpers_shared_test.go Updates test renderer stubs for new GitHub renderer signature.
pkg/workflow/docker.go Updates GitHub docker-image collection to use typed GitHub mode constants.
pkg/workflow/copilot_github_mcp_test.go Updates Copilot GitHub MCP tests for narrowed GitHub tool config type.
pkg/workflow/copilot_engine_test.go Updates Copilot engine tests for narrowed GitHub tool config type.
pkg/workflow/copilot_engine_execution.go Updates token derivation to use asserted map[string]any GitHub config.
pkg/workflow/compiler_yaml.go Updates lockdown env emission path to assert GitHub tool map once.
pkg/workflow/compiler_github_mcp_steps.go Updates guard-policy checks to operate on asserted GitHub tool map.
pkg/workflow/compiler_difc_proxy.go Narrows GitHub tool config plumbing for DIFC/CLI proxy policy derivation.
pkg/workflow/compiler_difc_proxy_test.go Updates DIFC proxy policy tests for narrowed GitHub tool config type.
pkg/workflow/codex_mcp.go Updates Codex MCP rendering path to assert GitHub tool map once.
pkg/workflow/claude_tools.go Uses typed GitHub mode comparisons when selecting default tool lists.
pkg/workflow/agent_validation.go Updates pi-engine mode validation to compare against typed constant.

Copilot's findings

Tip

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

  • Files reviewed: 28/28 changed files
  • Comments generated: 2

Comment thread pkg/workflow/docker.go Outdated
Comment on lines +23 to +27
if rawGithubTool, hasGitHub := tools["github"]; hasGitHub {
githubTool, _ := rawGithubTool.(map[string]any)
githubType := getGitHubType(githubTool)
// Only add if using local (Docker) mode
if githubType == "local" {
if githubType == GitHubMCPModeLocal {
Comment thread pkg/workflow/agent_validation.go Outdated
Comment on lines 202 to 204
if tools == nil || tools.GitHub == nil || tools.GitHub.Mode != GitHubMCPModeGHProxy {
return errors.New("engine 'pi' requires tools.github.mode: gh-proxy")
}
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

PR Code Quality Reviewer completed the code quality review.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Test Quality Sentinel failed during test quality analysis.

@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Design Decision Gate 🏗️ completed the design decision gate check.

@github-actions

Copy link
Copy Markdown
Contributor

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic (225 new lines in pkg/workflow/) but does not have a linked Architecture Decision Record (ADR).

📄 Draft ADR committed: docs/adr/38945-type-github-mcp-mode-enum-and-narrow-tool-config.md — review and complete it before merging.

📋 What to do next
  1. Review the draft ADR committed to your branch — it was generated from the PR diff (introducing the GitHubMCPMode enum and narrowing githubTool anymap[string]any).
  2. Complete the missing sections — add context the AI could not infer, refine the decision rationale, and confirm the alternatives reflect what you actually considered.
  3. Commit the finalized ADR to docs/adr/ on your branch.
  4. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-38945: Type GitHub MCP Mode as an Enum and Narrow Tool Config

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

❓ Why ADRs Matter

ADRs create a searchable, permanent record of why the codebase looks the way it does. A type-safety refactor like this one encodes a convention (push type assertions to the boundary; name the mode values) that future contributors will need to understand and uphold. Recording the decision now prevents the convention from silently eroding later.

📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 38945-...md for PR #38945).

🔒 This PR cannot merge until an ADR is linked in the PR body.

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · 119.1 AIC · ⌖ 9.99 AIC · ⊞ 13.8K ·

@github-actions github-actions Bot 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.

Skills-Based Review 🧠

Applied /improve-codebase-architecture, /tdd, and /grill-with-docs — commenting with refinement suggestions, no blocking issues.

📋 Key Themes & Highlights

Key Themes

  • Type-safety gap: GitHubToolConfig.Type remains string while Mode was upgraded to GitHubMCPMode — the type field accepts the same local/remote subset and should match
  • Silent mode fallthrough: getGitHubType silently defaults to local when mode: gh-proxy or mode: cli is set — intentional but not logged, unlike the type field path
  • Parse-time validation: GitHubMCPMode(mode) in tools_parser.go accepts any string without checking against the enum constants, relying on use-site log warnings instead of early detection
  • Missing boundary tests: No test asserts that gh-proxy/cli in the mode field → local transport in getGitHubType; this looks identical to the "invalid input" case without the test
  • Unenforced deprecation: GitHubMCPModeCLI carries the "legacy alias" label but emits no runtime warning; users have no signal to migrate to gh-proxy

Positive Highlights

  • ✅ Excellent reduction: 19 functions cleaned up, each .(map[string]any) assertion now at exactly one call site per function
  • getGitHubReadOnly() removing the unused parameter is the right call — the parameter was dead weight
  • github_readonly_test.go simplification is clean and correct
  • ✅ The single ingestion point in tools_parser.go for the GitHubMCPMode cast is the right pattern
  • ✅ All 11 test files updated with consistent narrowed types

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 514.8 AIC · ⌖ 14.3 AIC · ⊞ 27.8K

Allowed GitHubAllowedTools `yaml:"allowed,omitempty"`
Mode string `yaml:"mode,omitempty"`
Mode GitHubMCPMode `yaml:"mode,omitempty"`
Type string `yaml:"type,omitempty"`

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.

[/improve-codebase-architecture] Type was not updated alongside Mode — the type field accepts only local and remote, which are a subset of GitHubMCPMode. Leaving it as string is an incomplete type safety improvement.

💡 Suggested change
// Before
Type   string        `yaml:"type,omitempty"`

// After  
Type   GitHubMCPMode `yaml:"type,omitempty"`

With this change, getGitHubType and normalizeGitHubType would benefit from consistent types across both the raw-map and the parsed-struct paths. The type field is restricted to local/remote at validation anyway — give the type system a chance to enforce it.

@@ -124,10 +121,10 @@ func isGitHubCLIModeEnabled(data *WorkflowData) bool {

// normalizeGitHubType normalizes and validates GitHub MCP transport values.
// Supported values are `local` and `remote`.

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.

[/improve-codebase-architecture] The comment says "Supported values are local and remote" without explaining that gh-proxy and cli are valid GitHubMCPMode constants intentionally excluded here. A future reader may think this is an omission rather than a design choice.

💡 Suggested comment update
// normalizeGitHubType normalizes and validates GitHub MCP transport values
// for the Docker/hosted transport path.
// Supports `local` (Docker) and `remote` (hosted) only.
// CLI-proxy modes (gh-proxy, cli) are a separate concern handled
// by isGitHubCLIModeEnabled and always use the local transport type.
func normalizeGitHubType(value string) (GitHubMCPMode, bool) {

The current comment actively misleads anyone adding a new GitHubMCPMode constant: they might wonder why their new value isn\u2019t handled here.

githubConfigLog.Printf("GitHub MCP type read from legacy mode field: %s", normalizedValue)
return normalizedValue
}
}

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.

[/improve-codebase-architecture] When mode: gh-proxy or mode: cli is set, normalizeGitHubType returns ("", false) and this block silently falls through to the local default — no log message. The type field path (line 143) already logs "Unrecognized tools.github.type value" for unknown values. Consistent logging would help when debugging unexpected local mode selection.

💡 Suggested addition

After the normalizeGitHubType call in the mode path, add a log:

// gh-proxy/cli are valid modes but use local transport; CLI path is handled by isGitHubCLIModeEnabled
githubConfigLog.Printf("GitHub MCP mode %q uses local Docker transport (CLI proxy routing handled separately)", stringValue)

This prevents silent confusion when a user sets mode: gh-proxy and wonders why Docker mode is active.


if mode, ok := configMap["mode"].(string); ok {
config.Mode = mode
config.Mode = GitHubMCPMode(mode)

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.

[/improve-codebase-architecture] The cast GitHubMCPMode(mode) converts any arbitrary string — including misspellings like "gh_proxy" or "locall" — to the type without validation. The enum gives compile-time safety for code, but doesn't protect against runtime YAML input.

💡 Suggested validation

Add a simple validity check at the ingestion point:

parsedMode := GitHubMCPMode(mode)
switch parsedMode {
case GitHubMCPModeLocal, GitHubMCPModeRemote, GitHubMCPModeGHProxy, GitHubMCPModeCLI:
    config.Mode = parsedMode
default:
    // Log and leave Mode at zero value; validation errors are surfaced later.
    toolsParserLog.Printf("Unknown tools.github.mode value: %q", mode)
}

This surfaces misconfiguration early and in one place, consistent with how other fields handle unknown values via the githubConfigLog pattern.

// GitHubMCPModeGHProxy routes GitHub operations through the gh CLI proxy.
GitHubMCPModeGHProxy GitHubMCPMode = "gh-proxy"
// GitHubMCPModeCLI is a legacy alias for GitHubMCPModeGHProxy.
GitHubMCPModeCLI GitHubMCPMode = "cli"

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.

[/grill-with-docs] GitHubMCPModeCLI is documented as a "legacy alias" but there's no active deprecation mechanism — no validation warning is emitted when mode: cli is used in a workflow. Users won't know to migrate to mode: gh-proxy.

💡 Suggestion

In isGitHubCLIModeEnabled (or at parse time), emit a deprecation notice when cli is detected:

case GitHubMCPModeCLI:
    githubConfigLog.Print("tools.github.mode: \"cli\" is deprecated; use \"gh-proxy\" instead")
    // Optionally surface this as a compiler warning, not just a debug log
    return true

Without any signal, the "legacy" label is aspirational rather than actionable for users.

@github-actions github-actions Bot 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.

Review: GitHubMCPMode enum + map[string]any narrowing refactor

Solid cleanup — the PR consistently pushes type assertions to call sites and introduces a well-named enum type. No correctness regressions found; Go nil-map reads are safe, and the old any-based helpers had identical behaviour when passed non-map values.

Non-blocking findings (3)
  1. normalizeGitHubType error sentinel (mcp_github_config.go:130) — returns GitHubMCPMode("") with no exported constant for the zero/unknown case. See inline comment.

  2. isGitHubCLIModeEnabled is the only remaining inline assertion (mcp_github_config.go:104) — all other helpers were refactored but this function still does githubTool.(map[string]any) internally. See inline comment.

  3. GitHubToolConfig.Type is still string (tools_types.go:308) — Mode was upgraded to GitHubMCPMode but Type (same domain, same valid values) was not. See inline comment.

🔎 Code quality review by PR Code Quality Reviewer · 846.4 AIC · ⌖ 13.6 AIC · ⊞ 16.7K

case GitHubMCPModeLocal, GitHubMCPModeRemote:
return normalizedValue, true
default:
return "", false

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.

normalizeGitHubType returns GitHubMCPMode("") as its error sentinel — the zero value of the new enum type — with no exported constant for it.

💡 Suggested fix

Add a sentinel constant so the error return is self-documenting and exhaustive switch statements can cover it:

// In tools_types.go, add:
GitHubMCPModeUnknown GitHubMCPMode = ""

Then the return becomes:

default:
    return GitHubMCPModeUnknown, false

All current callers guard on the bool, so this is not a runtime bug, but introducing a type without a defined zero-value constant invites callers to silently compare == "" or use uninitialized GitHubMCPMode vars without realising they match an unintended state.

@@ -107,13 +104,13 @@ func isGitHubCLIModeEnabled(data *WorkflowData) bool {
if toolConfig, ok := githubTool.(map[string]any); ok {

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.

isGitHubCLIModeEnabled was only half-refactored — it still does its own .(map[string]any) assertion internally while every other helper function in this file was updated to accept map[string]any directly.

💡 Details

Every other helper (getGitHubType, getGitHubToken, getGitHubLockdown, getGitHubGuardPolicies, etc.) now takes map[string]any and delegates the type assertion to the call site. isGitHubCLIModeEnabled has a different signature (*WorkflowData) so it can’t be refactored the same way, but the internal assertion on line 104:

if toolConfig, ok := githubTool.(map[string]any); ok {

...is now the only place in mcp_github_config.go that does this pattern inline. Introduce a helper to extract the map (or extract it once at the top of the function alongside the existing githubTool == false guard) to be consistent with the rest of the file and avoid repeating the pattern if a future caller needs to handle a validated map[string]any.

type GitHubToolConfig struct {
Allowed GitHubAllowedTools `yaml:"allowed,omitempty"`
Mode string `yaml:"mode,omitempty"`
Mode GitHubMCPMode `yaml:"mode,omitempty"`

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.

GitHubToolConfig.Mode is now typed as GitHubMCPMode but Type (line 309) remains string, even though both fields encode the same domain concept and getGitHubType() reads from both.

💡 Details

getGitHubType() in mcp_github_config.go reads the "type" key first and falls back to "mode". Both fields describe the MCP transport mode (local/remote), yet one is GitHubMCPMode and the other is plain string. A future reader will not know why these differ or which is canonical. Either:

  • Type the Type field as GitHubMCPMode (preferred, enforces the same validation at parse time), or
  • Add a comment explaining that Type is retained as string intentionally (e.g., if it accepts values GitHubMCPMode does not).

@github-actions

Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 92/100 — Excellent

Analyzed 19 modified test function(s) across 11 test files: 19 design tests, 0 implementation tests, 1 guideline note (pre-existing missing assertion message).

📊 Metrics & Test Classification (19 tests analyzed)
Metric Value
New/modified tests analyzed 19 (all modified; no new test functions added)
✅ Design tests (behavioral contracts) 19 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 12 (63%)
Duplicate test clusters 0
Test inflation detected No (test lines: net −12; production lines: +189)
🚨 Coding-guideline violations 0 hard violations (1 pre-existing note)

Test Classification Details

Test File Classification Issues Detected
TestGetDIFCProxyPolicyJSON compiler_difc_proxy_test.go ✅ Design Table-driven; nil + empty-map cases; verifies policy JSON output
TestCopilotEngineRenderGitHubMCPConfig copilot_engine_test.go ✅ Design Table-driven; verifies rendered MCP config strings
TestRenderGitHubCopilotMCPConfig_AllowedTools copilot_github_mcp_test.go ✅ Design Table-driven; verifies rendered config content vs unexpected content
TestGetGitHubAllowedTools copilot_github_mcp_test.go ✅ Design Table-driven; includes nil-tool edge case
TestGetGitHubGuardPoliciesToolCallLimits copilot_github_mcp_test.go ✅ Design Table-driven; verifies guard policy limits ⚠️ assert.Equal missing message arg (pre-existing)
TestRenderJSONMCPConfig engine_helpers_shared_test.go ✅ Design Table-driven; verifies JSON MCP config rendering
TestRenderJSONMCPConfig_IsLastHandling engine_helpers_shared_test.go ✅ Design Verifies call ordering and isLast flag values
TestGitHubLockdownField github_lockdown_test.go ✅ Design Table-driven; verifies lockdown field extraction
TestGetGitHubReadOnly github_readonly_test.go ✅ Design Single assertion; appropriate because function now takes no args and is a constant
TestGetGitHubToolsetsExpandsDefault github_toolset_expansion_test.go ✅ Design Table-driven; verifies toolset default expansion
TestGetGitHubToolsets github_toolset_test.go ✅ Design Table-driven; includes nil-map edge case
TestClaudeEngineGitHubToolsetsRendering github_toolset_test.go ✅ Design Table-driven; verifies YAML rendering
TestCopilotEngineGitHubToolsetsRendering github_toolset_test.go ✅ Design Table-driven; verifies YAML rendering
TestCodexEngineGitHubToolsetsRendering github_toolset_test.go ✅ Design Table-driven; verifies YAML rendering
TestGitHubToolsetsWithOtherConfiguration github_toolset_test.go ✅ Design Table-driven; verifies YAML with other config
TestGenerateGitHubMCPConfig mcp_config_test.go ✅ Design Table-driven; includes nil-tool edge case
TestMCPConfigurationEdgeCases mcp_config_test.go ✅ Design Table-driven edge cases; verifies trailing comma handling
TestDeriveSafeOutputsGuardPolicyFromGitHub safeoutputs_guard_policy_test.go ✅ Design Table-driven; nil + empty-map cases; has assertion messages ✅
TestGetDIFCProxyPolicyJSONWithReactions tools_validation_test.go ✅ Design Table-driven; verifies policy JSON with reactions config

Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 19 tests — all unit (//go:build !integration)
  • 🟨 JavaScript (*.test.cjs, *.test.js): 0 tests changed
⚠️ Notes — Non-blocking (1 item)

⚠️ TestGetGitHubGuardPoliciesToolCallLimits (pkg/workflow/copilot_github_mcp_test.go:261)

Classification: Design test (behavioral)
Note: Pre-existing assert.Equal call lacks a descriptive message argument:

assert.Equal(t, tt.expected, getGitHubGuardPolicies(tt.githubTool))

This was not introduced by this PR (the assertion was already there; only the struct field type was changed). Guideline requires: assert.Equal(t, tt.expected, actual, "descriptive context").
Suggested fix: Add a message, e.g. assert.Equal(t, tt.expected, getGitHubGuardPolicies(tt.githubTool), "guard policies for %s", tt.name).

Verdict

Check passed. 0% of modified tests are implementation tests (threshold: 30%). No mock libraries or missing build tags detected. All 19 changes are mechanical type-safety improvements (anymap[string]any) that preserve existing behavioral contracts.

📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References: §27446718830

🧪 Test quality analysis by Test Quality Sentinel · 733.7 AIC · ⌖ 20.4 AIC · ⊞ 27.2K ·

@github-actions github-actions Bot 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.

✅ Test Quality Sentinel: 92/100. Test quality is excellent — 0% of modified tests are implementation tests (threshold: 30%). All 19 test changes are mechanical type-safety refactors preserving existing behavioral contracts. Full analysis posted in the comment above.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot run pr-finisher skill

Copilot AI commented Jun 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot run pr-finisher skill

Addressed both review threads in commit fix: guard docker image pull against disabled GitHub tool and accept cli as pi engine mode:

  • docker.go: collectDockerImages now only calls getGitHubType when the type assertion to map[string]any succeeds. A false (disabled) value skips the block entirely, preventing a spurious Docker image pull.
  • agent_validation.go: validatePiEngineRequirements now accepts both GitHubMCPModeGHProxy and GitHubMCPModeCLI, making the legacy alias fully usable for the pi engine.

Local make fmt, make lint, and make test-unit all pass. CI needs a human re-trigger to confirm.

@pelikhan pelikhan merged commit 4163393 into main Jun 13, 2026
29 checks passed
@pelikhan pelikhan deleted the copilot/deep-report-add-githubmcpmode-enum branch June 13, 2026 04:44
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