Conversation
…e, consolidate formatDuration" Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…g-99e7e7b5-7874-4c2d-8ccd-fd672c313b05
…g-99e7e7b5-7874-4c2d-8ccd-fd672c313b05
There was a problem hiding this comment.
Pull request overview
This PR refactors code to eliminate boilerplate and improve organization by removing thin wrapper functions, relocating a test helper, and consolidating duplicate duration formatting logic.
Changes:
- Removed 14 one-line wrapper functions from
content_extractor.gothat simply delegated toextractFrontmatterFieldorextractOnSectionField - Moved
assertEnvVarsInStepstest helper from production code (safe_outputs_env.go) to a new test-only file (safe_outputs_env_helpers_test.go) - Replaced duplicate
formatDurationimplementation inhealth_metrics.gowith existingtimeutil.FormatDuration
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/parser/content_extractor.go | Removed 14 thin wrapper functions (extractSafeOutputsFromContent, extractEngineFromContent, etc.), kept ExtractPermissionsFromContent (exported) |
| pkg/parser/include_expander.go | Updated to use inline closures calling extractFrontmatterField instead of removed wrapper functions |
| pkg/parser/import_processor.go | Updated all callsites to call extractFrontmatterField and extractOnSectionField directly |
| pkg/parser/engine_includes_test.go | Updated test to call extractFrontmatterField directly |
| pkg/parser/content_extractor_features_test.go | Updated all tests to call extractFrontmatterField directly |
| pkg/workflow/safe_outputs_env.go | Removed assertEnvVarsInSteps helper and testing import |
| pkg/workflow/safe_outputs_env_helpers_test.go | New file containing the moved assertEnvVarsInSteps test helper |
| pkg/cli/health_metrics.go | Replaced local formatDuration with timeutil.FormatDuration, added timeutil import |
| pkg/cli/health_metrics_test.go | Removed TestFormatDuration (tested the now-deleted local function) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Format display values | ||
| displayRate := fmt.Sprintf("%.0f%% (%d/%d)", successRate, successCount, totalRuns) | ||
| displayDur := formatDuration(avgDuration) | ||
| displayDur := timeutil.FormatDuration(avgDuration) |
There was a problem hiding this comment.
The replacement of the local formatDuration with timeutil.FormatDuration changes the output format significantly. The original function formatted durations as "2m 30s" or "1h 15m" (integer values with multiple units), while timeutil.FormatDuration formats them as "2.5m" or "1.3h" (decimal values with a single unit). This will change the user-facing display format for health metrics. If this format change is intentional, it should be documented in the PR description. Otherwise, consider keeping the local formatDuration function or adding a new FormatDurationDetailed function to timeutil that preserves the multi-unit format.
| @@ -0,0 +1,20 @@ | |||
| //go:build integration || !integration | |||
There was a problem hiding this comment.
The build tag "//go:build integration || !integration" is a tautology that will always evaluate to true, making it equivalent to having no build tag at all. Since this helper is used in both safe_outputs_env_test.go (unit tests) and safe_outputs_env_integration_test.go (integration tests), the correct approach is to either remove the build tag entirely or use a simpler pattern. Looking at other test helper files in this package, safe_output_helpers_test.go uses "//go:build !integration" to exclude it from integration tests. Consider removing this build tag entirely since the helper needs to be available to both unit and integration tests.
Three high-value, low-effort refactors identified in static analysis: 15 single-line boilerplate wrappers in
content_extractor.go, atesting-importing helper in production code, and a duplicateformatDurationignoring the existingtimeutilpackage.Finding 1 — Remove 14 thin wrappers from
content_extractor.goEliminated 14 unexported one-liners (e.g.
extractSafeOutputsFromContent,extractEngineFromContent,extractSkipRolesFromContent, etc.) that did nothing but relay toextractFrontmatterFieldorextractOnSectionField.import_processor.go: callers now callextractFrontmatterField(content, "field-name", "default")directlyinclude_expander.go: function-value arguments replaced with closuresextractFrontmatterFielddirectlyExtractPermissionsFromContentretained — it's exported and used bypkg/workflowFinding 2 — Move
assertEnvVarsInStepsout of production codesafe_outputs_env.goimportedtestingsolely for this helper. Moved to a newsafe_outputs_env_helpers_test.gowith//go:build integration || !integrationso it's available to both unit and integration test builds.Finding 3 — Remove duplicate
formatDurationinhealth_metrics.goReplaced the local unexported copy with
timeutil.FormatDuration, which already exists for this purpose and is used elsewhere inpkg/cli. RemovedTestFormatDuration(was testing the now-deleted local function;timeutilhas its own coverage).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 --local x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git w/js/**/*.json' git pull.rebase x_amd64/vet 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 x_amd64/vet /usr/bin/git git conf�� user.email test@example.com /usr/bin/git(http block)/usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet 1947�� -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/xTest User(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 ry=1 -tests 4954287/b001/_pkg_.a(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha xterm-color sh /usr/bin/git echo $TEST_VAR x_amd64/vet /usr/bin/git git rev-�� runs/20260223-190800-17335/test-1124264615/.github/workflows git /usr/bin/git l 64/pkg/tool/linurev-parse /usr/bin/git git(http block)/usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha /tmp/go-build3571947930/b240/vet.cfg ache/go/1.25.0/xGO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet 3254850/b353/_pkgit GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /tmp�� g/cli go ache/node/24.13.0/x64/bin/node O1up/dJ7XGaEe8HMgit GO111MODULE 64/bin/go infocmp(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 ortcfg /usr/bin/git ripts/lint_errorinfocmp ripts/lint_error-1 ache/go/1.25.0/xxterm-color git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git 4954287/b431/worgit -tests 4954287/b431/imp--show-toplevel git(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha .cfg GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env .cfg GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User(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 -bool -buildtags /home/REDACTED/work/node_modules/.bin/node -errorsas -ifaceassert -nilfunc node /opt�� prettier --write /bin/sh **/*.ts **/*.json --ignore-path /bin/sh(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -unreachable=false /tmp/go-build3638810712/b354/vet.cfg ache/node/24.13.0/x64/bin/node d -n 10(http block)/usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha(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 json' --ignore-path ../../../.pr**/*.json(http block)/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 --show-toplevel l /usr/bin/git(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 ire/doc.go ire/forward_requ-c=4 /node(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha h ../../../.prettierignore --local x_amd64/vet user.name(http block)/usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha h ../../../.pret.prettierignore g/workflow/mcp_config_shared_test.go x_amd64/vet g/workflow/sandbnode g/workflow/safe_/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/.bin/pre�� g/workflow/netwo--write x_amd64/vet g/wo�� w/js/**/*.json' --ignore-path g/workflow/compi../../../.prettierignore x_amd64/vet g/workflow/step_/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile g/workflow/threa-o g/workflow/noop_/tmp/go-build1594954287/b420/_pkg_.a x_amd64/vet(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 -bool -buildtags ache/node/24.13.0/x64/bin/node -errorsas -ifaceassert -nilfunc node t-12�� sistency_GoAndJavaScript846201338/001/test-frontmatter-with-nestremote.origin.url --write 0/x64/bin/node **/*.ts **/*.json --ignore-path 0/x64/bin/node(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git /tmp/gh-aw-test-git(http block)/usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha ithub/workflows/agent-persona-explorer.md GOPROXY 0/x64/bin/node GOSUMDB GOWORK 64/bin/go fPolqxMEIvcmg/gRv3SRz3bsmph76Ltk1S/pZ37Atn67fBOzconfig -has�� ithub/workflows/auto-triage-issues.md go tartedAt,updatedAt,event,headBranch,headSha,displayTitle ck 'scripts/**/*git GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(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 -bool -buildtags /home/node_modules/.bin/node -errorsas -ifaceassert -nilfunc node /opt�� 4 --write /home/REDACTED/work/_temp/uv-python-dir/node **/*.ts **/*.json --ignore-path node(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel x_amd64/vet /usr/bin/git git rev-�� --show-toplevel git 0/x64/bin/node --get remote.origin.urrev-parse /usr/bin/git 0/x64/bin/node(http block)/usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha GOPATH GOPROXY /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linurev-parse /tmp�� GOMODCACHE go 760390/b363/vet.cfg ck 'scripts/**/*git GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linutest@example.com(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(http block)/usr/bin/gh gh run download 1 --dir test-logs/run-1 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git /tmp/go-build159git -importcfg /usr/bin/git git rev-�� 0800-17335/test-1676379601/.github/workflows git /usr/bin/git testing.testBinagit -extld=gcc /usr/bin/git git(http block)/usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linuconfig 1947�� -json GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linurev-parse(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 8810712/b217/vet.cfg 0/x64/bin/node ignore(http block)/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 /opt/hostedtoolc--package-lock-only /usr/bin/git /tmp/go-build159git -trimpath /usr/bin/git git rev-�� OKEN }} git rgo/bin/bash --show-toplevel -dwarf=false /usr/bin/git git(http block)/usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_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(http block)/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 /opt/hostedtoolc--package-lock-only 0/x64/bin/node -bool -buildtags /usr/bin/git git -has�� ithub/workflows/auto-triage-issues.md git nfig/composer/vendor/bin/bash /tmp/gh-aw-test-git rev-parse /usr/bin/git git(http block)/usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_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(http block)/usr/bin/gh gh run download 2 --dir test-logs/run-2 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/gh -bool -buildtags /usr/bin/git /usr/bin/gh api graphql -f ache/go/1.25.0/x64/pkg/tool/linux_amd64/asm -f owner=github -f ache/go/1.25.0/x64/pkg/tool/linux_amd64/asm(http block)/usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linutest@example.com 1947�� 1202-39362/test-2574810437/.github/workflows GO111MODULE k/_temp/uv-python-dir/bash GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x.github/workflows/test.md(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(http block)/usr/bin/gh gh run download 3 --dir test-logs/run-3 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile /usr/bin/infocmp /tmp/go-build159git -trimpath /usr/bin/git infocmp -1 0800-17335/test-707458154/.github/workflows git ache/go/1.25.0/x64/pkg/tool/linux_amd64/cgo path.sh' ':/usr/git -goversion /usr/bin/git ache/go/1.25.0/x64/pkg/tool/linux_amd64/cgo(http block)/usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ortcfg 1947�� 1202-39362/test-2574810437/.github/workflows GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/link(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(http block)/usr/bin/gh gh run download 4 --dir test-logs/run-4 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile /usr/bin/git /tmp/go-build159git -trimpath /usr/bin/git git rev-�� 0800-17335/test-707458154/.github/workflows git /usr/bin/git --get remote.origin.urrev-parse /usr/bin/git git(http block)/usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet 1947�� -json GO111MODULE ache/uv/0.10.4/x86_64/bash GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(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(http block)/usr/bin/gh gh run download 5 --dir test-logs/run-5 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git /tmp/go-build159git -importcfg /usr/bin/git git rev-�� --show-toplevel git ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet path.sh' ':::' &git rev-parse /usr/bin/git ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(http block)/usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linuTest User(http block)https://api.github.com/repos/github/gh-aw/actions/workflows/usr/bin/gh gh workflow list --json name,state,path ler_shared_cache**/*.ts ge_extraction_te**/*.json /prettier http.https://gitnode(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(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(http block)https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md/tmp/go-build575760390/b361/cli.test /tmp/go-build575760390/b361/cli.test -test.paniconexit0 -test.count=1 -test.timeout=2m0s -c npx prettier --cGOSUMDB GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go sh -c "prettier" --check 'scripts/**/*GOINSECURE node 64/bin/go tierignore git 64/bin/go 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 js/**/*.json' --ignore-path ../../../.prettierignore ew@v1.1.1/spew/common.go x_amd64/compile(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha user.email test@example.com /usr/bin/git --noprofile .cfg tions/node_modul--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linurev-parse /usr/bin/git '**/*.ts' '**/*.git 8810712/b052/vetrev-parse ache/go/1.25.0/x--show-toplevel git(http block)/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha k/gh-aw/gh-aw/pkGOSUMDB GOPROXY 64/bin/go GOSUMDB GOWORK run-script/lib/n/tmp/go-build3571947930/b234/vet.cfg /opt/hostedtoolcache/go/1.25.0/xGO111MODULE -V=f�� /usr/bin/git node 64/bin/go /usr/bin/git git 64/bin/go 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 js/**/*.json' ---s main 64/pkg/tool/linu-buildmode=exe(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel 64/pkg/tool/linuremote.origin.url r,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,disp--show-toplevel --noprofile flow-ci-test-678rev-parse x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git '**/*.ts' '**/*.git(http block)/usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha 3254850/b385/embedcfg GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/xGO111MODULE -o /tmp/go-build2413254850/b353/_pkGOINSECURE -trimpath 64/bin/go -p main -lang=go1.25 go(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(http block)/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion ons-test67776376git right_allowed_dorev-parse /usr/bin/git git rev-�� --show-toplevel git ache/node/24.13.0/x64/bin/node --get remote.origin.ur/tmp/fuzz-expr-2874985895.js /usr/bin/git git(http block)/usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet 1947�� -json GO111MODULE ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/x64/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 x_amd64/vet(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git(http block)/usr/bin/gh gh workflow list --json name,state,path --repo owner/repo -nolocalimports -importcfg /tmp/go-build3518624140/b339/importcfg -pack /tmp/go-build3518624140/b339/_testmain.go rev-�� gh-aw/actions/setup/sh/sanitize_path.sh' '/usr/bin' && echo "$PATH" x_amd64/compile /usr/bin/git */*.ts' '**/*.js/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet 8810712/b055/vet-atomic .cfg git(http block)https://api.github.com/repos/owner/repo/contents/file.md/tmp/go-build1594954287/b381/cli.test /tmp/go-build1594954287/b381/cli.test -test.testlogfile=/tmp/go-build1594954287/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true(http block)/tmp/go-build3518624140/b361/cli.test /tmp/go-build3518624140/b361/cli.test -test.testlogfile=/tmp/go-build3518624140/b361/testlog.txt -test.paniconexit0 -test.timeout=10m0s rev-�� --show-toplevel 64/pkg/tool/linuremote.origin.url /usr/bin/git ../pkg/workflow/git .cfg n-dir/bash git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git se 8810712/b012/vetrev-parse ache/go/1.25.0/x--show-toplevel git(http block)/tmp/go-build575760390/b361/cli.test /tmp/go-build575760390/b361/cli.test -test.paniconexit0 -test.count=1 -test.timeout=2m0s -c npx prettier --cGOSUMDB GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go sh -c "prettier" --check 'scripts/**/*GOINSECURE node 64/bin/go tierignore git 64/bin/go 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 ler_shared_cache**/*.ts ge_extraction_te**/*.json x_amd64/vet http.https://gitnode(http block)/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name(http block)/usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name che/go-build/28/2888c116b4dd41c7GOINSECURE GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.0/xGO111MODULE -o /tmp/go-build2413254850/b398/_pkGOINSECURE -trimpath 64/bin/go -p github.com/githu--norc -lang=go1.25 go(http block)https://api.github.com/repos/test/repo/usr/bin/gh gh api /repos/test/repo --jq .default_branch /tmp/go-build3571947930/b066/vet.cfg GOPROXY /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcv1.0.0 -uns�� /tmp/go-build3571947930/b209/vet.cfg erignore tartedAt,updatedAt,event,headBranch,headSha,displayTitle ions.md GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet(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: 3 high-value refactoring opportunities</issue_title>
<issue_description>Analysis of 558 non-test Go files in
pkg/identified the following refactoring opportunities, ordered by impact.Summary
pkg/parser/content_extractor.gopkg/workflow/safe_outputs_env.goformatDurationduplicated across packagespkg/cli/health_metrics.govspkg/timeutil/format.gocompiler_activation_jobs.goexceeds 1,000 linespkg/workflow/compiler_activation_jobs.gogenerateMaxWith*Configfunctionspkg/workflow/safe_outputs_config_generation_helpers.goFinding 1 — 15 identical thin wrappers in
content_extractor.goFile:
pkg/parser/content_extractor.go(286 lines)Fifteen functions are 1-line wrappers that only differ in the field name and empty-value string they pass to a shared helper:
The 3 non-trivial functions (
extractToolsFromContent,extractStepsFromContent,extractServicesFromContent,extractPostStepsFromContent) have distinct logic and should stay.Recommendation: Replace the 15 wrapper functions with a small registry map, eliminating ~80 lines of boilerplate while keeping the API surface identical via one generic exported function:
Impact: Removes ~80 lines of boilerplate; makes adding new fields a one-line change in the registry rather than a new function.
Full list of redundant wrappers
extractSafeOutputsFromContentextractFrontmatterFieldsafe-outputs{}extractSafeInputsFromContentextractFrontmatterFieldsafe-inputs{}extractMCPServersFromContentextractFrontmatterFieldmcp-servers{}extractEngineFromContentextractFrontmatterFieldengine""extractRuntimesFromContentextractFrontmatterFieldruntimes{}extractNetworkFromContentextractFrontmatterFieldnetwork{}ExtractPermissionsFromContentextractFrontmatterFieldpermissions{}extractSecretMaskingFromContentextractFrontmatterFieldsecret-masking{}extractBotsFromContentextractFrontmatterFieldbots[]extractPluginsFromContentextractFrontmatterFieldplugins[]extractLabelsFromContentextractFrontmatterFieldlabels[]extractCacheFromContentextractFrontmatterFieldcache{}extractFeaturesFromContentextractFrontmatterFieldfeatures{}extractSkipRolesFromContentextractOnSectionFieldskip-rolesextractSkipBotsFromContentextractOnSectionFieldskip-botsFinding 2 — Test helper in production non-test file
File:
pkg/workflow/safe_outputs_env.go:349This function:
testingpackage into a production file with no build tagRecommendation: Move
assertEnvVarsInStepsto a_test.gofile in the same package (e.g.,safe_outputs_env_test.goor an existing*_test.gofile that uses it).Finding 3 —
formatDurationduplicated across packagesProduction package:
pkg/timeutil/format.go:10CLI local copy: `pkg/cl...
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.