Skip to content

refactor(workflow): fix outlier functions, remove wrapper method, consolidate version management#22892

Merged
pelikhan merged 3 commits intomainfrom
copilot/refactor-semantic-function-clustering-aeaa4b2e-4c75-49e4-bcd4-9d2d0c298ad6
Mar 25, 2026
Merged

refactor(workflow): fix outlier functions, remove wrapper method, consolidate version management#22892
pelikhan merged 3 commits intomainfrom
copilot/refactor-semantic-function-clustering-aeaa4b2e-4c75-49e4-bcd4-9d2d0c298ad6

Conversation

Copy link
Contributor

Copilot AI commented Mar 25, 2026

Semantic analysis of pkg/workflow identified test-only code compiled into the production binary, sanitize functions scattered across domain-specific files, a trivial method wrapper, and two separate version variables that diverged silently.

Changes

Test helpers out of production binary

  • Renamed compiler_test_helpers.gocompiler_test_helpers_test.go + added //go:build !integration tag
  • Removes containsInNonCommentLines, indexInNonCommentLines, extractJobSection from the production binary (59 call sites were all in _test.go files)

Sanitize functions centralized in strings.go

Moved three functions that were buried in domain-specific compiler files to the single canonical home for string sanitization:

Function From
SanitizeWorkflowIDForCacheKey compiler_yaml_helpers.go
sanitizeJobName compiler_safe_output_jobs.go
sanitizeRefForPath compiler_yaml_main_job.go

Removed (*Compiler).convertStepToYAML wrapper

The method added zero value — it was a one-liner delegating to the package-level ConvertStepToYAML. Removed it and updated 8 call sites directly.

// Before — misleading indirection
func (c *Compiler) convertStepToYAML(stepMap map[string]any) (string, error) {
    return ConvertStepToYAML(stepMap)
}

// After — call sites use ConvertStepToYAML directly
stepYAML, err := ConvertStepToYAML(pinnedStep.ToMap())

Single version variable

Removed the separate defaultVersion / SetDefaultVersion from compiler_types.go. NewCompiler() now reads GetVersion() from version.go — the single source of truth. Updated pkg/cli/version.go to call workflow.SetVersion() directly. Documented the initialization flow in version.go.

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 x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE eutil.test git (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 /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/infocmp--show-toplevel git (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 0/x64/bin/node git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git ndor/bin/bash git (http block)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name --noprofile GOPROXY (http block)
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git 2422202/b421/loggit GO111MODULE 2422202/b421/imp--show-toplevel git rev-�� --show-toplevel UCYY4uw-nj1ib/fQkmIpjEVxgPIJbBLrkR/yyjxJESSHc3089fRgrZr/aHz0DOVU-trimpath /usr/bin/git runs/20260325-12git --check 2422202/b421/_pk--show-toplevel git (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha remove origin /usr/bin/git -json GO111MODULE 64/bin/go git init�� GOMODCACHE go /usr/bin/git th .prettierignogit GO111MODULE x_amd64/vet git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel -OgvrdDxEihHp/mMrev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel LockMetadata|Tesrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git 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 sistency_GoAndJavaScript1983131310/001/test-simple-frontmatter.md k/gh-aw/gh-aw/pkg/envutil/envutil_test.go ache/node/24.14.0/x64/bin/node -json GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile t-34�� sistency_WithImports1915080419/001/main.md -trimpath /usr/bin/git -p main -lang=go1.25 git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /opt/hostedtoolcache/go/1.25.0/x64/bin/go --show-toplevel go /usr/bin/git go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha /usr/bin/git git /opt/hostedtoolcache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/git node js/f�� /usr/bin/infocmp--show-toplevel git /usr/bin/git --show-toplevel infocmp /usr/bin/git 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 548264068/.github/workflows GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go 8d51�� -json GO111MODULE 86_64/bash GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --git-dir go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ules/.bin/node git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel go /usr/bin/git auto-triage-issugit GO111MODULE /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 0/x64/bin/node git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha /tmp/go-build1502422202/b447/timeutil.test -importcfg ache/node/24.14.0/x64/bin/node -s -w -buildmode=exe ache/node/24.14.0/x64/bin/node 8989�� run --auto /usr/bin/git --detach GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha test/race-image:v1.0.0 go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel siWHJxF12LLI /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE .cfg git rev-�� --show-toplevel go /usr/bin/git 4919-37618/test-git GO111MODULE 0/x64/bin/node 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 -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ath ../../../.pr**/*.json GO111MODULE modules/@npmcli/run-script/lib/node-gyp-bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env re GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go er -json 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 GOMODCACHE go /usr/bin/git -json GO111MODULE 64/bin/go git push�� -u origin /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha /tmp/gh-aw-test-runs/20260325-125022-42512/test-2289745073/.github/workflows rev-parse /usr/bin/git --show-toplevel sh /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git 01 /opt/hostedtoolcrev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/head ithub-script/gitgit rev-parse /usr/bin/git head -500�� /tmp/gh-aw/aw-master.patch git 0/x64/bin/node --show-toplevel git /usr/bin/git git (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 --get remote.origin.url /usr/bin/git -json GO111MODULE 64/bin/go git log --oneline -1 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel BlPIPkS6j74YO/KCrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel ache/go/1.25.0/xrev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/sed ons-test39508544git git /usr/bin/git sed s/^F�� /usr/bin/git git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)
  • https://api.github.com/repos/actions/upload-artifact/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha ithub/workflows/archie.md GOPROXY g_.a GOSUMDB GOWORK 64/bin/go sh -c runs/20260325-124919-37618/test-1814466470/.github/workflows go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet l GO111MODULE 64/bin/go /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha Onlymin-integrity_with_repos_array_c1681510247/001 git ache/go/1.25.0/x64/pkg/tool/linux_amd64/link --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git ache/go/1.25.0/x64/pkg/tool/linux_amd64/link rev-�� --show-toplevel git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha --show-toplevel git /opt/hostedtoolcache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/gh node js/f�� .cfg gh /opt/hostedtoolcache/node/24.14.0/x64/bin/node /repos/actions/ugit --jq /usr/bin/git node (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.1.2
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha GOMODCACHE go /usr/lib/git-core/git -json GO111MODULE 64/bin/go /usr/lib/git-core/git main�� run --auto /usr/bin/git --detach GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha /tmp/gh-aw-test-runs/20260325-125022-42512/test-2406197183/.github/workflows rev-parse /usr/bin/git --show-toplevel ipts.test /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel /opt/hostedtoolcrev-parse cal/bin/node git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /home/REDACTED/wor--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha runs/20260325-124919-37618/test-548264068/.github/workflows --check /home/REDACTED/go/bin/node l **/*.json --ignore-path node /hom�� k/gh-aw/gh-aw scripts/**/*.js /home/REDACTED/.local/bin/bash .prettierignore GO111MODULE 64/bin/go bash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha 999 git /opt/hostedtoolcache/node/24.14.0/x64/bin/node --show-toplevel git 64/bin/node node js/f�� /usr/bin/git git /opt/hostedtoolcache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/git node (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha npx prettier --check '**/*.cjs' '**/*.ts' '**/*.json' --ignore-pgo1.25.0 GOPROXY /opt/hostedtoolcache/uv/0.11.1/x86_64/node GOSUMDB GOWORK 64/bin/go node /hom�� k/gh-aw/gh-aw/.github/workflows scripts/**/*.js /home/REDACTED/work/_temp/uv-python-dir/bash .prettierignore GO111MODULE 64/bin/go bash (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha ExpressionCompiledOutput2476950442/001 git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel git /opt/hostedtoolcache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/gh node js/f�� /usr/bin/git gh /opt/hostedtoolcache/node/24.14.0/x64/bin/node download 12346 /usr/bin/git node (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 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json GO111MODULE k/_temp/ghcca-node/node/bin/sh GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel .test /usr/bin/git git (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 At,event,headBranch,headSha,displayTitle GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json GO111MODULE 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 git /usr/bin/git --show-toplevel x_amd64/compile /usr/bin/docker git rev-�� --show-toplevel docker /usr/bin/git test/concurrent-git aw.test /usr/bin/git git (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/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env til.go til_test.go k/gh-aw/gh-aw/actions/setup/node_modules/.bin/sh-nilfunc GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 git /usr/bin/git --show-toplevel x_amd64/compile $name) { has--show-toplevel git rev-�� --show-toplevel git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git (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/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link env kflow.test GO111MODULE ortcfg.link GOINSECURE GOMOD GOMODCACHE L14nBwo2OsemW2ySrz/rL0OwPdX0vtsHtest@example.com (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel stants.test /usr/bin/git git (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 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json GO111MODULE cal/bin/sh GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel sole.test /usr/bin/git git (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 kflow.test GOINSECURE GOMOD GOMODCACHE kflow.test 8370�� -json GO111MODULE izeJobName|TestVersion|TestGenerateWorkflowHeade-nilfunc GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel util.test /usr/bin/git git (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 .test GOINSECURE GOMOD GOMODCACHE .test 8370�� 10/001/test-frontmatter-with-arrays.md GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --noprofile GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go go env h ../../../.prettierignore 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 100 GOMOD GOMODCACHE go env -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 GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE 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 67/001 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE dx8vjli/alK5YuEvsiWHJxF12LLI (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha abb29c3b5978ce98b005fe846f27d535a6afde2f..HEAD --stdout /usr/bin/git --show-toplevel (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git GOMODCACHE go /opt/hostedtoolc--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.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)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha re GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha re GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE _modules/.bin/sh-nilfunc GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v3.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.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)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha --show-toplevel git e/git /tmp/TestGuardPogit rev-parse /opt/hostedtoolc/tmp/TestGuardPolicyBlockedUsersCommaSeparatedCompiledOutput2046898983/001 e/git rev-�� --show-toplevel /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git /tmp/go-build150gh -importcfg /usr/bin/git git (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 -json GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile /usr/bin/git ithub/workflows/git GO111MODULE .cfg git rev-�� --show-toplevel node /usr/bin/git ndrk/WqPmaxUgULkgit **/*.cjs 0/x64/bin/node git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha /tmp/gh-aw/aw-master.patch infocmp /usr/bin/git xterm-color git /usr/bin/git git rev-�� --show-toplevel git 0/x64/bin/node --show-toplevel git /usr/bin/git git (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 6n/cLzQgjXlIjxIo_QUvJx9/eZ420Er5origin env 01/main.md GO111MODULE p/bin/sh GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion --show-toplevel x_amd64/vet /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (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 GOSUMDB GOWORK 64/bin/go go env h ../../../.prettierignore GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git npx prettier --cgit GOPROXY /home/REDACTED/wor--show-toplevel git rev-�� --show-toplevel node /usr/bin/git --check l ache/node/24.14.--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git prettier --check /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel go (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build1502422202/b402/cli.test /tmp/go-build1502422202/b402/cli.test -test.testlogfile=/tmp/go-build1502422202/b402/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env ath ../../../.pr**/*.json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /tmp/go-build3142032950/b376/cli.test /tmp/go-build3142032950/b376/cli.test -test.testlogfile=/tmp/go-build3142032950/b376/testlog.txt -test.paniconexit0 -test.timeout=10m0s rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git rt GO111MODULE /home/node_modul--show-toplevel git rev-�� --show-toplevel sh /usr/bin/git "prettier" --chegit GOPROXY (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 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --show-toplevel go /usr/bin/git ithub/workflows/git GO111MODULE /opt/hostedtoolc--show-toplevel git rev-�� --show-toplevel node /usr/bin/git --check **/*.cjs ache/node/24.14.--show-toplevel git (http block)

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


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…rsions, remove wrapper method

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/095a703f-d587-4407-87e2-568631ed3c30
Copilot AI changed the title [WIP] Refactor semantic function clustering analysis for outlier functions refactor(workflow): fix outlier functions, remove wrapper method, consolidate version management Mar 25, 2026
Copilot AI requested a review from pelikhan March 25, 2026 12:55
@pelikhan pelikhan marked this pull request as ready for review March 25, 2026 14:05
Copilot AI review requested due to automatic review settings March 25, 2026 14:05
@pelikhan
Copy link
Contributor

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

Refactors pkg/workflow to reduce production-binary surface area, remove trivial indirection, and unify compiler version initialization.

Changes:

  • Moves test-only helper functions out of the production build by renaming the helper file to _test.go.
  • Centralizes workflow-related sanitization helpers into pkg/workflow/strings.go.
  • Removes (*Compiler).convertStepToYAML wrapper and consolidates version management so NewCompiler() reads from workflow.GetVersion().

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pkg/workflow/version.go Expands documentation and positions compilerVersion as the single source of truth used by NewCompiler() and headers.
pkg/cli/version.go Switches CLI initialization to call workflow.SetVersion (replacing removed SetDefaultVersion).
pkg/workflow/compiler_types.go Updates NewCompiler() to source its version from GetVersion() instead of a separate defaultVersion.
pkg/workflow/compiler_yaml_helpers.go Removes SanitizeWorkflowIDForCacheKey and the (*Compiler).convertStepToYAML wrapper, keeping only ConvertStepToYAML.
pkg/workflow/threat_detection.go Updates call site to use ConvertStepToYAML directly.
pkg/workflow/safe_jobs.go Updates call site to use ConvertStepToYAML directly.
pkg/workflow/compiler_safe_outputs_job.go Updates call site to use ConvertStepToYAML directly.
pkg/workflow/compiler_pre_activation_job.go Updates call sites to use ConvertStepToYAML directly.
pkg/workflow/compiler_jobs.go Updates call site to use ConvertStepToYAML directly.
pkg/workflow/multiline_test.go Updates tests to use ConvertStepToYAML directly (no compiler instance needed).
pkg/workflow/compiler_generation_test.go Updates tests to use ConvertStepToYAML directly (no compiler instance needed).
pkg/workflow/compiler.go Removes now-stale comment referring to the removed wrapper method.
pkg/workflow/compiler_yaml_main_job.go Removes the local sanitizeRefForPath implementation (now centralized).
pkg/workflow/compiler_safe_output_jobs.go Removes the local sanitizeJobName implementation/imports (now centralized).
pkg/workflow/strings.go Adds centralized sanitization helpers (SanitizeWorkflowIDForCacheKey, sanitizeJobName, sanitizeRefForPath).
pkg/workflow/compiler_test_helpers_test.go Renames helper file for tests and adds a build tag intended to control inclusion.
Comments suppressed due to low confidence (2)

pkg/workflow/version.go:27

  • This comment says “Call once during CLI initialization”, but SetVersion is currently invoked from pkg/cli/version.go:init() and again via cli.SetVersionInfo(...) (and tests call it multiple times). Consider rewording to indicate it may be called multiple times and that the last call wins, or enforce single-assignment if that’s the intent.
// SetVersion sets the compiler version. Call once during CLI initialization.
// The version is used in generated workflow headers and as the default version
// for new Compiler instances created via NewCompiler.

pkg/workflow/compiler_test_helpers_test.go:2

  • //go:build !integration will exclude this helper file when running tests with -tags=integration, but integration tests in this repo (e.g. pkg/workflow/compiler_cache_test.go) call containsInNonCommentLines/indexInNonCommentLines/extractJobSection. This will cause integration test builds to fail with undefined symbols. Remove the build tag (the _test.go suffix already keeps it out of production builds), or provide an integration-tagged equivalent helper file.

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

Comment on lines +14 to +17
// Initialization flow:
//
// main.go → cli.SetVersionInfo(v) → workflow.SetVersion(v) (sets compilerVersion)
// → NewCompiler() (reads compilerVersion via GetVersion)
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documented initialization flow here doesn’t match the actual call chain: pkg/cli/version.go calls workflow.SetVersion in init(), and cmd/gh-aw/main.go calls workflow.SetVersion(version) even after cli.SetVersionInfo(version) (which itself calls workflow.SetVersion). Please update this comment to reflect the real flow (or simplify the flow in code) to avoid future confusion.

This issue also appears on line 25 of the same file.

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Copilot AI commented Mar 25, 2026

@copilot review https://github.com/github/gh-aw/actions/runs/23545178480/job/68543348702

Fixed in 0990300. The //go:build !integration tag on compiler_test_helpers_test.go was preventing integration test files (runtime_setup_integration_test.go, compiler_cache_test.go) from seeing the helper functions. Removed the build constraint — since the helpers are shared by both integration and non-integration test variants, no build tag is needed.

@pelikhan pelikhan merged commit 4099333 into main Mar 25, 2026
55 checks passed
@pelikhan pelikhan deleted the copilot/refactor-semantic-function-clustering-aeaa4b2e-4c75-49e4-bcd4-9d2d0c298ad6 branch March 25, 2026 14:26
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.

[refactor] Semantic Function Clustering Analysis: Outlier and Misplaced Functions

3 participants