Skip to content

Comments

[file-diet] Split safe_outputs_config_generation.go (1092 lines) into focused modules#16838

Merged
pelikhan merged 2 commits intomainfrom
copilot/refactor-safe-outputs-config
Feb 19, 2026
Merged

[file-diet] Split safe_outputs_config_generation.go (1092 lines) into focused modules#16838
pelikhan merged 2 commits intomainfrom
copilot/refactor-safe-outputs-config

Conversation

Copy link
Contributor

Copilot AI commented Feb 19, 2026

pkg/workflow/safe_outputs_config_generation.go had grown to 1092 lines mixing two distinct concerns: runtime validation config generation and MCP tool definition generation.

Split

safe_outputs_config_generation.go (486 lines) — config-only:

  • populateDispatchWorkflowFiles
  • generateSafeOutputsConfig

safe_outputs_tools_generation.go (613 lines, new) — MCP tool definitions:

  • generateFilteredToolsJSON
  • generateCustomJobToolDefinition
  • addRepoParameterIfNeeded
  • generateDispatchWorkflowTool

Dedicated test files

  • safe_outputs_config_generation_test.go — covers dispatch workflow config, missing_tool with issue creation, mentions config, and populateDispatchWorkflowFiles edge cases (nil, empty, .lock.yml preference)
  • safe_outputs_tools_generation_test.go — covers custom job tool schema generation (type mappings, required fields, default descriptions), repo parameter injection, dispatch workflow tool generation, and deterministic job sorting in filtered output

No logic changes — purely a mechanical split.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/bin/go git rev-�� --show-toplevel go ache/node/24.13.1/x64/bin/node -json GO111MODULE ache/go/1.25.0/x--show-toplevel ache/node/24.13.1/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw git 64/bin/go git conf�� --get remote.origin.url ptables --write ../../../**/*.jsrev-parse 64/bin/go git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha g_.a GO111MODULE tartedAt,updatedAt,event,headBranch,headSha,displayTitle GOINSECURE fileutil GOMODCACHE go env 2512-41558/test-2770045852/.github/workflows GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE ortcfg (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha /test1.md /test2.lock.yml g_.a GOINSECURE GOMOD GOMODCACHE go env runs/20260219-142512-41558/test-go1.25.0 GO111MODULE 1/x64/bin/node l GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha ue.number go /usr/bin/git -json GO111MODULE 64/bin/go git chec�� .github/workflows/test.md go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check 64/pkg/tool/linux_amd64/vet **/*.ts **/*.json --ignore-path 64/pkg/tool/linu1 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json l kflow.test GOINSECURE GOMOD GOMODCACHE kflow.test 8214�� -test.paniconexit0 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha GOMODCACHE go /opt/hostedtoolcache/node/24.13.1/x64/bin/node -json GO111MODULE 64/bin/go node /tmp�� /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/audit-workflows.md go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 1/x64/lib/node_mGOMODCACHE GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE ache/go/1.25.0/xGOMODCACHE GOINSECURE GOMOD GOMODCACHE go env '**/*.ts' '**/*.GOINSECURE GO111MODULE ache/go/1.25.0/xGOMODCACHE GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE ache/go/1.25.0/xGOMODCACHE GOINSECURE GOMOD GOMODCACHE go env '**/*.ts' '**/*.GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/setup-go/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha se 1423939/b127/vet.cfg /opt/hostedtoolcache/go/1.25.0/x/tmp/gh-aw-git-clone-3697711311 GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha 01 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE %H %ct %D GOMODCACHE go env runs/20260219-142951-53474/test-3569236121/.github/workflows GO111MODULE /home/REDACTED/work/gh-aw/gh-aw/actions/setup/node_modules/.bin/node l GOMOD GOMODCACHE node (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha SameOutput3829714804/001/stability-test.md GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 2512-41558/test-2671028610 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha ithub/workflows/blog-auditor.md GO111MODULE 1/x64/bin/node GOINSECURE %H %ct %D ca6eac743b269d3c--show-toplevel 1/x64/bin/node env -json GO111MODULE ache/node/24.13.1/x64/bin/node GOINSECURE GOMOD GOMODCACHE npx (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE cx/AERBTSiwFBTdGremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE /bin/sh (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE x_amd64/cgo GOINSECURE GOMOD GOMODCACHE x_amd64/cgo env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/xGOMODCACHE GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE go tion�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD erignore go estl�� -json GO111MODULE 64/bin/go Action pins syngit GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 2770045852/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/xGOMODCACHE GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go **/*.json --ignore-path ../../../.pretti-json sh -c npx prettier --wGOINSECURE git /node tierignore x_amd64/vet /usr/bin/git go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go **/*.ts **/*.json --ignore-path sh -c npx prettier --wGOINSECURE git 64/bin/go tierignore x_amd64/vet /usr/bin/git go (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build1821423939/b370/cli.test /tmp/go-build1821423939/b370/cli.test -test.testlogfile=/tmp/go-build1821423939/b370/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/xGOMODCACHE GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /tmp/go-build1071031815/b370/cli.test /tmp/go-build1071031815/b370/cli.test -test.testlogfile=/tmp/go-build1071031815/b370/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true --show-toplevel go /usr/bin/docker sh -c "prettier" --wriGOINSECURE docker 64/bin/go test/race-image:sh x_amd64/vet /usr/bin/git node (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/xGOMODCACHE GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name npx prettier --wGOINSECURE git 64/bin/go --show-toplevel go /usr/bin/infocmp-json node /opt�� run format:pkg-json 64/bin/go tierignore x_amd64/link /usr/bin/git /bin/sh (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>[file-diet] Refactor safe_outputs_config_generation.go (1092 lines) into focused modules</issue_title>
<issue_description>The file pkg/workflow/safe_outputs_config_generation.go has grown to 1092 lines — well above the 800-line healthy threshold — with no dedicated test file. It mixes two distinct concerns that would benefit from separation.

Current State

Metric Value
File pkg/workflow/safe_outputs_config_generation.go
Size 1092 lines
Dedicated test file ❌ None (tested indirectly via safe_outputs_test.go, safe_outputs_tools_test.go, dispatch_workflow_test.go, etc.)
Companion helpers file safe_outputs_config_generation_helpers.go (188 lines — healthy)
Full File Analysis

Function Distribution

Function Lines Domain
populateDispatchWorkflowFiles() ~40 Config generation (pre-pass for dispatch)
generateSafeOutputsConfig() ~435 Config generation (runtime validation rules JSON)
generateCustomJobToolDefinition() ~87 Tools JSON generation (MCP tool schema)
generateFilteredToolsJSON() ~251 Tools JSON generation (filtering + assembly)
addRepoParameterIfNeeded() ~156 Tools JSON generation (repo param injection)
generateDispatchWorkflowTool() ~94 Tools JSON generation (dispatch workflow schema)

Two Distinct Domains

Domain 1 – Runtime validation config (generateSafeOutputsConfig, populateDispatchWorkflowFiles): Produces the JSON blob embedded in compiled workflows that the safe-outputs handler reads at runtime to validate tool calls (max counts, allowed labels, target repos, etc.).

Domain 2 – MCP tools JSON (generateFilteredToolsJSON, generateCustomJobToolDefinition, addRepoParameterIfNeeded, generateDispatchWorkflowTool): Produces the JSON array of MCP tool definitions exposed to the AI agent, including dynamic dispatch-workflow tools and custom safe-job tools.

Complexity Hotspots

  • generateSafeOutputsConfig (lines 58–492): 435-line monolithic function with ~35 if-branches, one for each safe-output type. Each branch calls a helper but the accumulation makes the function hard to navigate.
  • addRepoParameterIfNeeded (lines 840–995): 156-line switch statement that duplicates config.AllowedRepos + config.TargetRepoSlug extraction for every tool type. The nested switch inside a case (lines 909–963) is a complexity hotspot.

Refactoring Strategy

Proposed File Splits

  1. safe_outputs_config_generation.go (keep, trimmed)

    • Functions: populateDispatchWorkflowFiles, generateSafeOutputsConfig
    • Responsibility: Build the runtime validation config JSON embedded in compiled workflows
    • Estimated LOC: ~480 lines
  2. safe_outputs_tools_generation.go (new)

    • Functions: generateFilteredToolsJSON, generateCustomJobToolDefinition, addRepoParameterIfNeeded, generateDispatchWorkflowTool
    • Responsibility: Build the MCP tool definitions JSON exposed to the AI agent
    • Estimated LOC: ~590 lines

Additional Refactoring Opportunities

  • generateSafeOutputsConfig: Extract the per-output-type config building into small private helpers (similar to what already exists in _helpers.go) to reduce the 435-line function body.
  • addRepoParameterIfNeeded: Replace the large switch with a helper getRepoConfig(toolName string, safeOutputs *SafeOutputsConfig) (hasAllowedRepos bool, targetRepoSlug string) that uses a map-based dispatch, reducing ~120 lines to ~20.
Test Coverage Plan

No dedicated test file currently exists. Add:

  1. safe_outputs_config_generation_test.go

    • TestGenerateSafeOutputsConfig — move/consolidate tests from safe_outputs_test.go
    • TestPopulateDispatchWorkflowFiles — unit tests for the pre-pass function
    • Target coverage: ≥80%
  2. safe_outputs_tools_generation_test.go

    • TestGenerateFilteredToolsJSON — move/consolidate from safe_outputs_tools_test.go
    • TestGenerateCustomJobToolDefinition — unit tests for schema building
    • TestAddRepoParameterIfNeeded — parametric tests for each tool type
    • TestGenerateDispatchWorkflowTool — input type mapping tests
    • Target coverage: ≥80%

Implementation Guidelines

  1. Preserve Behavior: Ensure all existing functionality works identically
  2. Maintain Package-Private API: All functions are unexported — no API breakage risk
  3. Incremental Changes: Split first, then refactor internals
  4. Run Tests Frequently: Verify make test-unit passes after each step
  5. Run Linting: make lint after adding test files (watch for unused helpers)
  6. Format Code: make fmt before committing

Acceptance Criteria

  • `safe_outputs_config_gene...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

- Create safe_outputs_tools_generation.go with MCP tool definition functions:
  generateFilteredToolsJSON, generateCustomJobToolDefinition,
  addRepoParameterIfNeeded, generateDispatchWorkflowTool
- Trim safe_outputs_config_generation.go to config-only functions:
  populateDispatchWorkflowFiles, generateSafeOutputsConfig (486 lines)
- Add dedicated test files for both modules:
  safe_outputs_config_generation_test.go (167 lines)
  safe_outputs_tools_generation_test.go (232 lines)"

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor safe_outputs_config_generation.go into focused modules [file-diet] Split safe_outputs_config_generation.go (1092 lines) into focused modules Feb 19, 2026
@pelikhan pelikhan marked this pull request as ready for review February 19, 2026 14:41
Copilot AI review requested due to automatic review settings February 19, 2026 14:41
Copy link
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 refactors safe_outputs_config_generation.go from 1092 lines into two focused modules, improving code maintainability without changing any logic.

Changes:

  • Split safe_outputs_config_generation.go into two files: one for runtime validation config generation (486 lines) and one for MCP tool definition generation (613 lines)
  • Created dedicated test files for both modules with comprehensive test coverage
  • No logic changes - purely mechanical code reorganization

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
safe_outputs_config_generation.go Removed 4 functions moved to tools generation file; updated imports to remove unused dependencies (fmt, sort, stringutil)
safe_outputs_tools_generation.go New file containing 4 moved functions for MCP tool schema generation; includes all necessary imports
safe_outputs_config_generation_test.go New test file covering config generation functions (dispatch workflow, missing tool, mentions, populateDispatchWorkflowFiles edge cases)
safe_outputs_tools_generation_test.go New test file covering tools generation functions (custom job tool definitions, repo parameter injection, dispatch workflow tools, deterministic sorting)

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

@pelikhan pelikhan merged commit accaca1 into main Feb 19, 2026
130 checks passed
@pelikhan pelikhan deleted the copilot/refactor-safe-outputs-config branch February 19, 2026 14:46
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.

[file-diet] Refactor safe_outputs_config_generation.go (1092 lines) into focused modules

2 participants