Skip to content

Adopt charmbracelet/x/exp/golden in pkg/workflow/wasm_golden_test.go#24120

Merged
pelikhan merged 2 commits intomainfrom
copilot/adopt-charmbracelet-golden
Apr 2, 2026
Merged

Adopt charmbracelet/x/exp/golden in pkg/workflow/wasm_golden_test.go#24120
pelikhan merged 2 commits intomainfrom
copilot/adopt-charmbracelet-golden

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

pkg/workflow/wasm_golden_test.go re-implemented golden file logic manually (custom -update flag, os.ReadFile/WriteFile, require.Equal) instead of using the charmbracelet/x/exp/golden library already present in the module and used by pkg/console/golden_test.go.

Changes

  • wasm_golden_test.go: Remove updateGolden flag var, isUpdateMode(), and all manual file I/O. Replace with golden.RequireEqual(t, normalizeHeredocDelimiters(yamlOutput)). Restructure TestWasmGolden_CompileFixtures so each subtest owns its os.Chdir(absFixturesDir) with a t.Cleanup that always restores to origDir; switches back to origDir before calling RequireEqual so the library resolves testdata/ against the package root.

  • testdata/: Rename golden files from testdata/wasm_golden/TestWasmGolden_CompileFixtures/*.goldentestdata/TestWasmGolden_CompileFixtures/*.golden to match the path the library hardcodes (testdata/<tb.Name()>.golden).

  • scripts/test-wasm-golden.mjs: Update loadGoldenFile() to read from the new path.

// Before
goldenPath := filepath.Join(goldenDir, "TestWasmGolden_CompileFixtures", testName+".golden")
if isUpdateMode() {
    require.NoError(t, os.MkdirAll(filepath.Dir(goldenPath), 0o755))
    require.NoError(t, os.WriteFile(goldenPath, []byte(normalizeHeredocDelimiters(yamlOutput)), 0o644))
    return
}
expected, err := os.ReadFile(goldenPath)
require.NoError(t, err, "golden file not found for %s (run with -update to create)", fixture)
require.Equal(t, string(expected), normalizeHeredocDelimiters(yamlOutput), "output differs from golden for %s", fixture)

// After
require.NoError(t, os.Chdir(origDir))
golden.RequireEqual(t, normalizeHeredocDelimiters(yamlOutput))

Warning

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

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

  • https://api.github.com/graphql
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw GO111MODULE 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linu4 /usr/bin/git _.a GO111MODULE e6dad4495bb0035c--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh /usr/bin/gh api graphql -f query=query($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabled } } -f owner=github -f name=gh-aw ache/go/1.25.0/xrev-parse /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel /opt/hostedtoolcrev-parse /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 w/js/**/*.json&#39; git git 0/x64/bin/node git (http block)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name jaHf/GmHT9aLTei5GOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 4231443/b396/impGOPROXY /hom�� che/go-build/9d/GOSUMDB **/*.cjs 64/bin/go **/*.json --ignore-path ../../../.pretti-test.paniconexit0 /opt/hostedtoolc-test.v=true (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 /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/agentic-observability-kit.md JbrieQ94-F8q /usr/bin/git ub/workflows GO111MODULE 64/bin/go git rev-�� --git-dir go /usr/bin/infocmp -json GO111MODULE 64/bin/go infocmp (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 go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel 64/pkg/tool/linurev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq .object.sha npx prettier --write &#39;**/*.cjs&#39; &#39;**/*.ts&#39; &#39;**/*.json&#39; --ignore-path ../../../.pr**/*.json git /opt/hostedtoolcache/go/1.25.0/x64/bin/sh --show-toplevel git e/git sh -c &#34;prettier&#34; --write &#39;scripts/**/*.js&#39; --ignore-path .prettierignore --log-level=error e/git /home/REDACTED/work/gh-aw/gh-aw/node_modules/.bin/node tierignore git /home/REDACTED/go/--show-toplevel node (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 -bool -buildtags ache/node/24.14.0/x64/bin/node -errorsas -ifaceassert -nilfunc git t-30�� sistency_InlinedImports2004293748/001/inlined-a.md -tests /usr/bin/git F78z/PFo0L_hUTsKgit GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha x_amd64/vet /opt/hostedtoolcache/node/24.14.0/x64/bin/node /usr/bin/git env.NODE_VERSIONgit x_amd64/vet /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq .object.sha .js&#39; --ignore-path .prettierignore --log-level=e!../../../pkg/workflow/js/**/*.json git git elete git 985ce8c11130c57b--show-toplevel node js/f�� *.json&#39; &#39;!../../../pkg/workflow/js/**/*.json&#39; --ignore-path ../../../.prettierignore git k/gh-aw/gh-aw/actions/node_modules/.bin/sh aude-with-networgit x_amd64/vet /usr/bin/git node (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v5
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha 540096441 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet 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 --show-toplevel x_amd64/compile /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE ache/go/1.25.0/x--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq .object.sha --show-toplevel ache/go/1.25.0/xowner=github /usr/bin/git 819829/b001/workgit GO111MODULE ache/go/1.25.0/x--show-toplevel git rev-�� --show-toplevel ache/go/1.25.0/x64/pkg/tool/linu4 /usr/bin/git 976587/b416/_pkggit GO111MODULE 976587/b416=&gt; git (http block)
  • https://api.github.com/repos/actions/checkout/git/ref/tags/v6
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha /tmp/file-tracker-test1850928985/test1.md /tmp/file-tracker-test1850928985/test2.lock.yml /usr/bin/git -json GO111MODULE 64/bin/go git rese�� HEAD .github/workflows/test.md /usr/bin/git Gitbranch_with_hgit Gitbranch_with_hrev-parse x_amd64/link git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha ets.TOKEN }} -goversion /usr/bin/git -c=4 -nolocalimports -importcfg git chec�� .github/workflows/test.md /home/REDACTED/work/gh-aw/gh-aw/pkg/stringutil/identifiers.go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v6 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE sh git rev-�� --show-toplevel go /usr/bin/git -json GO111MODULE /opt/hostedtoolc--show-toplevel git (http block)
  • https://api.github.com/repos/actions/github-script/git/ref/tags/v8
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha &#34;prettier&#34; --cheGOSUMDB GOPROXY 64/bin/go GOSUMDB GOWORK run-script/lib/n-unreachable=false git for-�� --format %(refname) 64/bin/go -d 68089f3a80773f0fpack-objects 64/bin/go go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq .object.sha k/gh-aw/gh-aw/cm-errorsas GOPROXY 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolc-trimpath -o /tmp/go-build201-p -trimpath 64/bin/go -p github.com/githu-c -lang=go1.25 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 /tmp/TestHashStability_SameInputSameOutput2056520278/001/stability-test.md go /usr/bin/git -json GO111MODULE 64/bin/go git rev-�� --git-dir go /usr/bin/git -json GO111MODULE 64/bin/go git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/infocmp --show-toplevel go /usr/bin/git infocmp -1 xterm-color git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq .object.sha a91676929d833ed7985ce8c11130c57bec104d79:pkg/workflow/testdata/TestWasmGolden_CoOUTPUT git on rkflow/js/**/*.jgit gh erignore /tmp/go-build654996188/b001/workflow.test -tes�� -test.paniconexit0 -test.timeout=10m0s /home/REDACTED/work/node_modules/.bin/node -test.run=^TestWgit git /usr/bin/git node (http block)
  • https://api.github.com/repos/actions/setup-node/git/ref/tags/v4
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel x6b4H2b/XHd5WzsLgit-upload-pack &#39;/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitmaster_branchrev-parse /usr/bin/git -json GO111MODULE 76aa559d4a524592--show-toplevel git chec�� .github/workflows/test.md go /usr/bin/git -json GO111MODULE x_amd64/vet git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq .object.sha a91676929d833ed7985ce8c11130c57bec104d79:pkg/workflow/testdata/TestWasmGolden_Co--log-target git on rkflow/js/**/*.jgit git erignore /opt/hostedtoolcache/go/1.25.0/x64/pkg/tool/linux_amd64/link -o /tmp/go-build654996188/b001/workflow.test -importcfg /home/REDACTED/work/gh-aw/gh-aw/node_modules/.bin/node -s -w -buildmode=exe node (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v0.1.2
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha uts.branch -trimpath /usr/bin/git -p main -lang=go1.25 git rev-�� --git-dir -dwarf=false /usr/bin/git go1.25.0 -c=4 -nolocalimports git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel x_amd64/link /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel Fj/loOf-cgjR6MKzrev-parse /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v0.1.2 --jq .object.sha a91676929d833ed7985ce8c11130c57bec104d79:pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smgit git on rkflow/js/**/*.jgit git erignore bash --no�� --noprofile git /home/REDACTED/.config/composer/vendor/bin/sh ./../.prettieriggit git /usr/bin/git sh (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 licyMinIntegrityOnlymin-integrity_with_explicit_repo3582343577/001 GO111MODULE 0/x64/bin/node GOINSECURE GOMOD GOMODCACHE bash t-ha�� ithub/workflows/audit-workflows.md GOPROXY ache/go/1.25.0/x64/pkg/tool/linux_amd64/link GOSUMDB GOWORK 64/bin/go ache/go/1.25.0/x64/pkg/tool/linux_amd64/link (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git add tags/v5 git er: String!, $name: String!) { repository(owner: $owner, name: $name) { hasDiscussionsEnabl--show-toplevel --show-toplevel x_amd64/link /usr/bin/gh git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/git git _out�� */*.ts&#39; &#39;**/*.json&#39; --ignore-path ../../../.pret.prettierignore git tions/setup/js/node_modules/.bin/node --show-toplevel git /usr/bin/git node (http block)
  • https://api.github.com/repos/github/gh-aw-actions/git/ref/tags/v1.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha 5425-29548/test-1498830234 GO111MODULE /home/REDACTED/go/bin/bash l GOMOD GOMODCACHE rtcfg --no�� g/timeutil/format.go g/timeutil/format_test.go 0/x64/bin/node GOSUMDB GOWORK 64/bin/go 0/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel git /usr/lib/git-core/git --git-dir go /usr/bin/git /usr/lib/git-core/git main�� run --auto /usr/bin/git --detach remote.origin.urrev-parse /usr/bin/gh git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw-actions/git/ref/tags/v1.2.3 --jq .object.sha --show-toplevel git ache/node/24.14.0/x64/bin/node --show-toplevel git /usr/bin/git git _out�� */*.ts&#39; &#39;**/*.json&#39; --ignore-path ../../../.pret.prettierignore git p/bin/git --show-toplevel git /usr/bin/git node (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 3436196132/.github/workflows GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link (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 ache/go/1.25.0/x64/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 run download 12346 --dir test-logs/run-12346 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)
  • https://api.github.com/repos/github/gh-aw/actions/runs/2/artifacts
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env 3436196132/.github/workflows GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuremote.origin.url (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 3436196132/.github/workflows GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (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 1aef3b4bd5c2106476aa559d4a524592-importcfg GOINSECURE GOMOD GOMODCACHE go env 3436196132/.github/workflows GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (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 64/bin/go GOINSECURE GOMOD GOMODCACHE 0XVD7GS/mRL0tEU7JbrieQ94-F8q env 3436196132/.github/workflows GO111MODULE flow.test GOINSECURE GOMOD GOMODCACHE flow.test (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path sf5r/yo0oC3fLIFhGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 4231443/b421/impGOPROXY /hom�� k/gh-aw/gh-aw/pkGOSUMDB k/gh-aw/gh-aw/pkGOWORK 64/bin/go **/*.json --ignore-path run-script/lib/n-test.paniconexit0 /opt/hostedtoolc-test.v=true (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 GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v0.47.4
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq .object.sha --show-toplevel go /usr/bin/git LsRemoteWithRealgit LsRemoteWithRealrev-parse n-dir/bash git rev-�� --show-toplevel go /usr/bin/git edOutput13687530git GO111MODULE x_amd64/vet git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq .object.sha --show-toplevel git /usr/bin/git --show-toplevel go /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel bash /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v0.47.4 --jq .object.sha --show-toplevel git /usr/bin/git ignore-path ../.git git /usr/bin/git git rev-�� --show-toplevel git /usr/bin/git --show-toplevel git modules/@npmcli/--verify 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 LsRemoteWithReal@{u} LsRemoteWithRealGitcustom_branch2511410409/001&#39; 0/x64/bin/bash GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha --show-toplevel go /usr/bin/git -json GO111MODULE /usr/bin/bash git rev-�� --show-toplevel bash /usr/bin/git --noprofile GOPROXY /usr/bin/git git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq .object.sha ignore-path ../../../.prettierignore 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.2.3
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.2.3 --jq .object.sha scripts/**/*.js --ignore-path 64/bin/go tierignore **/*.cjs 64/bin/go x6b4H2b/XHd5WzsLgit-upload-pack &#39;/tmp/TestParseDefaultBranchFromLsRemoteWithRealGitmaster_branch1223347861/001&#39; env -json GO111MODULE 76aa559d4a5245921363d342b44f42f4-d 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 --check scripts/**/*.js 64/bin/go -d **/*.cjs 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha -json GOCACHE 64/bin/go prettier --write 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq .object.sha --porcelain node 64/bin/go prettier --write 64/bin/go 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 --check scripts/**/*.js 64/bin/go -d **/*.cjs 64/bin/go go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (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 ache/go/1.25.0/x64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha --show-toplevel x_amd64/link /usr/bin/git ry=1 GO111MODULE 976587/b414/_pkg--show-toplevel git rev-�� --show-toplevel IK/oWORqHYA_07qvx6b4H2b/XHd5WzsL-n0Go8Jy6g3d /usr/bin/git GOPATH GOPROXY 1aef3b4bd5c21064--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq .object.sha ignore-path ../../../.prettierignore 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/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 n-dir/bash 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 4231443/b424/impGOPROXY /hom�� che/go-build/f9/GOSUMDB **/*.cjs 64/bin/go **/*.json --ignore-path ../../../.pretti--show-toplevel /opt/hostedtoolcache/go/1.25.0/xGO111MODULE (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo 64/bin/go GOINSECURE GOMOD GOMODCACHE 4231443/b426/impGOPROXY /hom�� che/go-build/b1/GOSUMDB **/*.cjs 64/bin/go **/*.json --ignore-path ../../../.prettierignore /opt/hostedtoolcache/go/1.25.0/xGO111MODULE (http block)
  • https://api.github.com/repos/owner/repo/contents/file.md
    • Triggering command: /tmp/go-build973976587/b396/cli.test /tmp/go-build973976587/b396/cli.test -test.testlogfile=/tmp/go-build973976587/b396/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE b/gh-aw/pkg/strienv GOMODCACHE go env lLeS/stntV3bhefVGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 4231443/b419/impGOPROXY (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 lsU_/9WSWBOFEFsOGOINSECURE GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE 4231443/b415/impGOPROXY -c k/gh-aw/gh-aw/pkGOSUMDB k/gh-aw/gh-aw/pkGOWORK 64/bin/go GOSUMDB GOWORK 64/bin/go /opt/hostedtoolc-trimpath (http block)

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

- Remove custom -update flag (updateGolden) and isUpdateMode() helper
- Remove manual os.MkdirAll/WriteFile/ReadFile golden logic
- Import charmbracelet/x/exp/golden and use golden.RequireEqual
- Restructure test so each subtest manages its own Chdir and cleanup
  always restores to origDir (package root)
- Move golden files from testdata/wasm_golden/TestWasmGolden_CompileFixtures/
  to testdata/TestWasmGolden_CompileFixtures/ (library path convention)
- Update scripts/test-wasm-golden.mjs to read from the new golden path

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/93a5450f-4738-4b8c-abcd-0edcc36f9a91

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Adopt charmbracelet/x/exp/golden in pkg/workflow/wasm_golden_test.go Adopt charmbracelet/x/exp/golden in pkg/workflow/wasm_golden_test.go Apr 2, 2026
Copilot AI requested a review from pelikhan April 2, 2026 14:01
@pelikhan pelikhan marked this pull request as ready for review April 2, 2026 14:02
Copilot AI review requested due to automatic review settings April 2, 2026 14: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

This pull request migrates pkg/workflow/wasm_golden_test.go to use github.com/charmbracelet/x/exp/golden for golden-file assertions, aligning it with existing golden-test patterns in the repo and simplifying update/compare logic.

Changes:

  • Replaced custom -update flag + manual golden file I/O with golden.RequireEqual in TestWasmGolden_CompileFixtures, and adjusted working-directory handling per subtest.
  • Moved workflow golden outputs into pkg/workflow/testdata/TestWasmGolden_CompileFixtures/ to match the golden library’s file naming/path convention.
  • Updated the Node wasm golden test runner to read golden files from the new location.

Reviewed changes

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

Show a summary per file
File Description
scripts/test-wasm-golden.mjs Reads Go-generated golden files from the new pkg/workflow/testdata/TestWasmGolden_CompileFixtures location.
pkg/workflow/wasm_golden_test.go Uses golden.RequireEqual for fixture compilation output and isolates os.Chdir usage within subtests.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/with-imports.golden New/relocated golden output for the with-imports fixture under golden’s expected path.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-test-tools.golden New/relocated golden output for the smoke-test-tools fixture under golden’s expected path.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/smoke-copilot.golden New/relocated golden output for the smoke-copilot fixture under golden’s expected path.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/claude-with-network.golden New/relocated golden output for the claude-with-network fixture under golden’s expected path.
pkg/workflow/testdata/TestWasmGolden_CompileFixtures/basic-copilot.golden New/relocated golden output for the basic-copilot fixture under golden’s expected path.
Comments suppressed due to low confidence (1)

pkg/workflow/wasm_golden_test.go:25

  • pkg/workflow/testdata/wasm_golden/README.md still documents the golden outputs as living under testdata/wasm_golden/TestWasmGolden_CompileFixtures/, but this test now relies on charmbracelet/x/exp/golden which resolves to testdata/TestWasmGolden_CompileFixtures/<subtest>.golden. Please update the README to match the new golden file location so contributors don’t regenerate/commit files to the wrong directory.
// TestWasmGolden_CompileFixtures compiles each workflow fixture using the string API
// (the same code path used by the wasm compiler) and compares against golden files.
//
// To update golden files:
//
//	go test -v ./pkg/workflow -run='^TestWasmGolden_' -update
//
// Or use the Makefile target:
//
//	make update-wasm-golden

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

Comment on lines 145 to 150
// Golden files follow the charmbracelet/x/exp/golden convention:
// testdata/TestName/subtest_name.golden
// pkg/workflow/testdata/TestWasmGolden_CompileFixtures/<name>.golden
const goldenPath = join(
GOLDEN_DIR,
"TestWasmGolden_CompileFixtures",
ROOT,
"pkg/workflow/testdata/TestWasmGolden_CompileFixtures",
testName + ".golden"
Copy link

Copilot AI Apr 2, 2026

Choose a reason for hiding this comment

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

The comment says these files follow the charmbracelet/x/exp/golden convention, but the convention is testdata/<tb.Name()>.golden relative to the package root; this script is intentionally hardcoding the repo-relative path (pkg/workflow/testdata/...). Consider rewording the comment to avoid implying this is the library’s general convention.

Copilot uses AI. Check for mistakes.
@pelikhan pelikhan merged commit 31c6e39 into main Apr 2, 2026
179 checks passed
@pelikhan pelikhan deleted the copilot/adopt-charmbracelet-golden branch April 2, 2026 14:11
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] Adopt charmbracelet/x/exp/golden in pkg/workflow/wasm_golden_test.go

3 participants