Skip to content

Add ArtifactName, RunCount, Minutes semantic types for untyped constants#17896

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/add-semantic-types-artifact-names
Closed

Add ArtifactName, RunCount, Minutes semantic types for untyped constants#17896
Copilot wants to merge 2 commits intomainfrom
copilot/add-semantic-types-artifact-names

Conversation

Copy link
Contributor

Copilot AI commented Feb 23, 2026

Two groups of constants in pkg/constants lacked semantic types, relying on comments to convey units and purpose. This introduces three new types following the existing pattern (String() + IsValid() methods).

New types

  • ArtifactName string — applied to SafeOutputArtifactName and AgentOutputArtifactName
  • RunCount int — applied to DefaultRateLimitMax
  • Minutes int — applied to DefaultRateLimitWindow
// Before
const SafeOutputArtifactName = "safe-output"
const DefaultRateLimitMax = 5     // Default maximum runs per time window
const DefaultRateLimitWindow = 60 // Default time window in minutes (1 hour)

// After
const SafeOutputArtifactName ArtifactName = "safe-output"
const DefaultRateLimitMax RunCount = 5
const DefaultRateLimitWindow Minutes = 60

Usage site updates

  • pkg/workflow/: threat_detection.go, safe_jobs.go, role_checks.go, agentic_output_test.go — explicit string(...), RunCount(...), Minutes(...) conversions where underlying primitive is required
  • pkg/cli/: logs_parsing_core.go, logs_orchestrator.go, logs_metrics.go, and three test files — string() conversions for filepath.Join and strings.EqualFold call sites
  • pkg/constants/constants_test.gostring() conversions in test table

Warning

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

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

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw -c=4 -nolocalimports git -C /tmp/shared-actions-test1328549657 rev-parse /usr/bin/git DfIt/H91eAJ5JZRwgit GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw go 64/bin/node git -C /tmp/gh-aw-test-runs/20260223-115434-30755/test-2297116741/.github/workflows config /usr/bin/git remote.origin.urgit x_amd64/compile /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel /opt/hostedtoolcrev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/actions/ai-inference/git/ref/tags/v1
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha -json GO111MODULE 8377531/b124/vet.cfg GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/node/24.13.0/x64/bin/node GOINSECURE GOMOD GOMODCACHE /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel git /usr/bin/git /tmp/file-trackegit /tmp/file-trackerev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-current node /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/sed bin:/usr/local/bgit ache/node/24.13.rev-parse /usr/bin/git sed (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 2909/001/stability-test.md GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env 5108-26825/test-3390462030/.github/workflows GO111MODULE .cfg GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha e:]]*"\([^"]*\)".*/\1/p sed ache/go/1.25.0/x64/bin/node GOMODCACHE xLPGO5v5ZsAOsG8Wrev-parse /usr/bin/git git ache�� --show-toplevel nly /usr/bin/git --show-toplevel go /usr/bin/git /usr/bin/git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env runs/20260223-115108-26825/test-1927091511/.github/workflows GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha vaScript1098321181/001/test-frontmatter-with-env-template-expressions.md GO111MODULE Name,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle GOINSECURE GOMOD GOMODCACHE go env runs/20260223-115108-26825/test-2986648459/.github/workflows GO111MODULE 8377531/b291/vet.cfg l GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v4 --jq .object.sha om/owner/repo.git Test User /usr/bin/git prettier --check 64/bin/go git conf�� user.email test@example.com /usr/bin/git echo "��� JavaScgit node 64/bin/go git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha -bool -buildtags /usr/bin/git -errorsas -ifaceassert -nilfunc git -C /tmp/gh-aw-test-runs/20260223-115108-26825/test-2986648459/.github/workflows rev-parse 8377531/b416/vet.cfg b136a0101c461533git GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel sh /usr/bin/git "prettier" --chegit bash 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE 64/bin/go /usr/bin/git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE erignore env ript formatting GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE _9LLtYheNxUI env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE sh (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 ingutil.test 8377531/b125/vet.cfg ortcfg.link GOINSECURE GOMOD GOMODCACHE 2GrHKbdPFsnY6xQzyS/oFy7E6D7PTBexQgP2YYC/SYVWI1Pjb7L_MWnrvwk8 env runs/20260223-115108-26825/test-1927091511/.github/workflows GO111MODULE g_.a GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git /tmp/compile-allgit rev-parse /usr/bin/git git rev-�� 1755180475 git /usr/sbin/iptables user.email test@example.comrev-parse ache/node/24.13.--show-toplevel iptables (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /home/REDACTED/work/_temp/uv-python-dir/node p_uPa-P7x /opt/hostedtoolcrev-parse /usr/bin/git node /opt�� install --package-lock-only /usr/bin/git 958582576/.githugit stmain.go ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha -json GO111MODULE /opt/hostedtoolcache/go/1.25.0/x-nilfunc GOINSECURE GOMOD GOMODCACHE go env 5108-26825/test-3518526944 GO111MODULE /opt/hostedtoolcache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha 5434-30755/test-4022636662/.github/workflows git /usr/bin/git --get (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /opt/hostedtoolcache/node/24.13.-buildmode=exe TYO8hM-7O infocmp /usr/bin/git /opt/hostedtoolcache/node/24.13.-extld=gcc inst�� --package-lock-only git /usr/bin/git --show-toplevel stmain.go ache/go/1.25.0/x--show-toplevel git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 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 download 1 --dir test-logs/run-1 make /usr/bin/git ithub/workflows/git GOPROXY /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git s/test.md rev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 git /tmp/TestGetNpmBinPathSetup_GorootOrdering2030659244/001/go/1.25.0/x64/bin/go --show-toplevel git /usr/bin/git go vers�� /usr/bin/git git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12345/artifacts
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 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 download 12345 --dir test-logs/run-12345 ache/go/1.25.0/x64/pkg/tool/linux_amd64/compile /usr/bin/git ithub/workflows/git GOPROXY 8377531/b416=> git rev-�� p_uPa-P7x /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/vet /usr/bin/git f7kT/fS1T_wjKeBggit -buildtags ache/node/24.13.--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 git /usr/bin/bash --show-toplevel (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/12346/artifacts
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 GO111MODULE 64/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 download 12346 --dir test-logs/run-12346 Initial /usr/bin/git ithub-script/gitgit GOPROXY /usr/bin/git git rev-�� --show-toplevel git .cfg --show-toplevel rtcfg /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 git /usr/bin/sed --show-toplevel git /opt/hostedtoolc--git-dir sed s/::�� /usr/bin/git node /usr/bin/git install --package-lock-orev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 go /usr/bin/git sistency_GoAndJagit -parallel=4 /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git /tmp/gh-aw-test-git config /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 git /usr/bin/find --show-toplevel git /opt/hostedtoolc/tmp/gh-aw-test-runs/20260223-115713-37893/test-2137214581 find /opt�� -maxdepth 4 /usr/bin/git d -name bin git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 GO111MODULE 64/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 download 3 --dir test-logs/run-3 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/compile /usr/bin/git GOPATH GOPROXY clusion,workflow--show-toplevel git rev-�� --show-toplevel git /usr/bin/git s/test.md rtcfg /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 e/git /usr/bin/bash --show-toplevel git /usr/bin/git bash -c unset GOROOT; ex.github/workflows/test.md git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 GO111MODULE x_amd64/vet GOINSECURE GOMOD GOMODCACHE x_amd64/vet env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 /opt/hostedtoolc--jq /usr/bin/git GOPATH GOPROXY /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git /tmp/gh-aw-test-git rev-parse ache/node/24.13.--git-dir git (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 git /usr/bin/tr --show-toplevel git /opt/hostedtoolcHEAD tr \n : node /usr/bin/git install --package-lock-orev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 GO111MODULE x_amd64/link GOINSECURE GOMOD GOMODCACHE x_amd64/link env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE lj/mxXq840b1E1KaJyHxqD8/NawLaW_qZIqiXQp2Uc0n (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linu-importcfg /usr/bin/git GOPATH (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 git /usr/bin/git --show-toplevel git /home/REDACTED/wor.github/workflows/test.md git rev-�� --show-toplevel node /usr/bin/git install --package-lock-orev-parse /usr/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE go env ZUEl/YNZMKE4BXWEGOSUMDB GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 551027/b397/importcfg (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 x_amd64/compile env ty-test.md GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build4204830736/b001/cli.test /tmp/go-build4204830736/b001/cli.test -test.testlogfile=/tmp/go-build4204830736/b001/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=3m0s --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)
  • https://api.github.com/repos/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 -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 1846623464/.github/workflows GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --get-regexp ^remote\..*\.gh-resolved$ 86_64/node -json GO111MODULE 64/bin/go git 0/x6�� --show-toplevel go /usr/bin/git ub/workflows GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git /usr/bin/git nner/work/gh-aw/git go /usr/bin/git git chec�� .github/workflows/test.md git /usr/bin/git --show-toplevel go /usr/bin/infocmp--show-toplevel git (http block)
  • https://api.github.com/repos/nonexistent/action/git/ref/tags/v999.999.999
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha -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/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha download 4 0/x64/bin/node test-logs/run-4 GO111MODULE x_amd64/vet git 0/x6�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel git 64/bin/node ub/workflows mNSu1CuxZwGgQ1A1rev-parse /usr/bin/git git 0/x6�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
  • https://api.github.com/repos/nonexistent/repo/actions/runs/12345
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion -bool -buildtags /usr/bin/git git rev-�� 5434-30755/test-2297116741/.github/workflows git /usr/bin/git /tmp/gh-aw-test-git rev-parse 8377531/b425/vet--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion ature-branch.patgit git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)
  • https://api.github.com/repos/owner/repo/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 551027/b384/_pkgGOINSECURE GO111MODULE 64/bin/go GOINSECURE bracelet/x/exp/g--norc GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 551027/b385/_pkgGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/cons--norc GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo /usr/bin/git -json GO111MODULE x_amd64/link git rev-�� --show-toplevel x_amd64/link /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build3418377531/b381/cli.test /tmp/go-build3418377531/b381/cli.test -test.testlogfile=/tmp/go-build3418377531/b381/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env ck 'scripts/**/*GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /tmp/go-build1005792666/b360/cli.test /tmp/go-build1005792666/b360/cli.test -test.testlogfile=/tmp/go-build1005792666/b360/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=3m0s -test.run=^Test -test.short=true /usr/bin/git -json GO111MODULE x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /tmp/go-build4204830736/b001/cli.test /tmp/go-build4204830736/b001/cli.test -test.testlogfile=/tmp/go-build4204830736/b001/testlog.txt -test.paniconexit0 -test.v=true -test.timeout=3m0s --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git (http block)
  • https://api.github.com/repos/test-owner/test-repo/actions/secrets
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name GOSUMDB GOWORK 64/bin/go GOINSECURE GOMOD GOMODCACHE ache/go/1.25.0/xGO111MODULE env 551027/b273/_pkgGOINSECURE GO111MODULE 64/bin/go GOINSECURE b/gh-aw/pkg/consenv GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name -v go n-dir/node -json GO111MODULE x_amd64/link git 0/x6�� --show-toplevel x_amd64/link /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name --show-toplevel git /usr/bin/git --show-toplevel git /usr/bin/git git rev-�� --show-toplevel git ache/uv/0.10.4/x86_64/node --show-toplevel git /usr/bin/git bin 2>/dev/null | tr '\n' ':')$PATH"; [ -n "$GOROOT" ] && expo (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch : node /usr/bin/git install --package-lock-orev-parse /usr/bin/git git rev-�� --show-toplevel git 0/x64/bin/node --show-toplevel git /usr/bin/git git (http block)

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

Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Add ArtifactName, RunCount, Minutes semantic types for untyped constants</issue_title>
<issue_description>## Objective

Introduce semantic types for artifact name constants and rate limit constants in pkg/constants, improving clarity and preventing unit/purpose confusion.

Context

Discussion #17885 (Typist - Go Type Consistency Analysis) identified two groups of low-priority but clear-improvement untyped constants:

Group 1 — Artifact Names (pkg/constants/constants.go ~lines 641–645):

// Current — untyped
const SafeOutputArtifactName = "safe-output"
const AgentOutputArtifactName = "agent-output"
const AgentOutputFilename = "agent_output.json"

// Proposed
type ArtifactName string

const SafeOutputArtifactName ArtifactName = "safe-output"
const AgentOutputArtifactName ArtifactName = "agent-output"
// AgentOutputFilename remains untyped string (it's a filename, not an artifact name)

Group 2 — Rate Limit Constants (pkg/constants/constants.go ~lines 694–695):

// Current — untyped ints with comments explaining units
const DefaultRateLimitMax = 5     // Default maximum runs per time window
const DefaultRateLimitWindow = 60 // Default time window in minutes (1 hour)

// Proposed — units encoded in the type name
type RunCount int
type Minutes int

const DefaultRateLimitMax RunCount = 5
const DefaultRateLimitWindow Minutes = 60

Approach

  1. Add type ArtifactName string with String() method, apply to 2 artifact name constants
  2. Add type RunCount int and type Minutes int, apply to the 2 rate limit constants
  3. Update all usage sites for the artifact name constants
  4. Update all usage sites for the rate limit constants (they are used in rate limit validation logic)

Files to Modify

  • pkg/constants/constants.go — add 3 new types, apply to 4 constants
  • Any files in pkg/workflow/ or pkg/cli/ that reference these constants

Acceptance Criteria

  • type ArtifactName string defined with String() method; applied to 2 artifact name constants
  • type RunCount int and type Minutes int defined; applied to 2 rate limit constants
  • All usage sites compile correctly
  • make build and make test-unit pass
  • make fmt and make lint pass

Generated by Plan Command for issue #discussion #17885

  • expires on Feb 25, 2026, 11:40 AM UTC

Comments on the Issue (you are @copilot in this section)


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

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add ArtifactName and RunCount semantic types for constants Add ArtifactName, RunCount, Minutes semantic types for untyped constants Feb 23, 2026
@pelikhan pelikhan marked this pull request as ready for review February 23, 2026 12:03
Copilot AI review requested due to automatic review settings February 23, 2026 12:03
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces three new semantic types for previously untyped constants in pkg/constants, improving type safety and code clarity by encoding units and purpose directly in the type system.

Changes:

  • Added ArtifactName, RunCount, and Minutes semantic types following the existing pattern with String() and IsValid() methods
  • Applied ArtifactName type to SafeOutputArtifactName and AgentOutputArtifactName constants
  • Applied RunCount and Minutes types to rate limit configuration constants
  • Updated all usage sites across workflow and CLI packages with explicit type conversions

Reviewed changes

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

Show a summary per file
File Description
pkg/constants/constants.go Defines three new semantic types (ArtifactName, RunCount, Minutes) with associated methods and applies them to four constants
pkg/constants/constants_test.go Updates test assertions to use explicit string() conversions for typed artifact name constants
pkg/workflow/threat_detection.go Converts AgentOutputArtifactName usage to string for ArtifactDownloadConfig
pkg/workflow/safe_jobs.go Converts AgentOutputArtifactName usage to string for ArtifactDownloadConfig
pkg/workflow/role_checks.go Converts rate limit config values to RunCount and Minutes types
pkg/workflow/agentic_output_test.go Converts SafeOutputArtifactName usage to string in test assertions
pkg/cli/logs_parsing_core.go Converts AgentOutputArtifactName usage to string for strings.EqualFold comparison
pkg/cli/logs_orchestrator.go Converts AgentOutputArtifactName usage to string for filepath.Join operations
pkg/cli/logs_metrics.go Converts AgentOutputArtifactName usage to string for file path operations (4 locations)
pkg/cli/logs_noop_test.go Converts AgentOutputArtifactName usage to string for filepath.Join
pkg/cli/logs_missing_tool_test.go Converts AgentOutputArtifactName usage to string for filepath.Join
pkg/cli/logs_missing_tool_integration_test.go Converts AgentOutputArtifactName usage to string for filepath.Join (2 locations)

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

Comment on lines +714 to +756
// RunCount represents a count of workflow runs.
// This semantic type encodes the unit (runs) directly in the type name,
// distinguishing run counts from arbitrary integers.
//
// Example usage:
//
// const DefaultRateLimitMax RunCount = 5
// func SetRateLimit(max RunCount, window Minutes) { ... }
type RunCount int

// String returns the string representation of the run count
func (r RunCount) String() string {
return fmt.Sprintf("%d", r)
}

// IsValid returns true if the run count is positive
func (r RunCount) IsValid() bool {
return r > 0
}

// Minutes represents a duration in minutes.
// This semantic type encodes the unit (minutes) directly in the type name,
// preventing confusion with other integer durations (e.g., seconds, hours).
//
// Example usage:
//
// const DefaultRateLimitWindow Minutes = 60
// func SetTimeWindow(window Minutes) { ... }
type Minutes int

// String returns the string representation of the minutes value
func (m Minutes) String() string {
return fmt.Sprintf("%d", m)
}

// IsValid returns true if the minutes value is positive
func (m Minutes) IsValid() bool {
return m > 0
}

// Rate limit defaults
const DefaultRateLimitMax = 5 // Default maximum runs per time window
const DefaultRateLimitWindow = 60 // Default time window in minutes (1 hour)
const DefaultRateLimitMax RunCount = 5 // Default maximum runs per time window
const DefaultRateLimitWindow Minutes = 60 // Default time window in minutes (1 hour)
Copy link

Copilot AI Feb 23, 2026

Choose a reason for hiding this comment

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

Missing test coverage for the new semantic types (ArtifactName, RunCount, and Minutes). The existing TestHelperMethods function in this file tests the String() and IsValid() methods for all other semantic types (see lines 530-685), but the newly added types are not included. Consider adding test cases for:

  • ArtifactName.String() and ArtifactName.IsValid()
  • RunCount.String() and RunCount.IsValid()
  • Minutes.String() and Minutes.IsValid()

This would ensure consistency with the testing pattern established for other semantic types in the codebase.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan closed this Feb 23, 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.

[plan] Add ArtifactName, RunCount, Minutes semantic types for untyped constants

3 participants