Conversation
…er issue analysis - Finding 1: Replace private removeDuplicates in pkg/parser with sliceutil.Deduplicate - Finding 2: Move renderStepFromMap from redact_secrets.go to compiler_yaml_helpers.go - Finding 3: Move formatList from github_tool_to_toolset.go to validation_helpers.go - Finding 4: Move validateTargetRepoSlug from config_helpers.go to validation_helpers.go - Finding 5: Move non-type functions from console_types.go to render.go - Finding 6: Extract Parse*Config functions from safe_output_builder.go into new safe_output_parser.go Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor duplicate detection logic in pkg/parser
refactor: semantic function clustering — eliminate duplicates and relocate outlier functions
Feb 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR performs a semantic refactoring of the codebase based on clustering analysis of 559 Go files, eliminating duplicate implementations and relocating functions to semantically appropriate files for improved maintainability.
Changes:
- Eliminated duplicate
removeDuplicatesfunction in favor of existing genericsliceutil.Deduplicate - Relocated 3 outlier functions to semantically correct files based on their purpose
- Split 2 mixed-concern files by extracting non-type functions and parser logic into dedicated files
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/schema_utilities.go | Removed duplicate removeDuplicates function |
| pkg/parser/schema_suggestions.go | Updated to use sliceutil.Deduplicate instead of local duplicate |
| pkg/workflow/redact_secrets.go | Removed renderStepFromMap (moved to yaml helpers) and unused slices import |
| pkg/workflow/compiler_yaml_helpers.go | Added renderStepFromMap YAML serialization helper and slices import |
| pkg/workflow/github_tool_to_toolset.go | Removed formatList (moved to validation helpers) |
| pkg/workflow/config_helpers.go | Removed validateTargetRepoSlug (moved to validation helpers) |
| pkg/workflow/validation_helpers.go | Added formatList and validateTargetRepoSlug validation helpers |
| pkg/console/console_types.go | Removed non-type functions and their imports (moved to render.go) |
| pkg/console/render.go | Added utility functions ToRelativePath, RenderTableAsJSON, FormatErrorWithSuggestions, renderTreeSimple, and findWordEnd |
| pkg/workflow/safe_output_builder.go | Removed parser-related types and functions, kept only builder functions |
| pkg/workflow/safe_output_parser.go | New file containing extracted parser types and functions from safe_output_builder.go |
💡 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.
Six findings from a semantic function clustering analysis of 559 Go files across
pkg/: one confirmed duplicate implementation and five functions placed in semantically incorrect files.Changes
Duplicate eliminated
pkg/parser: Removed privateremoveDuplicates— replaced withsliceutil.Deduplicate[string]at the single call site inschema_suggestions.goOutliers relocated
redact_secrets.go→compiler_yaml_helpers.go:(*Compiler).renderStepFromMapis a YAML serialization helper with no semantic relationship to secret redactiongithub_tool_to_toolset.go→validation_helpers.go:formatListis a generic error message formatter, not toolset-specific logicconfig_helpers.go→validation_helpers.go:validateTargetRepoSlugis a domain validator, not a config parser — now collocated withvalidateIntRange,ValidateRequired, etc.Mixed-concern files split
console_types.go: Moved all 5 non-type functions (ToRelativePath,RenderTableAsJSON,FormatErrorWithSuggestions,renderTreeSimple,findWordEnd) torender.go—console_types.gonow contains only type/struct definitionssafe_output_builder.go: Extracted allParse*Configfunctions and their associated types (SafeOutputTargetConfig,SafeOutputFilterConfig,CloseJobConfig,ListJobConfig, etc.) into newsafe_output_parser.go, mirroring the existingsafe_inputs_parser.go/safe_inputs_generator.gopattern;safe_output_builder.goretains onlyBuild*functionsWarning
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 nonexistent-workinit --limit node /tmp�� /tmp/TestHashConsistency_GoAndJavaScript334725920/001/test-empty-frontmatter.md go r,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,disp--show-toplevel kUvS/ctF_2_fvCuPgit flow-12345 64/bin/go git(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 0/x64/bin/node git add /tmp/file-tracker-test1317735327/existing.md 0/x64/bin/node /usr/bin/git "prettier" --chegit GOPROXY e/git git(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(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha NzgP/Ll8JiAw7kBkXZcGgNzgP(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel go 0/x64/bin/node -json GO111MODULE m/_npx/b38865467--show-toplevel github.actor }} ${{ github.acto(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(http block)/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 5356-33737/test-2304311247/.github/workflows GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha g_.a go 0/x64/bin/node -json GO111MODULE 64/bin/go git t-ha�� vaScript40492336test-logs/run-3 config /usr/bin/git remote.origin.urgit GO111MODULE 64/bin/go git(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 agent-performance-analyzer.md .cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha artifacts-summary.md .cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -unreachable=false /tmp/go-build1211350571/b092/vet.cfg 1350571/b351/vet.cfg(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(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha ithub/workflows/auto-triage-issues.md 1350571/b028/vet.cfg ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -bool -buildtags /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -errorsas -ifaceassert -nilfunc /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -ato�� -bool -buildtags /opt/hostedtoolcache/node/24.13.0/x64/bin/node -errorsas -ifaceassert -nilfunc /opt/hostedtoolcache/node/24.13.0/x64/bin/node(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 archie.md .cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha audit-workflows.md .cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -bool -buildtags /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -errorsas -ifaceassert -nilfunc /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet -uns�� tup/sh/sanitize_path.sh' ':::/usr/bin:/usr/local/bin' && echo "$PATH" /tmp/go-build1211350571/b223/vet.cfg /opt/hostedtoolcache/node/24.13.0/x64/bin/node(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 ai-moderator.md .cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha ingutil.test GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile env runs/20260225-045356-33737/test-4274889718/.github/workflows GO111MODULE g_.a l GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha ithub/workflows/archie.md config /usr/bin/git remote.origin.urgit GO111MODULE nch,headSha,disp--show-toplevel git rev-�� runs/20260225-050059-48473/test-test-logs/run-12345 go ache/node/24.13.0/x64/bin/node l GO111MODULE ache/go/1.25.0/x--show-toplevel git(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 agent-persona-explorer.md .cfg 64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-test.short=true GOINSECURE GOMOD GOMODCACHE go env runs/20260225-045356-33737/test-4274889718/.github/workflows GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go l GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha ithub/workflows/ai-moderator.md remote.origin.url /usr/bin/git */*.ts' '**/*.jsgit GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� runs/20260225-050059-48473/test-4224436023/.github/workflows go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git(http block)https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts/usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE e_modules/.bin/node GOINSECURE GOMOD GOMODCACHE go m/_n�� -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-nilfunc GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 1 --dir test-logs/run-1 go /opt/hostedtoolcache/node/24.13.0/x64/bin/node -json GO111MODULE 64/bin/go /opt/hostedtoolcache/node/24.13.rev-parse /tmp�� inputs.version go 64/pkg/tool/linux_amd64/vet -json GO111MODULE odules/npm/node_--show-toplevel 64/pkg/tool/linux_amd64/vet(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� ty-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE x_amd64/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE h GOINSECURE GOMOD GOMODCACHE go env 97 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet(http block)https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go estl�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE x_amd64/cgo GOINSECURE GOMOD GOMODCACHE x_amd64/cgo env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env /ref/tags/v8 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet(http block)https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts/usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE x_amd64/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE es/.bin/node GOINSECURE GOMOD ode-gyp-bin/sh go m/_n�� 97 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-test.short=true GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts/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)/usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go t-ha�� ithub/workflows/artifacts-summar-errorsas GO111MODULE ache/node/24.13.0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run download 3 --dir test-logs/run-3 go /usr/bin/git l GO111MODULE 64/bin/go git rev-�� --show-toplevel go 64/pkg/tool/linux_amd64/compile -json GO111MODULE es/.bin/node 64/pkg/tool/linux_amd64/compile(http block)https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts/usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/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)/usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE in/node GOINSECURE GOMOD GOMODCACHE go m/_n�� 97 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-nilfunc GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts/usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/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)/usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE k/_temp/uv-python-dir/node GOINSECURE GOMOD GOMODCACHE go m/_n�� /ref/tags/v8 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/github/gh-aw/actions/workflows/usr/bin/gh gh workflow list --json name,state,path GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 2096183/b387/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/consenv GOMODCACHE go(http block)/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 env kUvS/ctF_2_fvCuPGOSUMDB GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 2096183/b354/importcfg(http block)/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 GOMODCACHE x_amd64/vet env -json 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(http block)/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 go(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha -bool -buildtags 8745225/b433/vet.cfg -errorsas -ifaceassert -nilfunc node /tmp�� /tmp/TestHashStability_SameInputSameOutput3330027595/001/stability-test.md -tests cfg d --write 64/bin/go ache/node/24.13.0/x64/bin/node(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(http block)/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 ty-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel node /usr/bin/git --write **/*.cjs 64/bin/go git -C 5751-47326/test-2661921112/.github/workflows config cfg remote.origin.urgit git 64/bin/go false(http block)https://api.github.com/repos/nonexistent/repo/actions/runs/12345/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)/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion l GO111MODULE 64/bin/go /usr/bin/git remo�� -v go 64/pkg/tool/linux_amd64/vet -json GO111MODULE 64/bin/go 64/pkg/tool/linux_amd64/vet(http block)https://api.github.com/repos/owner/repo/actions/workflows/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 2096183/b394/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/loggenv GOMODCACHE go(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 2096183/b404/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go tags/v4 -buildtags run-script/lib/n-json node /opt�� prettier --write /node !../../../pkg/wonode --ignore-path ../../../.prettiprettier go(http block)https://api.github.com/repos/owner/repo/contents/file.md/tmp/go-build2015806930/b381/cli.test /tmp/go-build2015806930/b381/cli.test -test.testlogfile=/tmp/go-build2015806930/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go m/_n�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)/tmp/go-build2278745225/b381/cli.test /tmp/go-build2278745225/b381/cli.test -test.testlogfile=/tmp/go-build2278745225/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true -v go /usr/bin/git sh -c npx prettier --wGOINSECURE git 64/bin/go --show-toplevel go /usr/bin/git go(http block)/tmp/go-build464754914/b381/cli.test /tmp/go-build464754914/b381/cli.test -test.testlogfile=/tmp/go-build464754914/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env 1895547159/.github/workflows GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go(http block)https://api.github.com/repos/test-owner/test-repo/actions/secrets/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 2096183/b356/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/mathenv GOMODCACHE go(http block)/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name "prettier" --wriGOINSECURE /opt/hostedtoolcGOMOD 64/bin/go GOMODCACHE go /usr/bin/git node /opt�� prettier --write 64/bin/go !../../../pkg/wonode --ignore-path ../../../.pretti--check go(http block)/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 3707047020/.github/workflows GO111MODULE ache/go/1.25.0/x64/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: Outliers and Duplicate Detection</issue_title>
<issue_description>### Overview
Semantic function clustering analysis of 559 non-test Go files across 18 packages in
pkg/. Functions were inventoried by file, clustered by naming patterns and purpose, and cross-referenced to detect misplaced functions (outliers) and near-duplicate implementations.Stats: ~7,500 functions cataloged across
pkg/workflow(278 files),pkg/cli(190 files),pkg/parser(37 files),pkg/console(27 files), and 14 utility packages.Critical Issues
Finding 1 — Duplicate deduplication logic in
pkg/parserpkg/parser/schema_utilities.goremoveDuplicates(strings []string) []string(line ~37)pkg/sliceutil/sliceutil.go:Deduplicate[T comparable]The
removeDuplicatesfunction in the parser package is a private reimplementation of the already-available genericsliceutil.Deduplicate. The logic is nearly identical:Recommendation: Replace
removeDuplicates(x)call sites withsliceutil.Deduplicate(x)and delete the private function.Outlier Functions (Functions in Wrong Files)
Finding 2 — YAML rendering method in
redact_secrets.gopkg/workflow/redact_secrets.go(*Compiler).renderStepFromMap(yaml, step, data, indent)(line 132)pkg/workflow/compiler_yaml_helpers.gorenderStepFromMaprenders a GitHub Actions YAML step from amap[string]any. It has no semantic relationship to secret redaction — it is a general YAML serialization helper. It is only called once, fromgenerateCustomSecretMaskingStepin the same file, suggesting it was placed here as a convenience without considering file responsibility.compiler_yaml_helpers.goalready houses similar YAML construction helpers (e.g.,ContainsCheckout). MovingrenderStepFromMapthere would collocate all step-rendering logic.Recommendation: Move
renderStepFromMaptopkg/workflow/compiler_yaml_helpers.go. Update the call site to reference it from there (same package — no import changes needed).Finding 3 — Generic list formatter in
github_tool_to_toolset.gopkg/workflow/github_tool_to_toolset.goformatList(items []string) string(line 132)pkg/workflow/validation_helpers.goorpkg/workflow/error_helpers.gogithub_tool_to_toolset.gois responsible for validating GitHub tool names against permitted toolsets. It containsValidateGitHubToolsAgainstToolsetsand aninit()that builds a lookup map — clearly a focused validation file.formatListis a generic utility that joins items into a quoted, comma-separated string for error messages. It has no toolset-specific logic and could be useful across many validation error messages in the package.Recommendation: Move
formatListtopkg/workflow/validation_helpers.go(orerror_helpers.go). The same-package move requires no import changes.Finding 4 — Validation function in
config_helpers.gopkg/workflow/config_helpers.govalidateTargetRepoSlug(targetRepoSlug string, log *logger.Logger) boolpkg/workflow/validation_helpers.goconfig_helpers.godocuments itself as a file for parsing config values frommap[string]anyfrontmatter.validateTargetRepoSlugperforms domain validation (it rejects the wildcard"*"as an invalid repo slug) — this is a validation concern, not a parsing concern.validation_helpers.goalready housesvalidateIntRange,ValidateRequired,ValidateMaxLength,ValidateInList, etc. — exactly where this function belongs.Recommendation: Move
validateTargetRepoSlugtopkg/workflow/validation_helpers.goand update the single call site inconfig_helpers.go.Mixed-Concern Files
Finding 5 — Utility and rendering functions in
console_types.gopkg/console/console_types.go✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.