Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…rmissions Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor semantic function clustering in pkg/workflow
refactor(workflow): resolve 8 semantic function clustering issues in pkg/workflow
Feb 26, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors pkg/workflow by relocating semantically misplaced helpers, introducing shared utilities to reduce repeated patterns, and aligning validation/error-aggregation behavior across the workflow compiler.
Changes:
- Relocates helpers (
isValidFullSHA,collectPackagesFromWorkflow,validateTargetRepoSlug) into more appropriate domain files and updates call sites. - Adds shared helpers (
Compiler.emitWarning,findWriteScopesForPolicy,validateMountStrings) to deduplicate repeated logic across multiple validators. - Standardizes validation error aggregation by migrating several validators to
NewErrorCollectorand consolidates firewall validation into a single file.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/validation_helpers.go | Adds shared SHA validation and shared mount-validation loop; removes validateTargetRepoSlug from generic helpers. |
| pkg/workflow/strict_mode_validation.go | Switches strict permission write-scope detection to shared findWriteScopesForPolicy. |
| pkg/workflow/safe_outputs_target_validation.go | Moves validateTargetRepoSlug into safe-outputs domain and changes return type to error. |
| pkg/workflow/runtime_validation.go | Migrates runtime/container validation to NewErrorCollector; removes collectPackagesFromWorkflow from validation file. |
| pkg/workflow/permissions_operations.go | Introduces findWriteScopesForPolicy helper for consistent write-scope checks. |
| pkg/workflow/package_extraction.go | Relocates collectPackagesFromWorkflow into extraction-focused code. |
| pkg/workflow/npm_validation.go | Migrates npx validation error aggregation to NewErrorCollector. |
| pkg/workflow/network_firewall_validation.go | Removes standalone firewall validation file (function moved to firewall_validation.go). |
| pkg/workflow/mcp_config_validation.go | Reuses shared validateMountStrings for MCP mount validation messaging. |
| pkg/workflow/frontmatter_extraction_yaml.go | Uses Compiler.emitWarning to centralize warning emission + counting. |
| pkg/workflow/firewall_validation.go | Absorbs validateNetworkFirewallConfig and adds docs import for error messaging. |
| pkg/workflow/features_validation.go | Removes SHA helper/regex from feature validation after relocation. |
| pkg/workflow/engine_firewall_support.go | Uses Compiler.emitWarning instead of repeated stderr + counter logic. |
| pkg/workflow/data/action_pins.json | Adds an additional pinned action entry (anchore/sbom-action@v0). |
| pkg/workflow/dangerous_permissions_validation.go | Reuses findWriteScopesForPolicy to unify write-permission detection logic. |
| pkg/workflow/create_pull_request.go | Updates validateTargetRepoSlug call site for error return type. |
| pkg/workflow/create_issue.go | Updates validateTargetRepoSlug call site for error return type. |
| pkg/workflow/create_discussion.go | Updates validateTargetRepoSlug call site for error return type. |
| pkg/workflow/compiler_orchestrator_tools.go | Uses Compiler.emitWarning to deduplicate warning emission. |
| pkg/workflow/compiler.go | Adds Compiler.emitWarning helper and updates internal warning call sites. |
| pkg/workflow/close_entity_helpers.go | Updates validateTargetRepoSlug call site for error return type. |
| pkg/workflow/agent_validation.go | Uses Compiler.emitWarning for unsupported web-search warning emission. |
| pkg/workflow/add_reviewer.go | Updates validateTargetRepoSlug call site for error return type. |
| pkg/workflow/add_comment.go | Updates validateTargetRepoSlug call site for error return type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated semantic analysis of
pkg/workflowidentified misplaced functions, near-duplicate patterns, and missing helpers causing repetition across 15+ call sites. This PR addresses all 8 actionable findings.Function Relocations
isValidFullSHA+shaRegex:features_validation.go→validation_helpers.go(general-purpose utility; was also called from unrelatedaction_pins.go)collectPackagesFromWorkflow:runtime_validation.go→package_extraction.go(pure extraction helper with no validation logic)validateTargetRepoSlug:validation_helpers.go→safe_outputs_target_validation.go; return type changed frombooltoerrorto match the rest of the file; 6 callers updatedNew Shared Helpers
emitWarning(msg string)on*Compiler(compiler.go): eliminates 10+ repeated two-linerfmt.Fprintln(os.Stderr, console.FormatWarningMessage(msg))+c.IncrementWarningCount()across 5 filesfindWriteScopesForPolicy(permissions *Permissions, scopes []PermissionScope) []PermissionScopeinpermissions_operations.go: shared byfindWritePermissions(dangerous_permissions) andvalidateStrictPermissions(strict_mode), which previously used two divergent implementations for the same semantic queryvalidateMountStrings(mounts []string, docsURL string) []stringinvalidation_helpers.go: shared core loop betweenvalidateMCPMountsSyntaxandvalidateMountsSyntax(both iterate mounts, callvalidateMountStringFormat, and distinguish format vs mode errors via the same sentinel)Error Aggregation Consistency
validateNpxPackages,validateContainerImages, andvalidateRuntimePackagesmigrated from manualvar errors []string/append/strings.Join/NewValidationErrortoNewErrorCollector, matching the pattern already used indispatch_workflow_validation.goandstrict_mode_validation.go.File Consolidation
network_firewall_validation.go(single function:validateNetworkFirewallConfig) merged intofirewall_validation.go; the two files covered the sameNetworkPermissions/Firewallstruct domain.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/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(http block)/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 GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/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 /home/REDACTED/go/bin/bash node js/f�� i/install.sh bash /opt/hostedtoolcache/node/24.13.1/x64/bin/node --noprofile GOPROXY /usr/bin/git node(http block)https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --noprofile cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha -json 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/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/11bd71901bbe5b1630ceea73d27597364c9af683 --jq .object.sha -json GO111MODULE $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v3/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --noprofile(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel x_amd64/vet /usr/bin/git k/gh-aw/gh-aw/pkgit k/gh-aw/gh-aw/pkrev-parse x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git o actions/setup-git --others 64/pkg/tool/linu--show-toplevel git(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha copilot/refactor-semantic-functi-s(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha git status --porcelain --ignore-submodules | head -n 10(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -unreachable=false /tmp/go-build836097165/b047/vet.cfg 097165/b299/vet.cfg dd6f72-4e4a-4f91git(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v5/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --noprofile(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha e=false(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -unreachable=false /tmp/go-build836097165/b096/vet.cfg /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet --get-regexp --local ache/go/1.25.0/x--show-toplevel /opt/hostedtoolcache/go/1.25.0/x228885d3daf8178a3795af6ad60d1fc7d4f3fd65..HEAD -ato�� -bool -buildtags /opt/hostedtoolcache/node/24.13.1/x64/bin/bash -errorsas -ifaceassert -nilfunc bash(http block)https://api.github.com/repos/actions/checkout/git/ref/tags/v6/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha e=false GO111MODULE 64/bin/go GOINSECURE %H %ct %D GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh(http block)https://api.github.com/repos/actions/github-script/git/ref/tags/v7/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go ache�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD ode-gyp-bin/node-json go(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD FFiles,SFiles,Sw-json go ache�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v7 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check 64/bin/go **/*.ts **/*.json --ignore-path go(http block)https://api.github.com/repos/actions/github-script/git/ref/tags/v8/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha git status --porcelain --ignore-submodules | head -n 10(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha git status --porcelain --ignore-submodules | head -n 10 rty 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -unreachable=false /tmp/go-build836097165/b043/vet.cfg /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet d -n 10(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/4dc6199c7b1a012772edbd06daecab0f50c9053c --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check r: $owner, name: $name) { hasDiscussionsEnabled } } **/*.ts **/*.json --ignore-path go(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha on k/gh-aw/gh-aw/pkg/workflow/add_reviewer.go 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel 64/pkg/tool/linux_amd64/vet /usr/bin/tr --noprofile cfg 64/pkg/tool/linu--show-toplevel tr [:up�� [:lower:] 64/pkg/tool/linux_amd64/vet 1/x64/bin/node --noprofile(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha -json GOMOD 64/bin/go tierignore GO111MODULE 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v5/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha 32b091ecc75c3eb4GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGOPROXY env 110033/b402/_pkgGOSUMDB GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v5 --jq .object.sha d7ab9ec12dbe903eGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGOPROXY env 110033/b408/_pkgGOSUMDB GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/setup-go/git/ref/tags/v6/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD erignore go(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ache�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore(http block)https://api.github.com/repos/actions/setup-node/git/ref/tags/v4/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha from .github/aw to pkg/workflow/data/action_pins.json..."(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha tags/v5 64/pkg/tool/linux_amd64/vet /usr/bin/git --noprofile cfg 64/pkg/tool/linu--show-toplevel git diff�� --stat 228885d3daf8178a3795af6ad60d1fc7d4f3fd65..HEAD 1/x64/bin/node --noprofile(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha GOPATH go 64/bin/go tierignore GO111MODULE 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/actions/setup-node/git/ref/tags/v6/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env heck '**/*.cjs' GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /hom�� --check **/*.cjs 64/bin/go **/*.json --ignore-path ../../../.prettiinspect go(http block)https://api.github.com/repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b/usr/bin/gh gh api /repos/astral-sh/setup-uv/git/ref/tags/eac588ad8def6316056a12d4907a9d4d84ff7a3b --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go ache�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/docker/build-push-action/git/ref/tags/v6/usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check 64/bin/go **/*.ts **/*.json --ignore-path node(http block)/usr/bin/gh gh api /repos/docker/build-push-action/git/ref/tags/v6 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check r: $owner, name: $name) { hasDiscussionsEnabled } } **/*.ts **/*.json --ignore-path git(http block)https://api.github.com/repos/docker/login-action/git/ref/tags/v3/usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check r: $owner, name: $name) { hasDiscussionsEnabled } } **/*.ts **/*.json --ignore-path node(http block)/usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check r: $owner, name: $name) { hasDiscussionsEnabled } } **/*.ts **/*.json --ignore-path golangci-lint(http block)https://api.github.com/repos/docker/metadata-action/git/ref/tags/v5/usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check 64/bin/go **/*.ts **/*.json --ignore-path /bin/sh(http block)/usr/bin/gh gh api /repos/docker/metadata-action/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh -c "prettier" --check '**/*.cjs' '*GOINSECURE GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go git(http block)https://api.github.com/repos/docker/setup-buildx-action/git/ref/tags/v3/usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh -c npx prettier --check '**/*.cjs' GOINSECURE GOPROXY r: $owner, name: $name) { hasDiscussionsEnabled } } GOSUMDB GOWORK 64/bin/go node(http block)/usr/bin/gh gh api /repos/docker/setup-buildx-action/git/ref/tags/v3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node /opt�� prettier --check 64/bin/go **/*.ts **/*.json --ignore-path go(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/a70c5eada06553e3510ac27f2c3bda9d3705bccb --jq .object.sha heck '**/*.cjs' GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha HEAD(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel bash /usr/bin/git --noprofile(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env nxGvlmA2K GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ortcfg(http block)https://api.github.com/repos/githubnext/agentics/git/ref/tags//usr/bin/gh gh api /repos/githubnext/agentics/git/ref/tags/# --jq .object.sha ck '**/*.cjs' '*GOINSECURE 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/nonexistent/action/git/ref/tags/v999.999.999/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha HEAD(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel qpNXUOr2HjTe /usr/bin/git --noprofile(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(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>[refactor] Semantic Function Clustering Analysis: Misplaced Functions and Duplicate Patterns in pkg/workflow</issue_title>
<issue_description>Automated semantic analysis of the
pkg/directory (563 non-test Go files across 18 packages) identified concrete refactoring opportunities in thepkg/workflowpackage. Below are actionable findings organized by priority.Summary
workflow, 192 incli, 37 inparser, 27 inconsole, 27 in smaller utility packages)Issue 1:
validateTargetRepoSlugMisplaced invalidation_helpers.goFile:
pkg/workflow/validation_helpers.go:186Function:
func validateTargetRepoSlug(targetRepoSlug string, log *logger.Logger) boolProblem:
validation_helpers.goalongside generic validators (ValidateRequired,ValidateMaxLength,ValidateInList, etc.) but is specific to the safe-outputs GitHub entity domainboolinstead oferrorlike every other function in the fileadd_comment.go,add_reviewer.go,close_entity_helpers.go,create_discussion.go,create_issue.go,create_pull_request.goRecommendation: Move to
pkg/workflow/safe_outputs_validation.go(orsafe_outputs_target_validation.go) and align the return type toerror.Issue 2:
collectPackagesFromWorkflowis Extraction Logic, Not ValidationFile:
pkg/workflow/runtime_validation.go:196Function:
func collectPackagesFromWorkflow(workflowData *WorkflowData, extractor func(string) []string, toolCommand string) []stringProblem:
[]stringruntime_validation.go, surrounded by validation methods likevalidateExpressionSizes,validateContainerImages,validateRuntimePackagespackage_extraction.go,npm.go,pip.go)Recommendation: Move to
pkg/workflow/package_extraction.go.Issue 3:
isValidFullSHADefined in Wrong Domain FileFile:
pkg/workflow/features_validation.go:96Function:
func isValidFullSHA(s string) boolProblem:
features_validation.go(feature-flag value validation) but also called frompkg/workflow/action_pins.go:165, which is a completely different domain (action pin management)Recommendation: Move to
pkg/workflow/validation_helpers.goorpkg/workflow/strings.go.Issue 4: Near-Duplicate Mount Validation Functions
Files:
pkg/workflow/sandbox_validation.go:24—func validateMountsSyntax(mounts []string) errorpkg/workflow/mcp_config_validation.go:299—func validateMCPMountsSyntax(toolName string, mountsRaw any) errorProblem:
Both functions:
validateMountStringFormat(mount)fromvalidation_helpers.gosource == "" && dest == "" && mode == ""sentinel to distinguish error typesThe only differences are:
validateMCPMountsSyntaxnormalizes a[]any/[]stringinput and addstoolNamecontext;validateMountsSyntaxworks directly on[]string. Both carry separate doc-URL references (constants.DocsSandboxURLvsconstants.DocsToolsURL).View Duplicate Logic Pattern