Skip to content

refactor: implement semantic function clustering improvements across pkg/#19926

Merged
pelikhan merged 2 commits intomainfrom
copilot/refactor-semantic-analysis-results
Mar 7, 2026
Merged

refactor: implement semantic function clustering improvements across pkg/#19926
pelikhan merged 2 commits intomainfrom
copilot/refactor-semantic-analysis-results

Conversation

Copy link
Contributor

Copilot AI commented Mar 7, 2026

Automated semantic analysis identified 7 refactoring opportunities across pkg/workflow/, pkg/cli/, pkg/console/, pkg/constants/, pkg/repoutil/, and pkg/stringutil/. This PR addresses all of them.

Changes

pkg/workflow/ — validation logger boilerplate eliminated

Added newValidationLogger(domain string) to validation_helpers.go. Every *_validation.go file previously duplicated logger.New("workflow:<domain>_validation") — now each uses the helper:

// Before (×30 files)
var engineValidationLog = logger.New("workflow:engine_validation")

// After
var engineValidationLog = newValidationLogger("engine")

pkg/workflow/ — safe_outputs file sprawl: 14 → 4 files

Consolidated the fragmented safe_outputs_* subsystem into cohesive modules following the data-flow pattern:

New file Sources merged
safe_outputs_config.go safe_outputs_config.go + safe_outputs_app.go + safe_outputs_config_messages.go + safe_outputs.go
safe_outputs_validation.go safe_outputs_domains_validation.go + safe_outputs_target_validation.go
safe_outputs_generation.go safe_outputs_config_generation.go + safe_outputs_config_generation_helpers.go + safe_outputs_config_helpers.go + safe_outputs_tools_generation.go
safe_outputs_jobs.go safe_outputs_jobs.go + safe_outputs_permissions.go + safe_outputs_steps.go + safe_outputs_env.go

pkg/workflow/ — error types: 3 → 1 file

Merged error_helpers.go + error_aggregation.go + shared_workflow_error.go into workflow_errors.go with a unified doc comment covering all error types.

pkg/cli/ — codemod_permissions.go split

codemod_permissions.go violated the one-codemod-per-file rule followed by all other 50+ codemod files. Split into codemod_permissions_read.go and codemod_permissions_write.go.

pkg/stringutil/ — SanitizeForFilename moved from repoutil

repoutil.SanitizeForFilename (converts owner/repoowner-repo) is a pure string utility with no repo logic. Moved to stringutil.SanitizeForFilename alongside the other Sanitize* functions. Updated the 3 call sites in trial_command.go and relocated tests.

pkg/console/ — Format* vs Render* convention documented

Created doc.go establishing the naming convention: Format* = pure string transformations for single items/messages; Render* = structured/multi-element layout output.

pkg/constants/ — intentional String()/IsValid() duplication annotated

Added a comment block explaining why Version, JobName, StepID, CommandPrefix, and DocURL each define identical String()/IsValid() bodies — Go's type system requires it, and code-generation adds more complexity than the duplication itself.

Warning

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

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

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/bin/go git rev-�� --git-dir go /usr/bin/git -json GO111MODULE 64/bin/go 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 1537139/b433/wor-p x_amd64/link git rev-�� --show-toplevel x_amd64/link /usr/bin/git --show-toplevel node x_amd64/vet 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 --jq /usr/bin/git git -C /tmp/gh-aw-test-runs/20260307-041324-39469/test-2739779282 rev-parse /usr/bin/git @{u} git /usr/bin/git 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 /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha xterm-color git /usr/bin/gh --show-toplevel go /usr/bin/git gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq /usr/bin/git --show-toplevel go /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 l /usr/bin/git --show-toplevel 1147781/b001/clirev-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 dRRm/hXuSY5ACtRY9la0wdRRm l (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel infocmp 1147781/b346/vet.cfg xterm-color x_amd64/compile /usr/bin/git git rev-�� --show-toplevel git /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet --show-toplevel go /usr/bin/git /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha --show-toplevel git /opt/hostedtoolcache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/git node js/f�� 64/pkg/tool/linu--show-toplevel git /opt/hostedtoolcache/node/24.14.0/x64/bin/node --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git node (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel node /usr/bin/find prettier --check 64/bin/go find -O3 /var/lib/php/sessions/ -ignore_readdir_race /usr/bin/git -mindepth 1 -name 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 -json GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE is-results 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/gh-aw-test-runs/20260307-040905-28297/test--nxv config 1537139/b439/vet.cfg remote.origin.urgit GO111MODULE 64/bin/go git init�� GOMODCACHE go clusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle -json GO111MODULE 64/bin/go node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha -test.paniconexit0 -test.v=true /usr/bin/git -test.timeout=10git -test.run=^Test -test.short=true--show-toplevel git init�� GOMODCACHE go /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 ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/pkg/tool/linu--show-toplevel 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 ck &#39;**/*.cjs&#39; &#39;*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env -json 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 -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node (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 /tmp/gh-aw-test-runs/20260307-040905-28297/test-2000129479/.github/workflows (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/20260307-041110-32792/test-3526710684/.github/workflows config /usr/bin/git remote.origin.urgit go /usr/bin/git git rev-�� --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel go /usr/bin/git ache/node/24.14.0/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha .cfg git /usr/bin/git --show-toplevel git /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)
  • 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 --show-toplevel go /usr/bin/git ck &#39;scripts/**/*git GO111MODULE 64/bin/go git init�� GOMODCACHE go /usr/bin/git ays.md GO111MODULE 64/bin/go 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/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git 0/x64/bin/node ted-objects.md go /usr/bin/git 0/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha /usr/bin/git git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel ache/go/1.25.0/xrev-parse (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 -json GO111MODULE 1537139/b413/repoutil.test GOINSECURE GOMOD GOMODCACHE 1537139/b413/repoutil.test e=/t�� t0 GO111MODULE (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git add origin /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/infocmp--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq .object.sha --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel node /usr/bin/git git _out�� --show-toplevel git /usr/bin/git --show-toplevel git /opt/hostedtoolc--show-toplevel git (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 002e2e4ac57478dd1e9e84ba08852377bcaa8cd93b04e6c1-d GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 node /usr/bin/git /home/REDACTED/worgit (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel git /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 ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json stering refactoring suggestions
  • Extract newValidationLogger() helper to validation_helpers.gorev-parse ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go` (http block)
  • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 git /usr/bin/git GOMODCACHE go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel sh /usr/bin/sort git (http block)
  • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 git /usr/bin/git --show-toplevel X6mK9KE/sff5DID0rev-parse /usr/bin/git git rev-�� --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel git /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 ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go 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 _9a60CKVjggF /usr/bin/git git rev-�� --show-toplevel git 64/pkg/tool/linux_amd64/compile --show-toplevel sh /usr/bin/sort 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel git /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 ndor/bin/git GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ceutil.test GOINSECURE GOMOD GOMODCACHE ceutil.test (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 infocmp /usr/bin/git xterm-color go /usr/bin/git git comm�� -m Add new feature 64/pkg/tool/linux_amd64/vet --show-toplevel sh /usr/bin/git 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/gh 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 ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE is-results GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 infocmp /usr/bin/git xterm-color go /usr/bin/git git comm�� -m Update initial file 64/pkg/tool/linux_amd64/compile --show-toplevel sh /usr/bin/git 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 git stants.test --show-toplevel git ache/node/24.14.--show-toplevel stants.test 4556�� --show-toplevel ache/node/24.14.--auto ache/node/24.14.0/x64/bin/node }} ${{ github.rgit git /opt/hostedtoolc--show-toplevel 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 ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env ai-moderator.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 4 --dir test-logs/run-4 gh /usr/lib/git-core/git /repos/github/ghgit --jq /usr/bin/gh /usr/lib/git-core/git main�� run --auto /usr/bin/git --detach --jq /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel git /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 ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE is-results GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 gh /usr/bin/bash /repos/github/ghgit --jq ache/node/24.14.0/x64/bin/node bash /tmp�� 051ad17579aba855--show-toplevel ache/node/24.14.0/x64/bin/node 64/pkg/tool/linux_amd64/link ere sh /usr/bin/git 64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 git /usr/bin/git --show-toplevel git ache/node/24.14.--show-toplevel git rev-�� --show-toplevel ache/node/24.14.0/x64/bin/node ache/node/24.14.0/x64/bin/node ithub.actor }} }git git /opt/hostedtoolc--show-toplevel 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 g/envutil/envutiGOINSECURE g/envutil/envutiGOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 2225261/b394/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/filecommit 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 node (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 submodules | head -n 10 GO111MODULE sole.test GOINSECURE GOMOD GOMODCACHE sole.test (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 --check
  • Extract newVa-ifaceassert 64/bin/go /*.json --ignore-path ../../../.pretti-test.paniconexit0 node /hom�� --check scripts//*.js 64/bin/go -d x_amd64/vet 64/bin/go go` (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 ache/go/1.25.0/x/repos/actions/github-script/git/ref/tags/v8 git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/link /usr/bin/git 1537139/b433/worgh GO111MODULE 1537139/b433/imp/repos/github/gh-aw/git/ref/tags/v2.0.0 git (http block)
  • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git OKEN }} iptables /usr/bin/git git (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 sh -c npx prettier --c-p GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel go /usr/bin/git celain --ignore-/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet GO111MODULE /opt/hostedtoolc-bool git rev-�� --show-toplevel 39ac3f0f..HEAD /usr/bin/git -json GO111MODULE /opt/hostedtoolc/tmp/TestHashConsistency_GoAndJavaScript1858292095/001/test-complex-frontmatter-with-tools.md git (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 l /usr/bin/git git rev-�� (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 sh -c npx prettier --c-errorsas GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go node (http block)
    • 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 sh -c npx prettier --c-s
  • Extract newVa-w 64/bin/go GOSUMDB GOWORK run-script/lib/n/tmp/TestHashConsistency_GoAndJavaScript2688959594/001/test-frontmatter-with-nested-objects.md node` (http block)
  • Triggering command: `/usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha -json GO111MODULE 051ad17579aba855-d GOINSECURE GOMOD GOMODCACHE sh -c npx prettier --check '**/*.cjs' GOINSECURE
  • Extract newValidationLogger() helper to validation_helpers.go and
    update all ~30 *_validati-o 64/bin/go GOSUMDB GOWORK 64/bin/go node` (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 sh -c npx prettier --c-test.timeout=10m0s GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq .object.sha --show-toplevel go /usr/bin/git ithub/workflows//opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link GO111MODULE 0/x64/bin/node git rev-�� --show-toplevel go /usr/bin/git ithub/workflows/node GO111MODULE /opt/hostedtoolc/tmp/TestHashConsistency_GoAndJavaScript1858292095/001/test-frontmatter-with-env-template-expressions.md git (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 /usr/bin/git --show-toplevel 1147781/b411/_terev-parse /usr/bin/git git s --show-toplevel git /usr/bin/git /tmp/gh-aw-test-git rev-parse /opt/hostedtoolc--show-toplevel 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 prettier
  • Extract newVa-ifaceassert 64/bin/go **/.ts **/.json --ignore-path go env GOPATH sh 64/bin/go -d x_amd64/vet 64/bin/go go` (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/x-ifaceassert /usr/bin/git 1537139/b402/log/opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile GO111MODULE 1537139/b402/imp/tmp/go-build1541147781/b420/_pkg_.a git rev-�� --show-toplevel I_9a60CKVjggF/xhmain /usr/bin/git runs/20260307-04git GO111MODULE che/go-build/34/--show-toplevel git (http block)
  • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel git /usr/bin/git 383434939/001 git 1147781/b408/sliceutil.test git rev-�� --show-toplevel 1147781/b408/sliceutil.test /usr/bin/git t0 m0s (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 sole.test 7615�� auto-triage-issues.md GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE ation_helpers.gorev-parse GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOMODCACHE go /usr/bin/git r -lh /tmp/gh-aw/aw-feature-branch.patch git /usr/bin/git --show-toplevel 2225261/b419/imprev-parse /opt/hostedtoolc--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion ease.assets[0].igit git /usr/bin/git git _cod�� --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel infocmp /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 GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 2225261/b401/_pkGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/parscommit GOMODCACHE go (http block)
    • Triggering command: /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 2225261/b409/_pkGOINSECURE 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 -json GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE .cfg git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build2761537139/b383/cli.test /tmp/go-build2761537139/b383/cli.test -test.testlogfile=/tmp/go-build2761537139/b383/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE erignore m/_n�� -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /tmp/go-build1541147781/b001/cli.test /tmp/go-build1541147781/b001/cli.test -test.testlogfile=/tmp/go-build1541147781/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s rev-�� --show-toplevel go /usr/bin/git bot-detection.mdgit GO111MODULE ache/go/1.25.0/x--show-toplevel | tr &#39;\n&#39; &#39;:&#39;)$PATH&#34;; [ -n &#34;$GOROOT&#34; ] &amp;&amp; expo rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ache/uv/0.10.9/x--show-toplevel git (http block)
    • Triggering command: /tmp/go-build2455691315/b359/cli.test /tmp/go-build2455691315/b359/cli.test -test.testlogfile=/tmp/go-build2455691315/b359/testlog.txt -test.paniconexit0 -test.timeout=1m0s rev-�� --show-toplevel git /usr/bin/git --show-toplevel stmain.go ache/go/1.25.0/x64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linux_amd64/vet k/_temp/uv-python-dir/node --show-toplevel git /usr/bin/git git (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 d/gh-aw/main.go d/gh-aw/capitaliGOMOD 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 2225261/b384/_pkGOINSECURE 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 64/pkg/tool/linux_amd64/vet 0/x64/bin/node -json GO111MODULE ache/go/1.25.0/x--show-toplevel git 0/x6�� --show-toplevel go /usr/bin/git -json GO111MODULE .cfg git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --show-toplevel kflow.test /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git 0/x64/bin/node git (http block)

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


💡 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.

- Extract newValidationLogger() helper to validation_helpers.go and
  update all ~30 *_validation.go files to use it
- Split codemod_permissions.go into codemod_permissions_read.go and
  codemod_permissions_write.go following one-codemod-per-file pattern
- Move repoutil.SanitizeForFilename to stringutil package with tests
- Consolidate error_helpers.go + error_aggregation.go +
  shared_workflow_error.go into workflow_errors.go
- Establish Format* vs Render* naming convention in console package
  via doc.go
- Document intentional String()/IsValid() method duplication in
  constants package
- Consolidate 14 safe_outputs_* files into 4 cohesive modules:
  safe_outputs_config.go, safe_outputs_validation.go,
  safe_outputs_generation.go, safe_outputs_jobs.go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor semantic function clustering analysis results refactor: implement semantic function clustering improvements across pkg/ Mar 7, 2026
@pelikhan pelikhan marked this pull request as ready for review March 7, 2026 05:16
Copilot AI review requested due to automatic review settings March 7, 2026 05:16
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/ to reduce duplication and consolidate related workflow functionality (validation logging, safe-outputs modules, and workflow error types), while also moving/organizing a few cross-package utilities and docs.

Changes:

  • Add a shared newValidationLogger(domain) helper and update many *_validation.go files to use it.
  • Consolidate the workflow safe-outputs subsystem and workflow error types into fewer, larger modules.
  • Move SanitizeForFilename to pkg/stringutil, split a combined codemod into separate files, and add console naming-convention documentation.

Reviewed changes

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

Show a summary per file
File Description
pkg/workflow/workflow_errors.go Consolidates workflow error types + aggregation into one file
pkg/workflow/validation_helpers.go Adds newValidationLogger(domain) helper
pkg/workflow/tools_validation.go Switches to newValidationLogger("tools")
pkg/workflow/template_validation.go Switches to newValidationLogger("template")
pkg/workflow/template_injection_validation.go Switches to newValidationLogger("template_injection")
pkg/workflow/strict_mode_validation.go Switches to newValidationLogger("strict_mode")
pkg/workflow/step_order_validation.go Switches to newValidationLogger("step_order")
pkg/workflow/shared_workflow_error.go Removes file (moved into workflow_errors.go)
pkg/workflow/secrets_validation.go Switches to newValidationLogger("secrets")
pkg/workflow/schema_validation.go Switches to newValidationLogger("schema")
pkg/workflow/sandbox_validation.go Switches to newValidationLogger("sandbox")
pkg/workflow/safe_outputs_validation.go Adds/merges safe-outputs target validation into consolidated validation file
pkg/workflow/safe_outputs_tools_generation.go Removes file (tools generation moved into consolidated modules)
pkg/workflow/safe_outputs_target_validation.go Removes file (merged into safe_outputs_validation.go)
pkg/workflow/safe_outputs_steps.go Removes file (merged into consolidated safe-outputs modules)
pkg/workflow/safe_outputs_permissions.go Removes file (merged into consolidated safe-outputs modules)
pkg/workflow/safe_outputs_jobs.go Expands file to include permissions/env/step helpers previously split across multiple files
pkg/workflow/safe_outputs_env.go Removes file (merged into consolidated safe-outputs modules)
pkg/workflow/safe_outputs_config_messages.go Removes file (messages logic moved into consolidated config module)
pkg/workflow/safe_outputs_config_helpers.go Removes file (helpers moved into consolidated modules)
pkg/workflow/safe_outputs_config_generation_helpers.go Removes file (generation helpers moved into consolidated modules)
pkg/workflow/safe_outputs_config_generation.go Removes file (generation moved into consolidated modules)
pkg/workflow/safe_outputs_config.go Expands file to include GitHub App + messages config logic (consolidation)
pkg/workflow/safe_outputs_app.go Removes file (GitHub App logic moved into consolidated config module)
pkg/workflow/safe_outputs.go Removes file (previously documentation-only)
pkg/workflow/runtime_validation.go Switches to newValidationLogger("runtime")
pkg/workflow/runs_on_validation.go Switches to newValidationLogger("runs_on")
pkg/workflow/repository_features_validation.go Switches to newValidationLogger("repository_features")
pkg/workflow/pip_validation.go Switches to newValidationLogger("pip")
pkg/workflow/permissions_validation.go Switches to newValidationLogger("permissions")
pkg/workflow/npm_validation.go Switches to newValidationLogger("npm")
pkg/workflow/network_firewall_validation.go Switches to newValidationLogger("network_firewall")
pkg/workflow/mcp_config_validation.go Switches to newValidationLogger("mcp_config")
pkg/workflow/labels_validation.go Switches to newValidationLogger("labels")
pkg/workflow/imported_steps_validation.go Switches to newValidationLogger("imported_steps")
pkg/workflow/firewall_validation.go Switches to newValidationLogger("firewall")
pkg/workflow/features_validation.go Switches to newValidationLogger("features")
pkg/workflow/expression_validation.go Switches to newValidationLogger("expression")
pkg/workflow/error_helpers.go Removes file (merged into workflow_errors.go)
pkg/workflow/error_aggregation.go Removes file (merged into workflow_errors.go)
pkg/workflow/engine_validation.go Switches to newValidationLogger("engine")
pkg/workflow/docker_validation.go Switches to newValidationLogger("docker")
pkg/workflow/dispatch_workflow_validation.go Switches to newValidationLogger("dispatch_workflow")
pkg/workflow/dangerous_permissions_validation.go Switches to newValidationLogger("dangerous_permissions")
pkg/workflow/concurrency_validation.go Switches to newValidationLogger("concurrency")
pkg/workflow/compiler_filters_validation.go Switches to newValidationLogger("filter")
pkg/workflow/agent_validation.go Switches to newValidationLogger("agent")
pkg/stringutil/sanitize_test.go Moves SanitizeForFilename tests into stringutil
pkg/stringutil/sanitize.go Adds stringutil.SanitizeForFilename
pkg/repoutil/repoutil_test.go Removes SanitizeForFilename tests from repoutil
pkg/repoutil/repoutil.go Removes SanitizeForFilename from repoutil
pkg/constants/constants.go Documents intentional String()/IsValid() duplication across string-typed constants
pkg/console/doc.go Adds package doc describing Format* vs Render* naming convention
pkg/cli/trial_command.go Switches call sites to stringutil.SanitizeForFilename
pkg/cli/codemod_permissions_write.go Removes read-codemod code after splitting per-codemod-per-file
pkg/cli/codemod_permissions_read.go New file containing the read shorthand codemod

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

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +766 to +770
// convertPermissionsToAppTokenFields converts job Permissions to permission-* action inputs
// This follows GitHub's recommendation for explicit permission control
// Note: This only includes permissions that are valid for GitHub App tokens.
// Some GitHub Actions permissions (like 'discussions', 'models') don't have
// corresponding GitHub App permissions and are skipped.
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The doc comment says permissions like discussions are skipped because they don't have GitHub App equivalents, but the implementation later in this function adds permission-discussions. Please reconcile the comment with the actual behavior to avoid misleading maintainers.

Copilot uses AI. Check for mistakes.
// Check for permissions line with shorthand
if strings.HasPrefix(trimmedLine, "permissions:") {
// Handle shorthand on same line: "permissions: read" or "permissions: write"
if strings.Contains(trimmedLine, ": read") && !strings.Contains(trimmedLine, "read-all") && !strings.Contains(trimmedLine, ": read\n") {
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

trimmedLine is produced by strings.TrimSpace(line), so it will never contain a newline. The !strings.Contains(trimmedLine, ": read\n") check is therefore redundant/unreachable and can be removed to simplify the condition.

Suggested change
if strings.Contains(trimmedLine, ": read") && !strings.Contains(trimmedLine, "read-all") && !strings.Contains(trimmedLine, ": read\n") {
if strings.Contains(trimmedLine, ": read") && !strings.Contains(trimmedLine, "read-all") {

Copilot uses AI. Check for mistakes.
Comment on lines +579 to +583
name: "multiple slashes",
slug: "owner/repo/extra",
expected: "owner-repo-extra",
},
{
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

This test table includes the same input/expected pair twice (owner/repo/extraowner-repo-extra) under two different case names. Consider removing one of these duplicate cases to keep the test list minimal and easier to maintain.

Suggested change
name: "multiple slashes",
slug: "owner/repo/extra",
expected: "owner-repo-extra",
},
{

Copilot uses AI. Check for mistakes.
Comment on lines +737 to +739
// Extract repo name from github.repository (which is "owner/repo")
// Using GitHub Actions expression: split(github.repository, '/')[1]
steps = append(steps, " repositories: ${{ github.event.repository.name }}\n")
Copy link

Copilot AI Mar 7, 2026

Choose a reason for hiding this comment

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

The comment says the repo name is extracted via split(github.repository, '/')[1], but the code actually uses ${{ github.event.repository.name }}. Please update the comment to match the implementation (or switch the implementation to match the documented expression) to avoid confusion when maintaining the YAML generation logic.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit dfe305a into main Mar 7, 2026
112 checks passed
@pelikhan pelikhan deleted the copilot/refactor-semantic-analysis-results branch March 7, 2026 05:25
@mohamedbouddi7777-dev
Copy link

mohamedbouddi7777-dev commented Mar 8, 2026 via email

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: Refactoring Opportunities

4 participants