Skip to content

refactor(parser): break up oversized functions in pkg/parser to satisfy 60-line limit#33683

Closed
Copilot wants to merge 13 commits into
mainfrom
copilot/refactor-oversized-functions-parser-workflow
Closed

refactor(parser): break up oversized functions in pkg/parser to satisfy 60-line limit#33683
Copilot wants to merge 13 commits into
mainfrom
copilot/refactor-oversized-functions-parser-workflow

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 21, 2026

The custom linter (make golint-custom) flags functions exceeding 60 body lines. Several large functions in pkg/parser were the worst offenders (up to 492 lines), making them hard to reason about and maintain.

Changes

Refactored the following functions by extracting focused helper functions — no logic changes, same signatures:

File Function Before
import_bfs.go processImportsFromFrontmatterWithManifestAndSource 492 lines
schedule_fuzzy_scatter.go ScatterSchedule 441 lines
mcp.go ParseMCPConfig / processBuiltinMCPTool / ExtractMCPConfigurations 253 / 172 / 164 lines
schema_compiler.go validateWithSchemaAndLocation 165 lines
include_processor.go processIncludedFileWithVisited / processIncludesWithVisited 166 / 112 lines
import_topological.go topologicalSortImports 157 lines

Each refactored function delegates to named helpers extracted into the same file, e.g.:

// Before: single 492-line function
func processImportsFromFrontmatterWithManifestAndSource(...) { ... }

// After: orchestrator + focused helpers
func processImportsFromFrontmatterWithManifestAndSource(...) {
    queue := buildInitialImportQueue(...)
    for ... {
        processNextImport(...)
    }
}
func buildInitialImportQueue(...) { ... }
func processNextImport(...) { ... }

Remaining work

25 non-test violations remain in pkg/parser and 277 in pkg/workflow — this PR addresses the largest offenders as a first pass.

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:

  • cafe.github.com
    • Triggering command: /usr/bin/gh /usr/bin/gh send-telemetry GOMODCACHE x_amd64/vet env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json herFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,FFiles,SFiles,SwigFiles,SwigCXXFiles,SysoFiles,T--deserialize 64/bin/go GOINSECURE GOMOD GOMODCACHE go (dns block)
    • Triggering command: /usr/bin/gh /usr/bin/gh send-telemetry 64/bin/go ache/go/1.25.8/x64/pkg/tool/linux_amd64/link -C 6472341/b584/timeutil.test s/12345/artifacts repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -json GO111MODULE 64/bin/go uaZfPHtRi8CIm/x9config t-30�� ensions/gh-aw go 6472341/b584/_pkg_.a -json GO111MODULE x_amd64/asm git (dns block)
    • Triggering command: /usr/bin/gh /usr/bin/gh send-telemetry 64/bin/go MfcYyJgSJSJvw/7S--jq api ensions/gh-aw --jq 6472341/b571/_pkg_.a -json GO111MODULE layTitle git -C /tmp/TestCompileUpdateDiscussionFieldEnforcement-p (dns block)
  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name 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 repo view --json owner,name --jq .owner.login + "/" + .name k GOINSECURE GOMOD GOMODCACHE go epOn�� -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh pr list --repo github/gh-aw --state all --author app/github-actions --search created:2026-05-11T23:58:00Z..2026-05-12T00:05:00Z --limit 1 --json number --jq .[0].number GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/orgs/owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/owner/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)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/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)
  • 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, .object.type] | @tsv t0 remote (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, .object.type] | @tsv -bool tPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtgithub.com/github/gh-aw/pkg/syncutil 64/pkg/tool/linux_amd64/compile -errorsas -ifaceassert -nilfunc 64/pkg/tool/linu--jq -C g_.a config ache/go/1.25.8/x64/pkg/tool/linux_amd64/link url GO111MODULE 64/bin/go ache/go/1.25.8/xconfig (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, .object.type] | @tsv 4/001/noflag-a.md GO111MODULE g_.a GOINSECURE GOMOD GOMODCACHE go faul�� 2952-36324/test-1195619304/custom/workflows GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolc--jq (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv GOMODCACHE go ache/node/24.15.0/x64/bin/node lGitmaster_brancnode lGitmaster_branc/opt/hostedtoolcache/node/24.15.0/x64/bin/npm x_amd64/vet ache/node/24.15.--package-lock-only 0108�� ensions/gh-aw x_amd64/vet /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv cal/share/gh/extensions/gh-aw go (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, .object.type] | @tsv /ref/tags/v9.0.0 '/tmp/TestParseDefaultBranchFrom100 sv GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet -uns�� -unreachable=false /tmp/go-build3396472341/b432/vet.cfg 0/x64/bin/node GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcconfig (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/link -ato�� -bool -buildtags cutil.test -errorsas -ifaceassert -nilfunc cutil.test (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv architecture-guardian.md tPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOt-test.run=^Test ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-test.v=true -ato�� -bool }} {{context.Compiler}} 64/pkg/tool/linux_amd64/vet -errorsas -ifaceassert -nilfunc 64/pkg/tool/linuconfig (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, .object.type] | @tsv tcp://localhost:2375" GH_AW_DOCKER_HOST_PATH_PREFIX_ARGS="" if [[ "${DOCKER_HOST:-}" =~ ^tcp:// gh x_amd64/vet l -json GO111MODULE x_amd64/vet git -C /tmp/gh-aw-test---detach status (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv cal/share/gh/extensions/gh-aw origin l -json GO111MODULE 64/pkg/tool/linu/home/REDACTED/.local/share/gh/extensions/gh-aw git conf�� /ref/tags/v9 remote.origin.url sv y-frontmatter.mdgh .cfg x_amd64/link gh (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv /tmp/go-build261GOINSECURE -trimpath 64/bin/go -p main -lang=go1.25 go 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/v9 --jq [.object.sha, .object.type] | @tsv -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/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build3396472341/b535/importcfg -pack /tmp/go-build3396472341/b535/_testmain.go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v9.0.0
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv /tmp/go-build261GOINSECURE -trimpath 64/bin/go -p main -lang=go1.25 go 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/v9.0.0 --jq [.object.sha, .object.type] | @tsv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env latted/flatted.go 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, .object.type] | @tsv 3810671370 go ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile hyphen2327332500gh hyphen2327332500api 64/bin/go ache/go/1.25.8/x--jq -C ensions/gh-aw config 6472341/b584=> remote.upstream./usr/bin/git GO111MODULE 64/bin/go infocmp (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, .object.type] | @tsv -bool -buildtags 0/x64/bin/node -errorsas -ifaceassert -nilfunc /tmp/go-build339--jq -has�� SameOutput2243824539/001/stabili.artifacts[].name -test.v=true l -test.timeout=10/usr/bin/git -test.run=^Test -test.short=true/home/REDACTED/.local/share/gh/extensions/gh-aw /opt/hostedtoolcconfig (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv -f {{context.GOARCH}} {{context.Compiler}} ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile unsafe GO111MODULE 64/bin/go ache/go/1.25.8/x--jq env 6472341/b583/_pkg_.a go repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -json b/gh-aw/pkg/time-C 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv f/tags/v999.999.999 l sv -json GO111MODULE nch,headSha,disp/repos/actions/ai-inference/git/ref/tags/v1 /tmp/go-build339--jq -tes�� -test.paniconexit0 -test.v=true /usr/bin/git -test.timeout=10sed -test.run=^Test -test.short=true git (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 faultBranchFromLsRemoteWithRealGitmaster_branch3139783126/002/work sv GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile -ato�� -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv 2952-36324/test-132507624/.github/workflows GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE set GOMODCACHE 64/pkg/tool/linux_amd64/vet -ato�� t.go t_test.go ache/go/1.25.8/x64/bin/go -errorsas -ifaceassert -nilfunc infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv -json stmain.go r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-goversion -ato�� -bool -buildtags 64/pkg/tool/linux_amd64/link -errorsas -ifaceassert -nilfunc 64/pkg/tool/linuconfig (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, .object.type] | @tsv -json tPath,Error,Dir,GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,-1 ache/go/1.25.8/x64/bin/go o GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu-trimpath -ato�� -bool -buildtags 4976420/main.go -errorsas -ifaceassert -nilfunc /opt/hostedtoolcconfig (http block)
  • https://api.github.com/repos/aws-actions/configure-aws-credentials/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/aws-actions/configure-aws-credentials/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 test@example.com sv -json GO111MODULE x_amd64/compile node /tmp�� cal/share/gh/extensions/gh-aw x_amd64/compile l ub/workflows GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/aws-actions/configure-aws-credentials/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 -importcfg sv -s -w -buildmode=exe git add cal/share/gh/extensions/gh-aw -extld=gcc (http block)
  • https://api.github.com/repos/azure/login/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/azure/login/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 x_amd64/vet sv -json GO111MODULE 64/bin/go git -C /home/REDACTED/work/gh-aw/gh-aw/pkg/cli config (http block)
  • https://api.github.com/repos/docker/login-action/git/ref/tags/v3
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 remote.origin.url sv -json GO111MODULE 64/bin/go node /tmp�� /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/approach-validator.md resolved$ (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, .object.type] | @tsv sistency_GoAndJavaScript1083648400/001/test-simple-frontmatter.m-s -trimpath (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, .object.type] | @tsv 5YP3JZqVC '/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitbranch_with_hmain 6472341/b544/regexpcompileinfunction.test GOINSECURE GOMOD GOMODCACHE ortcfg e=/t�� g/semverutil/semverutil.go g/semverutil/semverutil_test.go 0/x64/bin/node m0s -ifaceassert (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, .object.type] | @tsv 2952-36324/test-base (original) GO111MODULE /opt/hostedtoolcnew (upstream) GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcconfig ortc�� runs/20260521-042952-36324/test---workflow stmain.go 64/pkg/tool/linux_amd64/link url GOWORK 64/bin/go 64/pkg/tool/linuconfig (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-05-14 GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env -json .cfg 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuInitial commit (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --limit 100 --created >=2026-04-21 GOMOD GOMODCACHE x_amd64/asm env -json GO111MODULE ache/go/1.25.8/x64/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 --limit 100 --created >=2026-02-20 GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE lB/YYKcEG8_qc6Gwcommit GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linu-nilfunc GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuupstream env g_.a GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuorigin (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE SS/SnI6QuGF7Xsa9origin env efaultBranchFromLsRemoteWithRealGitmain_branch1726558551/001' efaultBranchFromLsRemoteWithRealGitmain_branch1726558551/001' ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link epOn�� or.md GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE In/lR17yz83lXghDTest User (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go env b/workflows GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1234567890
    • Triggering command: /usr/bin/gh gh api repos/{owner}/{repo}/actions/runs/1234567890 --jq {databaseId: .id, number: .run_number, url: .html_url, status: .status, conclusion: .conclusion, workflowName: .name, workflowPath: .path, createdAt: .created_at, startedAt: .run_started_at, updatedAt: .updated_at, event: .event, headBranch: .head_branch, -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linu-nilfunc GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu-tests env rity3346812502/001 GO111MODULE ortcfg.link GOINSECURE GOMOD GOMODCACHE Sgs0LVLhScxLVluotest@example.com (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE ache/go/1.25.8/x-lang=go1.25 GOINSECURE GOMOD GOMODCACHE go ortc�� -json stmain.go .cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/xTest User (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE tants GOMODCACHE 64/pkg/tool/linuorigin env yqOC6WSbs GO111MODULE ache/go/1.25.8/x64/pkg/tool/linu-importcfg GOINSECURE GOMOD GOMODCACHE ortcfg (http block)
    • 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/linuorigin env 3202558998 GO111MODULE ortcfg.link GOINSECURE l5OrZ3Z8C_sKWh1Pconfig GOMODCACHE g_.a (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go env /ref/tags/v9.0.0 GO111MODULE sv GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link env 3202558998 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linu-importcfg GOINSECURE til GOMODCACHE 64/pkg/tool/linu/home/REDACTED/work/gh-aw/gh-aw/pkg/stringutil/fuzzy_match.go env /a.out GO111MODULE ortcfg.link GOINSECURE cNz3n0ZtWGttkVixconfig GOMODCACHE g_.a (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go env 3202558998 sRemoteWithRealGitmain_branch1726558551/002/work x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go env thub/workflows GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/xremote.origin.url (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE k GOINSECURE GOMOD GOMODCACHE go sRem�� -json GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path -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 run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 mpiledOutput59480668/001 GO111MODULE sv GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build3396472341/b480/cli.test /tmp/go-build3396472341/b480/cli.test -test.testlogfile=/tmp/go-build3396472341/b480/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true -d main -lang=go1.25 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/dev
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/dev --jq [.object.sha, .object.type] | @tsv ensions/gh-aw Initial commit l -json GO111MODULE 64/bin/go git remo�� cal/share/gh/extensions/gh-aw myorg l -json GO111MODULE 64/pkg/tool/linu/home/REDACTED/.local/share/gh/extensions/gh-aw /opt/hostedtoolcconfig (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/dev --jq [.object.sha, .object.type] | @tsv ensions/gh-aw resolved$ /usr/bin/git ER_HOST:-}" =~ ^/usr/bin/git GO111MODULE 64/bin/go git remo�� cal/share/gh/extensions/gh-aw remote1 l ub/workflows GO111MODULE t git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v0.47.4
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq [.object.sha, .object.type] | @tsv ensions/gh-aw -test.v=true /usr/bin/git -test.timeout=10bash -test.run=^Test -test.short=true git conf�� --get remote.origin.url er: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabl/repos/actions/github-script/git/ref/tags/v9 -json GO111MODULE 64/pkg/tool/linu/home/REDACTED/.local/share/gh/extensions/gh-aw git (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, .object.type] | @tsv essivefuncparams.test GO111MODULE Name,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle GOINSECURE GOMOD GOMODCACHE wekFtX-xjVgj47Lxrepos/{owner}/{repo}/actions/runs/2/artifacts env 4539/001/stabili.artifacts[].name GO111MODULE g_.a GOINSECURE b/gh-aw/pkg/consapi GOMODCACHE ache/go/1.25.8/x--jq (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, .object.type] | @tsv -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE x_amd64/vet GOINSECURE V9bjGx2/bl1g1tSQ-C GOMODCACHE x_amd64/vet (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, .object.type] | @tsv -json herFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,FFiles,SFiles,SwigFiles,SwigCXXFiles,SysoFiles,Tconfig x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link (http block)
  • https://api.github.com/repos/github/gh-aw/issues/17
    • Triggering command: /usr/bin/gh gh api repos/github/gh-aw/issues/17 go env hyphen2327332500/001' hyphen2327332500/001' 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/google-github-actions/auth/git/ref/tags/v2
    • Triggering command: /usr/bin/gh gh api /repos/google-github-actions/auth/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 x_amd64/vet sv -json GO111MODULE x_amd64/vet node /tmp�� cal/share/gh/extensions/gh-aw x_amd64/vet l b/workflows GO111MODULE x_amd64/compile 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, .object.type] | @tsv -json stmain.go tartedAt,updatedAt,event,headBranch,headSha,displayTitle GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-test.v=true env 4539/001/stability-test.md GO111MODULE 6472341/b490=> GOINSECURE GOMOD GOMODCACHE go (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 go env 3823226294/.github/workflows GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x--json (http block)
  • https://api.github.com/repos/org/repo/pulls/1
    • Triggering command: /usr/bin/gh gh api repos/org/repo/pulls/1 go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/owner/repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/owner/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)
  • 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 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-remote-workflow --limit 30 --repo owner/repo x_amd64/compile env -json GO111MODULE 64/pkg/tool/linux_amd64/asm GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linutest@example.com (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 My Test Workflow Display Name --limit 30 --repo owner/repo go env edOutput3171687996/001 GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (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)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch nifest-legacy-2025788451/.github/workflows GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linurepos/{owner}/{repo}/actions/runs/12346/artifacts ortc�� -json stmain.go ache/go/1.25.8/x64/pkg/tool/linu-nilfunc GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-tests (http block)

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


pr-sous-chef: updated branch for run https://github.com/github/gh-aw/actions/runs/26222262708.

Generated by 👨‍🍳 PR Sous Chef · ● 27M ·

Copilot AI and others added 2 commits May 21, 2026 04:31
…p.go

ExtractMCPConfigurations: 165 → 51 body lines
processBuiltinMCPTool: 172 → 19 body lines
ParseMCPConfig: 253 → 54 body lines

New helpers:
- extractSafeOutputsConfig / extractSafeJobsConfig / extractMCPScriptsConfig
- parseGitHubMCPOptions / buildGitHubMCPBaseConfig / applyGitHubMCPCustomizations / buildPlaywrightMCPConfig
- parseMCPType / appendMCPContainerEnvArgs / appendMCPContainerMountArgs
- parseMCPStdioContainer / parseMCPStdioCommand / parseMCPStdioEnvNetwork / parseMCPStdio / parseMCPHTTP

No logic changes; exported function signatures unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
…port_bfs, include_processor, import_topological, schedule_fuzzy_scatter, schema_compiler

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/ad0812a4-0059-4c22-bc73-743bf8a2f243

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor oversized functions in parser and workflow packages refactor(parser): break up oversized functions in pkg/parser to satisfy 60-line limit May 21, 2026
Copilot AI requested a review from gh-aw-bot May 21, 2026 04:44
@pelikhan pelikhan marked this pull request as ready for review May 21, 2026 05:02
Copilot AI review requested due to automatic review settings May 21, 2026 05:02
Copy link
Copy Markdown
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 several oversized parser functions into smaller helper functions to satisfy the custom 60-line linter limit, while aiming to preserve existing behavior. Also includes a small JS style tweak and a reformat of the built-in model alias data.

Changes:

  • Extracted helper functions across pkg/parser (imports BFS/toposort, MCP parsing, include processing, schema error formatting, fuzzy schedule scattering).
  • Reworked schema validation error formatting code into focused helpers to reduce complexity in validateWithSchemaAndLocation.
  • Reformatted model_aliases.json and made a minor style change in validate-model-alias-chains.js.
Show a summary per file
File Description
scripts/validate-model-alias-chains.js Minor style-only arrow function tweak.
pkg/workflow/data/model_aliases.json Reformats alias map entries into single-line arrays.
pkg/parser/schema_compiler.go Extracts helpers for file context reading and precise/fallback schema error formatting.
pkg/parser/schedule_fuzzy_scatter.go Splits ScatterSchedule into parsing + per-pattern scatter helpers.
pkg/parser/mcp.go Breaks MCP extraction/parsing into helper functions (safe-outputs, safe-jobs, mcp-scripts, built-ins, stdio/http parsing).
pkg/parser/include_processor.go Extracts helper functions for deprecation warnings, include resolution, relaxed validation, and tools extraction.
pkg/parser/import_topological.go Decomposes topological sort into graph-building, indegree computation, Kahn’s algorithm, and cycle reporting.
pkg/parser/import_bfs.go Breaks BFS import processing into queue seeding, per-item dispatch, and nested import resolution helpers.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (1)

pkg/workflow/data/model_aliases.json:7

  • This file was reformatted to use long single-line arrays for most alias entries, which is inconsistent with the pretty-printed style used by other JSON data files in pkg/workflow/data/ (e.g., action_pins.json). The condensed formatting makes future edits and diffs harder to review; consider reverting to multi-line arrays/objects for consistency and readability.
    "sonnet": ["copilot/*sonnet*", "anthropic/*sonnet*"],
    "sonnet-6x": ["copilot/*sonnet-4-5-*", "anthropic/*sonnet-4-5-*", "copilot/*sonnet-4-6*", "anthropic/*sonnet-4-6*"],
    "haiku": ["copilot/*haiku*", "anthropic/*haiku*"],
  • Files reviewed: 8/8 changed files
  • Comments generated: 4

Comment thread pkg/parser/mcp.go Outdated
Comment on lines +88 to +121
// extractSafeJobsConfig merges safe-jobs entries into the safe-outputs MCP server config.
func extractSafeJobsConfig(frontmatter map[string]any, serverFilter string, configs []RegistryMCPServerConfig) []RegistryMCPServerConfig {
safeJobsSection, hasSafeJobs := frontmatter["safe-jobs"]
if !hasSafeJobs {
return configs
}
if serverFilter != "" && !strings.Contains(constants.SafeOutputsMCPServerID.String(), strings.ToLower(serverFilter)) {
return configs
}
var config *RegistryMCPServerConfig
for i := range configs {
if configs[i].Name == constants.SafeOutputsMCPServerID.String() {
config = &configs[i]
break
}
}
if config == nil {
newConfig := RegistryMCPServerConfig{
BaseMCPServerConfig: types.BaseMCPServerConfig{
Type: "stdio",
Command: "node",
Env: make(map[string]string),
},
Name: constants.SafeOutputsMCPServerID.String(),
}
configs = append(configs, newConfig)
config = &configs[len(configs)-1]
}
if safeJobsMap, ok := safeJobsSection.(map[string]any); ok {
for jobName := range safeJobsMap {
config.Allowed = append(config.Allowed, jobName)
}
}
return configs
Comment thread pkg/parser/mcp.go Outdated
}
containerStr, ok := container.(string)
if !ok {
return nil
Comment thread pkg/parser/schedule_fuzzy_scatter.go Outdated
} else {
result = fmt.Sprintf("%d */%d * * *", minute, interval)
}
scheduleFuzzyScatterLog.Printf("FUZZY:HOURLY/%d scattered: minute=%d, result=%s", interval, minute, result)
Comment on lines 1 to +6
{
"version": "1",
"description": "Built-in model alias map for GitHub Agentic Workflows. Each key is an alias name; the value is an ordered list of model patterns tried in sequence until one resolves.",
"aliases": {
"sonnet": [
"copilot/*sonnet*",
"anthropic/*sonnet*"
],
"sonnet-6x": [
"copilot/*sonnet-4-5-*",
"anthropic/*sonnet-4-5-*",
"copilot/*sonnet-4-6*",
"anthropic/*sonnet-4-6*"
],
"haiku": [
"copilot/*haiku*",
"anthropic/*haiku*"
],
"opus": [
"copilot/*opus*",
"anthropic/*opus*"
],
"gpt-4.1": [
"copilot/gpt-4.1*",
"openai/gpt-4.1*"
],
"gpt-5": [
"copilot/gpt-5*",
"openai/gpt-5*"
],
"gpt-5.4": [
"copilot/gpt-5.4*",
"openai/gpt-5.4*"
],
"gpt-5-mini": [
"copilot/gpt-5*mini*",
"openai/gpt-5*mini*"
],
"gpt-5-nano": [
"copilot/gpt-5*nano*",
"openai/gpt-5*nano*"
],
"gpt-5-codex": [
"copilot/gpt-5*codex*",
"openai/gpt-5*codex*"
],
"coding": [
"copilot/gpt-5*codex*",
"openai/gpt-5*codex*",
"gpt-5-codex"
],
"gpt-5-pro": [
"copilot/gpt-5*pro*",
"openai/gpt-5*pro*"
],
"reasoning": [
"copilot/o1*",
"copilot/o3*",
"copilot/o4*",
"openai/o1*",
"openai/o3*",
"openai/o4*"
],
"gemini-flash": [
"copilot/gemini-*flash*",
"google/gemini-*flash*",
"gemini/gemini-*flash*"
],
"gemini-flash-lite": [
"copilot/gemini-*flash*lite*",
"google/gemini-*flash*lite*",
"gemini/gemini-*flash*lite*"
],
"gemini-pro": [
"copilot/gemini-*pro*",
"google/gemini-*pro*",
"gemini/gemini-*pro*"
],
"vision": [
"copilot/gemini-*image*",
"gemini/gemini-*image*",
"copilot/gemini-*flash*",
"gemini/gemini-*flash*"
],
"gemma": [
"copilot/gemma*",
"google/gemma*",
"gemini/gemma*"
],
"deep-research": [
"copilot/deep-research*",
"copilot/o3-deep-research*",
"copilot/o4-mini-deep-research*",
"google/deep-research*",
"gemini/deep-research*",
"openai/o3-deep-research*",
"openai/o4-mini-deep-research*"
],
"small": [
"mini"
],
"mini": [
"haiku",
"gpt-5-mini",
"gpt-5-nano",
"gemini-flash-lite"
],
"large": [
"sonnet",
"gpt-5-pro",
"gpt-5",
"gemini-pro"
],
"auto": [
"large"
],
"any": [
"copilot/*",
"anthropic/*",
"openai/*",
"google/*",
"gemini/*"
],
"agent": [
"sonnet-6x",
"gpt-5.4",
"gpt-5",
"gemini-pro",
"haiku",
"any"
],
"copilot": [
"agent",
"gpt-5.4",
"sonnet",
"gpt-5",
"any"
],
"claude": [
"agent",
"sonnet-6x",
"haiku",
"any"
],
"codex": [
"agent",
"gpt-5-codex",
"gpt-5",
"any"
],
"gemini": [
"agent",
"gemini-pro",
"gemini-flash",
"any"
],
"gemini-3-pro": [
"copilot/gemini-3*pro*",
"google/gemini-3*pro*",
"gemini/gemini-3*pro*"
],
"gemini-3-flash": [
"copilot/gemini-3*flash*",
"google/gemini-3*flash*",
"gemini/gemini-3*flash*"
],
"computer-use": [
"copilot/*computer-use*",
"google/*computer-use*",
"gemini/*computer-use*",
"openai/*computer-use*"
],
"robotics": [
"copilot/*robotics*",
"google/*robotics*",
"gemini/*robotics*"
]
"sonnet": ["copilot/*sonnet*", "anthropic/*sonnet*"],
"sonnet-6x": ["copilot/*sonnet-4-5-*", "anthropic/*sonnet-4-5-*", "copilot/*sonnet-4-6*", "anthropic/*sonnet-4-6*"],
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

PR Code Quality Reviewer completed the code quality review.

No action needed: Reviewed PR #33683 (refactor: break up oversized functions). This is a clean, well-executed refactoring with no issues found. All 8 files show proper helper extraction, consistent naming, and no logic changes. No review comments needed - the code quality is excellent.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Design Decision Gate 🏗️ failed during design decision gate check.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

🧪 Test Quality Sentinel completed test quality analysis.

No test files were added or modified in PR #33683. This is a pure refactoring PR targeting pkg/parser/ functions. Test Quality Sentinel analysis skipped.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

PR Code Quality Reviewer completed the code quality review.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /zoom-out and /improve-codebase-architecture based on this being a pure refactor to satisfy linter constraints.


⚠️ CRITICAL: Missing Regression Protection

This PR refactors 1,361 lines across 4 critical files (BFS import traversal, topological sort, MCP config extraction, schedule fuzzy scatter) but includes ZERO test changes.

For a refactor of this magnitude extracting 50+ new functions from complex algorithms, the lack of regression tests is a blocking concern.

Why This Matters

  1. BFS Import Traversal (import_bfs.go) — 500 lines → 445 lines via 14 new functions

    • Handles nested imports, remote workflowspecs, cycle detection, input merging
    • High complexity: queue management, visited tracking, remote origin resolution
    • Risk: Logic errors in extraction boundaries could silently break import resolution
  2. Topological Sort (import_topological.go) — Kahn's algorithm refactored

    • Dependency graph construction, cycle detection
    • Risk: In-degree computation or queue ordering bugs would break build order
  3. MCP Configuration (mcp.go) — 170 lines → 147 lines via 11 new functions

    • Parsing frontmatter for builtin MCP servers (safeoutputs, safejobs, mcpscripts)
    • Risk: Config extraction bugs break AI engine integration
  4. Schedule Fuzzy Scatter (schedule_fuzzy_scatter.go) — 446 lines → 231 lines

    • Time parsing for cron schedule scattering
    • Risk: Parsing errors could break scheduled workflow execution

What's Missing

Before merge, add:

  1. Characterization tests — Capture current behavior for each extracted function

    func TestParseImportFieldToSpecs_AllFormats(t *testing.T) {
        // Array of strings, array of objects, object with 'aw' field
        // Ensures extraction preserved exact parsing logic
    }
  2. Edge case coverage for new helpers:

    • parseImportFieldToSpecs: empty arrays, nil inputs, malformed 'aw' field
    • resolveNestedImportPath: remote origins, section references
    • buildDependencyGraph: cyclic imports, missing files
    • parseAroundTargetTime / parseBetweenRangeTimes: invalid time formats
  3. Integration smoke test — Run existing parser integration tests and confirm:

    go test -v ./pkg/parser/ -run Integration

The existing test suite likely passes (since this claims to be no-logic changes), but that doesn't prove the extraction boundaries are correct for future maintenance.


Architecture Observations

✅ Positive Highlights

  1. Clear naming — Functions like seedInitialBFSQueue, runBFSTraversal, buildDependencyGraph use domain vocabulary and describe intent
  2. Consistent patterns — MCP extraction functions (extractSafeOutputsConfig, extractSafeJobsConfig) follow a uniform structure
  3. New typesbfsNestedImportEntry makes implicit queue item structure explicit
  4. Comments preserved — Helpful documentation migrated to extracted functions

🔍 Architectural Concerns (see inline comments)

  1. Function responsibilities still mixed — Some extracted functions (e.g., processInitialImportSpec) still do 4 distinct things (detection, parsing, validation, queue mutation). Consider further decomposition.

  2. Potential duplication — Array-of-string → ImportSpec conversion appears in multiple places. Extract to specsFromStringArray() helper.

  3. Pattern repetition — MCP config extractors may share frontmatter parsing logic. Consider extractBuiltinMCPServerConfig() to DRY up.


Verdict

Requesting changes on the missing regression test coverage before merge.

The refactor structure is sound and the linter goal is achieved, but shipping 50+ untested function boundaries in critical path code (import resolution, dependency ordering, AI config parsing) is too risky.

Suggested path forward:

  1. Add characterization tests for the 5-10 highest-impact extracted functions
  2. Run full test suite (make test) and confirm zero failures
  3. Optionally: address architectural duplication flagged in inline comments (can be follow-up)

Once test coverage is added, this will be a great improvement to codebase maintainability. 🎯

Note

🔒 Integrity filter blocked 1 item

The following item was blocked because it doesn't meet the GitHub integrity level.

  • #33683 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · ● 1.1M

Comment thread pkg/parser/import_bfs.go
type bfsNestedImportEntry struct {
path string
inputs map[string]any
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/improve-codebase-architecture] The new helper type bfsNestedImportEntry is well-named and uses the domain vocabulary (BFS, nested, import). This shallow helper type with simple fields is a good example of making implicit structure explicit.

✅ Positive: Clear naming that matches the BFS algorithm being implemented.

Comment thread pkg/parser/import_bfs.go
var importSpecs []ImportSpec
// parseImportFieldToSpecs parses the imports frontmatter field into a slice of ImportSpec.
// Accepts array-of-strings, array-of-objects, or object-with-aw-subfield forms.
func parseImportFieldToSpecs(importsField any) ([]ImportSpec, error) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/zoom-out] parseImportFieldToSpecs is nicely extracted, but consider: this function has 4 return paths and handles 3 different input shapes (array-of-strings, array-of-objects, object-with-aw).

Could this benefit from further decomposition? The array-of-any and array-of-string cases share logic:

// Consider extracting:
func specsFromStringArray(strs []string) []ImportSpec {
    specs := make([]ImportSpec, len(strs))
    for i, s := range strs {
        specs[i] = ImportSpec{Path: s}
    }
    return specs
}

This would eliminate duplication in lines 58 and 74.

Comment thread pkg/parser/import_bfs.go
if isWorkflowSpec(filePath) {
origin = parseRemoteOrigin(filePath)
if origin != nil {
importLog.Printf("Tracking remote origin for workflowspec: %s/%s@%s", origin.Owner, origin.Repo, origin.Ref)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[/improve-codebase-architecture] processInitialImportSpec is doing 4 distinct things:

  1. Repository import detection (lines 148-152)
  2. Section name parsing (lines 153-159)
  3. Path resolution + validation (lines 160-174)
  4. Queue management + cycle detection (lines 180-193)

Each of these could be a separate function with a clear name. The current 45-line function is under the 60-line limit, but it's mixing validation, transformation, and queue state mutation.

Consider: validateImportPath(), resolveImportPath(), enqueueIfNotVisited() as three focused helpers.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

Design Decision Gate 🏗️ completed the design decision gate check.

@github-actions
Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Status: ✅ No test files modified

This PR is a pure refactoring change that breaks up oversized functions in pkg/parser/ to satisfy the 60-line limit. No test files were added or modified.

Files changed: 8 files (all production code)

  • pkg/parser/import_bfs.go
  • pkg/parser/import_topological.go
  • pkg/parser/include_processor.go
  • pkg/parser/mcp.go
  • pkg/parser/schedule_fuzzy_scatter.go
  • pkg/parser/schema_compiler.go
  • pkg/workflow/data/model_aliases.json
  • scripts/validate-model-alias-chains.js

Recommendation: Since this is a refactoring PR with no test changes, please ensure existing tests continue to pass in CI to validate that the refactoring preserves behavioral contracts.

🧪 Test quality analysis by Test Quality Sentinel · ● 390.3K ·

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

🧠 Matt Pocock Skills Reviewer failed to deliver outputs during the skills-based review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

🧪 Test Quality Sentinel completed test quality analysis.

No test files were added or modified in PR #33683. This is a pure refactoring PR (breaking up oversized functions in pkg/parser) with changes only to production code and documentation. Test Quality Sentinel analysis skipped as there are no new or changed tests to evaluate.

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Code Quality Review

Approval: This refactoring successfully reduces function complexity without introducing bugs.

What was reviewed

Files analyzed:

  • pkg/parser/import_bfs.go (492 → extracted helpers)
  • pkg/parser/mcp.go (253/172/164 → extracted helpers)
  • pkg/parser/schedule_fuzzy_scatter.go (441 → extracted helpers)
  • pkg/parser/schema_compiler.go (165 → extracted helpers)
  • pkg/parser/include_processor.go (166/112 → extracted helpers)
  • pkg/parser/import_topological.go (157 → extracted helpers)
  • scripts/validate-model-alias-chains.js (formatting)

Review focus:

  • Logic preservation across refactoring
  • Error handling consistency
  • Helper function naming and clarity
  • Edge case handling
  • Type safety and nil handling

Key Strengths

  1. Clean extraction: Each helper has a clear, single purpose with descriptive names (seedInitialBFSQueue, extractSafeOutputsConfig, parseAroundTargetTime)
  2. No logic changes: Refactoring is purely structural — all behavior preserved
  3. Good documentation: Helpers include clear comments explaining their role
  4. Consistent error handling: Error paths maintained through extraction

Minor Observation (Non-blocking)

In import_bfs.go, the processInitialImportSpec function uses a pointer to slice (queue *[]importQueueItem) to modify the queue. While this works correctly, the more idiomatic Go pattern would be to return the modified slice:

// Current pattern (works, but less idiomatic)
func processInitialImportSpec(..., queue *[]importQueueItem, ...) error {
    *queue = append(*queue, item)
}

// More idiomatic pattern
func processInitialImportSpec(...) ([]importQueueItem, error) {
    return append(queue, item), nil
}

However, this is purely a style preference and doesn't affect correctness. The current approach is consistent with the existing codebase pattern.

Summary

This PR achieves its goal of satisfying the function line limit while maintaining code correctness. The extracted helpers are well-named, properly scoped, and make the code more maintainable. No blocking issues found.

References:

Note

🔒 Integrity filter blocked 1 item

The following item was blocked because it doesn't meet the GitHub integrity level.

  • #33683 pull_request_read: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".

To allow these resources, lower min-integrity in your GitHub frontmatter:

tools:
  github:
    min-integrity: approved  # merged | approved | unapproved | none

🔎 Code quality review by PR Code Quality Reviewer · ● 796.3K

@github-actions
Copy link
Copy Markdown
Contributor

✅ Design Decision Gate — ADR Verified

The implementation in this PR aligns with the linked Architecture Decision Record committed to the branch.

ADR reviewed: ADR-33683: Extract Same-Package Helpers to Satisfy Function-Line Limit

Verification Summary

The ADR establishes a clear normative spec for behavior-preserving, same-package helper extraction to satisfy the largefunc 60-line limit. Spot-checking the diff against each MUST/MUST NOT requirement:

  • Signature preservationprocessImportsFromFrontmatterWithManifestAndSource, ScatterSchedule, ParseMCPConfig, validateWithSchemaAndLocation, and topologicalSortImports all retain their original names, parameter lists, and return types
  • Same-file helpers — extracted helpers live alongside their orchestrators (e.g., buildInitialImportQueue, processNextImport in import_bfs.go)
  • No new packages or interfaces — refactor stays within pkg/parser
  • No lint suppressions — no //nolint:largefunc directives introduced anywhere in pkg/parser
  • Unexported helpers — extracted helpers use lower-case initial letters as required

The ADR also establishes the canonical pattern for the remaining 25 pkg/parser and 277 pkg/workflow violations, so subsequent cleanup PRs can follow this template without re-litigating the design.

Minor housekeeping note

The ADR file is present on the branch (commit 47934e8) but is not yet linked from the PR description. Consider adding a line to the PR body such as:

ADR: ADR-33683: Extract Same-Package Helpers to Satisfy Function-Line Limit

This makes the design decision discoverable from the PR view without having to traverse the file tree.

The ADR status is currently Draft — finalize to Accepted before merge so the decision becomes the canonical reference for future cleanup PRs.

The design decision has been recorded and the implementation follows it. Great work! 🏗️

References:

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · ● 3.7M ·

…ses changes, fix parseMCPStdioContainer type error, add legacy safe-jobs warning, fix scatterHourly log prefix

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot review all comments

Addressed all four review comments in commit fix(parser): address PR review comments:

  1. model_aliases.json / validate-model-alias-chains.js — Reverted both files to their original state; those changes were unintentionally included.

  2. parseMCPStdioContainer nil return — Changed the !ok branch to return fmt.Errorf("tool %s: 'container' must be a string, got %T", toolName, container) so callers get a descriptive type error instead of a silently partial config.

  3. extractSafeJobsConfig legacy safe-jobs — Added a doc comment and a mcpLog.Print warning noting this is a legacy/relaxed-validation path and that new workflows should use safe-outputs.jobs. (Removing the path entirely would be a separate breaking-change PR since the original code pre-dates this refactor.)

  4. scatterHourly log prefix — Replaced the hardcoded "FUZZY:HOURLY/%d" with "%s%d" using the prefix parameter, so the log accurately reflects FUZZY:HOURLY_WEEKDAYS/N when that variant is processed.

@github-actions github-actions Bot mentioned this pull request May 21, 2026
Copilot AI requested a review from pelikhan May 21, 2026 05:30
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot remove legacy safe-jobs

…CPConfigurations

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot remove legacy safe-jobs

Done. Removed the extractSafeJobsConfig function and its call site from ExtractMCPConfigurations in commit fix(parser): remove legacy top-level safe-jobs handling. All parser tests still pass.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

…sized-functions-parser-workflow

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot merge main and recompile

Merged origin/main and rebuilt successfully — build and parser tests all pass.

@github-actions
Copy link
Copy Markdown
Contributor

``
@copilot review all comments

Please address any remaining review feedback or summarize blockers.

Forward-progress: refresh branch and re-run checks or post a completion plan.

Generated by 👨‍🍳 PR Sous Chef · ● 207.2K ·

@github-actions
Copy link
Copy Markdown
Contributor

Please rebase onto main and rerun parser checks, then share any remaining blockers.

Generated by 👨‍🍳 PR Sous Chef · ● 27M ·

@pelikhan
Copy link
Copy Markdown
Collaborator

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot fix https://github.com/github/gh-aw/actions/runs/26223059632/job/77178513326#step:7:1

Fixed. The CI failure was a Prettier formatting issue in actions/setup/js/evaluate_outcomes.cjs introduced by the merge — ran prettier --write on the file. Pushed in the latest commit.

@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main, recompile, fix conflicts

…sized-functions-parser-workflow

# Conflicts:
#	.github/workflows/agent-persona-explorer.lock.yml
#	.github/workflows/daily-cache-strategy-analyzer.lock.yml
#	.github/workflows/daily-fact.lock.yml
#	.github/workflows/daily-observability-report.lock.yml
#	.github/workflows/duplicate-code-detector.lock.yml
#	.github/workflows/grumpy-reviewer.lock.yml
#	.github/workflows/issue-arborist.lock.yml
#	.github/workflows/necromancer.lock.yml
#	.github/workflows/schema-feature-coverage.lock.yml
#	.github/workflows/smoke-call-workflow.lock.yml
#	.github/workflows/smoke-codex.lock.yml

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 21, 2026

@copilot merge main, recompile, fix conflicts

Done. Merged origin/main, resolved 11 lock file conflicts (accepted main versions for all auto-generated .lock.yml files), and confirmed build and parser tests pass.

@pelikhan pelikhan closed this May 21, 2026
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.

[lint-monster] Fix: Refactor oversized functions in parser and workflow packages (2380 violations)

4 participants