Skip to content

Refactor schedule parser long functions into focused helpers#33448

Merged
pelikhan merged 7 commits into
mainfrom
copilot/refactor-long-functions
May 20, 2026
Merged

Refactor schedule parser long functions into focused helpers#33448
pelikhan merged 7 commits into
mainfrom
copilot/refactor-long-functions

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 20, 2026

The lint issue flagged pkg/parser/schedule_parser.go for oversized parsing functions, with parseInterval and parseBase carrying too many responsibilities. This change narrows those hot paths into smaller helpers without changing the supported schedule syntax.

  • Interval parsing

    • Split parseInterval into discrete helpers for:
      • short-duration forms (every 2h, every 1mo)
      • every day aliases
      • long-form intervals (every 2 hours)
      • shared interval validation and cron formatting
    • Centralized minimum-duration checks and "at"-clause rejection so interval variants use the same rules.
  • Base schedule parsing

    • Split parseBase into dedicated handlers for:
      • daily schedules
      • hourly schedules
      • weekly schedules
      • named fuzzy schedules (bi-weekly, tri-weekly)
      • monthly schedules
    • Extracted daily between / around parsing into focused helpers instead of keeping all branches inline.
  • Shared schedule utilities

    • Added small formatting and conversion helpers for interval units and fuzzy cron generation.
    • Reduced duplicated branching across short/long interval paths.

Example of the extracted shape:

func (p *ScheduleParser) parseInterval() (string, error) {
	hasWeekdaysSuffix := p.hasWeekdaysSuffix()

	if cronExpr, handled, err := p.parseShortDurationInterval(hasWeekdaysSuffix); handled || err != nil {
		return cronExpr, err
	}
	if cronExpr, handled, err := p.parseEveryDayIntervalAlias(hasWeekdaysSuffix); handled || err != nil {
		return cronExpr, err
	}

	return p.parseLongInterval(hasWeekdaysSuffix)
}

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 gh repo view --json owner,name --jq .owner.login + "/" + .name x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh repo view --json owner,name --jq .owner.login + "/" + .name At,event,headBranch,headSha,displayTitle (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 (http block)
  • https://api.github.com/orgs/owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/owner/actions/secrets --jq .secrets[].name 4486566/001' 4486566/001' 64/bin/git (http block)
    • 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 (http block)
    • 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 ithub/workflows/architecture-guardian.md tmain.go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env licyMinIntegrityOnlymin-integrity_with_repos=public_4199584868/0remote.origin.url GO111MODULE /usr/bin/gh l GOMOD GOMODCACHE gh (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 OnlyCompiledOutput2049431400/001 /tmp/go-build677750814/b231/vet.cfg 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv SameOutput3349048013/001/stability-test.md GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env ApprovalLabelsCompiledOutput2913003852/001 GO111MODULE /opt/hostedtoolcache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 1311022945/001 GoFiles,IgnoredGoFiles,IgnoredOtherFiles,CFiles,CgoFiles,CXXFiles,MFiles,HFiles,FFiles,SFiles,Swmerge-file ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile pkg/actionpins/d/usr/bin/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv 1140083040 my-default ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 -buildtags sv -errorsas -ifaceassert -nilfunc git remo�� /ref/tags/v9 -tests sv 85994/001 cfg 64/pkg/tool/linugraphql 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, .object.type] | @tsv 0ODG4V5oS /tmp/go-build677750814/b139/vet.cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv 750814/b463/_pkg_.a -buildtags 750814/b463=> -errorsas -ifaceassert -nilfunc /opt/hostedtoolcache/go/1.25.8/xupstream -uns�� /ref/tags/v9 /tmp/go-build677750814/b264/vet.cfg sv (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv /ref/tags/v9 /tmp/go-build677750814/b157/vet.-nolocalimports sv (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 -aw/git/ref/tags/v2.0.0 config bject.type] | @tsv remote.upstream.infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv /repos/actions/github-script/git/ref/tags/v9 --jq om/myorg/repo.git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv user.name Test User /opt/hostedtoolcache/node/24.14.1/x64/bin/node GOSUMDB GOWORK 64/bin/go node /tmp�� /tmp/TestHashConsistency_GoAndJavaScript32559280remote.origin.url /opt/hostedtoolcGO111MODULE 64/pkg/tool/linux_amd64/link /tmp/go-build185git -trimpath 64/bin/go 64/pkg/tool/linutest@example.com (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 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -c=4 -nolocalimports -importcfg /tmp/go-build677750814/b476/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/testutil/tempdir.go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -c=4 -nolocalimports -importcfg /tmp/go-build677750814/b529/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/linters/excessivefuncparams/excessivefuncparams_test.go x_amd64/vet (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 (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 -c=4 -nolocalimports -importcfg /tmp/go-build677750814/b420/importcfg -pack /home/REDACTED/go/pkg/mod/golang.org/x/tools@v0.45.0/go/packages/doc.go /home/REDACTED/go/pkg/mod/golang.org/x/tools@v0.45.0/go/packages/external.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 -c=4 -nolocalimports -importcfg /tmp/go-build2211958874/b001/importcfg -pack /tmp/testenv-3662020090/main.go x_amd64/vet 3684�� (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 k/gh-aw/gh-aw/pkg/jsonutil/json.go k/gh-aw/gh-aw/pkg/jsonutil/json_test.go eTags}} -errorsas -ifaceassert -nilfunc infocmp -1 /ref/tags/v9 -tests sv url (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv ithub-script/git/ref/tags/v9.0.0 GO111MODULE (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 64/pkg/tool/linux_amd64/compile -errorsas FFiles,SFiles,Sw-1 -nilfunc J_/CWrYu2czG7Ca7ylQP4Z8/vCNYLdc7D8RXanEmFBss -uns�� _.a /tmp/go-build677750814/b275/vet.cfg 1/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv /v1.2.3 -trimpath sv l s,MFiles,HFiles,-1 -lang=go1.25 gh api licyMinIntegrityOnlymin-integrity_with_repos_array_c3663506458/0remote.origin.url --jq /usr/lib/git-core/git l -nolocalimports -importcfg /usr/lib/git-cor--jq (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv xterm-color url /opt/hostedtoolcache/go/1.25.8/x64/bin/go (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 se 750814/b452/vet.cfg ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile -errorsas -ifaceassert -nilfunc ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile -uns�� 222885364/.github/workflows /tmp/go-build677750814/b268/vet.cfg 1/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv til.go til_test.go 750814/b465=> -errorsas ers/ssljson_test-1 -nilfunc /opt/hostedtoolcache/go/1.25.8/xremote.upstream.url -uns�� k5DmDS7r3 /tmp/go-build677750814/b216/vet.cfg (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v6 --jq [.object.sha, .object.type] | @tsv UCun/hujaGx9miETl34DxUCun (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 750814/b476/_pkg_.a -importcfg 750814/b476=> -s b/gh-aw/pkg/testmerge-file -buildmode=exe 750814/b419/impocurrent (local changes) -uns�� ithub-script/gitbase (original) /tmp/go-build677-L ache/go/1.25.8/xnew (upstream) (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 0645-44299/test-3717388971/.github/workflows GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuTest User (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 runs/20260520-040029-22961/aw-ma-c=4 --json /usr/bin/git l owner/repo x_amd64/compile git 7508�� /tmp/gh-aw-test-runs/20260520-040029-22961/test-637669939/.github/workflows 750814/b554/_testmain.go ache/node/24.14.1/x64/bin/node (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 sistency_WithImports643844513/001/main.md /dev/null /opt/hostedtoolcache/go/1.25.8/x64/bin/go (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 GOPATH url /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.8/x--jq -ato�� -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git (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 750814/b568/_pkg_.a -trimpath 750814/b568=> -p b/gh-aw/pkg/sync-1 -lang=go1.25 /opt/hostedtoolcache/go/1.25.8/x--jq -o aV59/B4DWBi5MrU_koT8xaV59 -importcfg om/testorg/testrepo.git -buildmode=exe -buildid=_f5aboKmaintenance -extld=gcc 750814/b568/impo--auto (http block)
    • Triggering command: /usr/bin/gh gh api /repos/azure/login/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv runs/20260520-040645-44299/test-1784339789 show /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.8/x--jq @/tm�� -aw/git/ref/tags/v2.0.0 /opt/hostedtoolcGO111MODULE bject.type] | @tsv /bin/sh git 64/bin/go node (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 bility_SameInputSameOutput1015617804/001/stability-test.md origin /usr/bin/infocmp -c=4 -nolocalimports -importcfg infocmp -1 xterm-color -pack /usr/bin/gh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/docker/login-action/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv runs/20260520-040645-44299/test-1784339789 config (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 750814/b532/_pkg_.a -buildtags r: $owner, name: $name) { hasDiscussionsEnabled } } -errorsas b/gh-aw/pkg/lint-1 -nilfunc /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linu.github/workflows/test.md -o 66 -trimpath .lock.yml -p main -lang=go1.25 ache/go/1.25.8/x64/pkg/tool/linu--jq (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq [.object.sha, .object.type] | @tsv -json (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 0JJ7/28E-uGQBHDoA4-6E0JJ7 -buildtags ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile -errorsas -ifaceassert -nilfunc ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile -uns�� 805569363 pkg/mod/golang.org/x/tools@v0.45.0/internal/event/core/export.go-nolocalimports ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go (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 0029-22961/test-637669939/.githu--detach /tmp/go-build677750814/b089/vet.cfg 750814/b507/linters.test (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 3836177ee5c1ce93225bf230b97dd66b0dbd9e1334c4047125e4fbfdbce04c00-d GOINSECURE GOMOD GOMODCACHE go env 0645-44299/test-remote.upstream.url GO111MODULE r: $owner, name: $name) { hasDiscussionsEnabled } } GOINSECURE GOMOD GOMODCACHE 1/x64/bin/node (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-13 (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-20 (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-19 (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 committer.name cfg (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 cfg 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 8013/001/stabili.github/workflows/test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 750814/b047/vet.-test.run=^Test 64/pkg/tool/linu-test.short=true (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 cfg cfg (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 98/001/test-frontmatter-with-nesremote.origin.url GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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, (http block)
    • 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, h3821054023/001' h3821054023/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/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 750814/b046/vet.cfg cfg (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 750814/b059/vet.cfg cfg (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 98/001/test-frontmatter-with-arrays.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 oFiles,IgnoredOt-w 64/pkg/tool/linu-buildmode=exe (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 750814/b002/vet.cfg 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name 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/3/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name 750814/b058/vet.main 64/pkg/tool/linu-lang=go1.25 (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 cfg 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 8013/001/stability-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 750814/b064/vet.cfg 64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 750814/b049/vet.cfg cfg (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name 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/5/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name 750814/b123/vet.cfg cfg (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 750814/b144/vet.cfg cfg (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name 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/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path -c=4 -nolocalimports -importcfg /tmp/go-build677750814/b516/importcfg -pack /home/REDACTED/go/pkg/mod/golang.org/x/tools@v0.45.0/internal/testenv/exec.go /home/REDACTED/go/pkg/mod/golang.org/x/tools@v0.45.0/internal/testenv/testenv.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 (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 (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build677750814/b477/cli.test /tmp/go-build677750814/b477/cli.test -test.testlogfile=/tmp/go-build677750814/b477/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true ader (http block)
    • Triggering command: /tmp/go-build1875816500/b477/cli.test /tmp/go-build1875816500/b477/cli.test -test.testlogfile=/tmp/go-build1875816500/b477/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true **/*.ts **/*.json --ignore-path go env -json GOCACHE 64/bin/go -d /usr/lib/git-corenv modules/@npmcli/-json 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 k/gh-aw/gh-aw/pkg/cli config 0"}} url -nolocalimports -importcfg fi echo "$GH_AW_--jq -o 0029-22961/test-1140083040 -trimpath /usr/bin/infocmp -p github.com/githu-c -lang=go1.25 infocmp (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/dev --jq [.object.sha, .object.type] | @tsv /tmp/TestGuardPolicyBlockedUsersCommaSeparatedCompiledOutput2246245857/001 remote /usr/bin/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/dev --jq [.object.sha, .object.type] | @tsv /ref/tags/v9.0.0 -buildtags sv -errorsas -ifaceassert -nilfunc gh api ons-test4220361571 --jq ow-without-reaction.lock.yml h3821054023/001'infocmp git 64/bin/go node (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 ons-test3762527266 remote ow-with-reaction.lock.yml -c=4 -nolocalimports -importcfg /opt/hostedtoolcTest User -o /tmp/go-build677750814/b559/_pkg_.a -trimpath /usr/bin/git -p github.com/githu--norc -lang=go1.25 git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq [.object.sha, .object.type] | @tsv runs/20260520-040645-44299/test-3287399488/.github/workflows config .test remote.origin.urinfocmp GOWORK 64/bin/go .test lope�� xterm-color go 64/pkg/tool/linux_amd64/vet -json GO111MODULE layTitle 64/pkg/tool/linux_amd64/vet (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 3350694779 DefaultBranchFromLsRemoteWithRealGitmain_branch444486566/001' x_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq [.object.sha, .object.type] | @tsv 711936320/.github/workflows GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE not-exist-xyzzy.txt GOINSECURE GOMOD GOMODCACHE go (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 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq [.object.sha, .object.type] | @tsv iant-3862541750/.github/workflows 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/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 (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 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ned-imports-enabled-with-body-content.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv 4209813549/.github/workflows 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/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 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env ned-imports-enabremote.origin.url GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 nRC5-eFZgu1f (http block)
    • Triggering command: /usr/bin/gh gh api repos/github/gh-aw/issues/17 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/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 bility_SameInputSameOutput1015617804/001/stability-test.md --json /usr/bin/git --jq .owner.login + "-1 x_amd64/vet git -C /tmp/gh-aw-test-runs/20260520-040029-22961/test-2442740987/.github/workflows l /usr/bin/git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/google-github-actions/auth/git/ref/tags/v2 --jq [.object.sha, .object.type] | @tsv runs/20260520-040645-44299/test-1533581193 test@example.com /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet GOSUMDB GOWORK 64/bin/go /opt/hostedtoolcache/go/1.25.8/x--jq -ato�� -bool -buildtags e/git -errorsas -ifaceassert -nilfunc e/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 HEAD (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuremote.upstream.url env 2916882843/.github/workflows GO111MODULE 1/x64/bin/node 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 (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env ace-editor.md GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/org/repo/pulls/1
    • Triggering command: /usr/bin/gh gh api repos/org/repo/pulls/1 /home/REDACTED/work/gh-aw/gh-aw/pkg/envutil/envutil_test.go (http block)
    • Triggering command: /usr/bin/gh gh api repos/org/repo/pulls/1 go env d 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 -c=4 -nolocalimports -importcfg /tmp/go-build677750814/b510/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/linters/spec_test.go x_amd64/vet (http block)
    • 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 x_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 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-remote-workflow --limit 30 --repo owner/repo ache/go/1.25.8/xrev-parse remo�� 0029-22961/test-@{u} origin cfg (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 rt/yaml/yaml_default.go (http block)
    • 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 JuGJHAz8U (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch ab-testing-advisor.md GO111MODULE ache/go/1.25.8/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 1533581193 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)

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

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/0e4b9d1d-d0b1-4e95-800c-a7623785241d

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor long functions exceeding 60-line limit Refactor schedule parser long functions into focused helpers May 20, 2026
Copilot AI requested a review from gh-aw-bot May 20, 2026 04:09
@pelikhan pelikhan marked this pull request as ready for review May 20, 2026 04:10
Copilot AI review requested due to automatic review settings May 20, 2026 04:10
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 the human-friendly schedule parsing logic to break up oversized parsing functions (parseInterval, parseBase) into smaller, focused helpers while aiming to preserve existing supported syntax.

Changes:

  • Split interval parsing into helpers for short-duration syntax, every day alias handling, and long-form intervals with shared validation/formatting.
  • Split base schedule parsing into dedicated handlers for daily/hourly/weekly/monthly and named fuzzy schedules.
  • Introduced shared helpers for interval validation (minimum duration, "at" clause rejection) and cron formatting.
Show a summary per file
File Description
pkg/parser/schedule_parser.go Refactors interval and base schedule parsing into smaller helper functions and shared validation/formatting utilities.

Copilot's findings

Tip

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

Comments suppressed due to low confidence (2)

pkg/parser/schedule_parser.go:187

  • every day at <time> on weekdays currently parses successfully but silently ignores the trailing on weekdays suffix (it always returns MM HH * * *). This should either be rejected as an invalid format or honored by restricting the cron to weekdays (and adding/adjusting a test for this case).
			return "", true, err
		}
		minute, hour := parseTime(timeStr)
		return fmt.Sprintf("%s %s * * *", minute, hour), true, nil
	}

pkg/parser/schedule_parser.go:154

  • Short-duration intervals don’t validate that the parsed number is >= 1. For example, every 0m matches the duration pattern and currently errors as "minimum schedule interval is 5 minutes" rather than "invalid interval" (unlike every 0 minutes). Consider validating interval < 1 here (or inside validateMinimumInterval) for consistent validation and error messaging.
	interval, _ := strconv.Atoi(matches[1])
	unit := matches[2]
	if err := p.validateIntervalTimeClause(2, hasWeekdaysSuffix); err != nil {
		return "", true, err
  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment thread pkg/parser/schedule_parser.go Outdated
return p.parseMonthlyBase()

default:
return "", fmt.Errorf("unsupported schedule type '%s', use 'daily', 'weekly', 'bi-weekly', 'tri-weekly', or 'monthly'", baseType)
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot review all comments

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

Copilot AI commented May 20, 2026

@copilot review all comments

Addressed the actionable review feedback in 9e3117c: the unsupported schedule-type help text now includes hourly, and every day at <time> on weekdays now produces a weekday-only cron with regression coverage.

Copilot AI requested a review from pelikhan May 20, 2026 04:37
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot merge main and recompile

Copilot AI and others added 3 commits May 20, 2026 04:50
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
…-functions

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

Copilot AI commented May 20, 2026

@copilot merge main and recompile

Done in 6512b69 after merging origin/main at 1707887 and recompiling the workflow lock files. Targeted tests and the validation gate passed.

@pelikhan pelikhan merged commit 0508fe8 into main May 20, 2026
27 checks passed
@pelikhan pelikhan deleted the copilot/refactor-long-functions branch May 20, 2026 05:23
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] Lint: Refactor long functions (2409 findings, 60-line limit)

4 participants