Skip to content

Improve pkg/agentdrain/miner_test.go coverage for utility and error-path behavior#27199

Merged
pelikhan merged 3 commits intomainfrom
copilot/testify-expert-improve-test-quality-again
Apr 19, 2026
Merged

Improve pkg/agentdrain/miner_test.go coverage for utility and error-path behavior#27199
pelikhan merged 3 commits intomainfrom
copilot/testify-expert-improve-test-quality-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 19, 2026

This updates pkg/agentdrain/miner_test.go to improve test quality and maintainability by expanding edge-case coverage and tightening assertions around utility functions and error paths.

  • FlattenEvent coverage + maintainability

    • Refactored TestFlattenEvent into a table-driven test with required scenarios:
      • empty stage
      • all fields excluded
      • normal event with exclusion + deterministic ordering checks
      • empty event
    • Removed the custom indexIn helper and used strings.Index directly.
  • Tokenize edge cases

    • Added TestTokenize covering:
      • empty string
      • extra/mixed whitespace
      • single token
      • key=value tokens
  • Explicit error-path tests

    • Added TestTrainEmptyLine to exercise the empty line after masking path in Miner.Train.
    • Added TestNewMaskerInvalidPattern to exercise invalid regex compilation failure in NewMasker.
  • Assertion quality

    • Added/updated assertion messages to make failures actionable and specific.

Example of the new table-driven structure:

tests := []struct {
    name     string
    evt      AgentEvent
    exclude  []string
    expected string
}{
    {name: "empty stage omits stage token", evt: AgentEvent{Fields: map[string]string{"z":"last","a":"first"}}, expected: "a=first z=last"},
    {name: "all fields excluded keeps only stage", evt: AgentEvent{Stage: "plan", Fields: map[string]string{"action":"start","step":"1"}}, exclude: []string{"action","step"}, expected: "stage=plan"},
}

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 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env rtcfg GO111MODULE cfg GOINSECURE fips140deps/gode/tmp/js-hash-test-3559688515/test-hash.js GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh repo view owner/repo env -RlDlG6ki GO111MODULE 64/pkg/tool/linux_amd64/link GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/link rtcf�� til.test om/santhosh-tekuri/jsonschema/v6@v6.0.2/kind/kind.go rtcfg.link GOINSECURE fips140only GOMODCACHE QBat1TqtOugs5kA4^remote\..*\.gh-resolved$ (http block)
    • Triggering command: /usr/bin/gh gh repo view owner/repo env 1916465762 Ak5qHtlUh 64/pkg/tool/linux_amd64/vet GOINSECURE 306054/b029/ GOMODCACHE 64/pkg/tool/linux_amd64/vet env rtcfg GO111MODULE cfg GOINSECURE b/gh-aw/pkg/consrun 306054/b029/symadownload ache/go/1.25.8/x12345 (http block)
  • https://api.github.com/orgs/test-owner/actions/secrets
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /orgs/test-owner/actions/secrets --jq .secrets[].name --verify --quiet p/bin/git --verify --quiet bin/git node /pre�� e1fc80f47c4a8feba6e20c7f..HEAD git it * --stdout k/gh-aw/gh-aw/no-bool 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, .object.type] | @tsv --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts /usr/bin/infocmp .artifacts[].namgit QuPWq4ACQ 64/pkg/tool/linu--show-toplevel infocmp -1 xterm-color 64/pkg/tool/linux_amd64/vet /usr/bin/git 4015572490 GO111MODULE ache/go/1.25.8/x--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/ai-inference/git/ref/tags/v1 --jq [.object.sha, .object.type] | @tsv xterm-color tions/setup/js/node_modules/vitest/dist/workers/forks.js /usr/bin/git files..." ser:token@githubrev-parse de_modules/.bin/--show-toplevel git rev-�� --show-toplevel git /usr/bin/gh 5/001/inlined-b.git pIPmBhItI2R4 ache/node/24.14.--show-toplevel 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 mpleWorkflow756224934/001 go /usr/bin/git -json GO111MODULE x_amd64/compile git remo�� add origin ache/node/24.14.1/x64/bin/node -json GO111MODULE x_amd64/compile ache/node/24.14.1/x64/bin/node (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v3 --jq [.object.sha, .object.type] | @tsv /tmp/TestGuardPolicyBlockedUsersCommaSeparatedCompiledOutput557179113/001 s/test.md /usr/bin/gh e1fc80f47c4a8febgit ode_modules/viterev-parse ode_modules/.bin--show-toplevel gh run list --json /opt/hostedtoolcache/node/24.14.1/x64/bin/node --workflow nonexistent-workrev-parse --limit /opt/hostedtoolcache/node/24.14.1/x64/bin/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, .object.type] | @tsv util.test V7o_/18xeupG6XnJInX8DV7o_ rtcfg.link GOINSECURE t/internal/tag GOMODCACHE Q9JjIZREDlYiHWP_71/KDaUrle63TPPPS1tZJmA/IR2ra6tzuVsL8NFDM1C9 -p g9lJ/QNSRYMftluhiCGQRg9lJ -trimpath 1/x64/bin/node -I /tmp/go-build452rev-parse -I ache/go/1.25.8/x64/pkg/tool/linutest@example.com (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel 64/pkg/tool/linuorigin /usr/bin/git 1/001/test-emptygit om/modelcontextprev-parse cfg git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile /usr/bin/git ons/secrets oYmy/n_pwg_VDfKQrev-parse ache/go/1.25.8/x--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/checkout/git/ref/tags/v5 --jq [.object.sha, .object.type] | @tsv --show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git -bool -buildtags 1/x64/bin/node git rev-�� --show-toplevel /bin/sh /usr/bin/git ithub/workflows/git git-upload-pack rev-parse /usr/bin/git 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, .object.type] | @tsv --show-toplevel ache/go/1.25.8/x^remote\..*\.gh-resolved$ /usr/bin/git 1/001/inlined-a.git GO111MODULE ache/go/1.25.8/xHEAD git rev-�� --show-toplevel ache/go/1.25.8/x64/pkg/tool/linux_amd64/vet /usr/bin/git ry=1 k/gh-aw/gh-aw/pkrev-parse e/git-upload-pac--show-toplevel git (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v8 --jq [.object.sha, .object.type] | @tsv --show-toplevel k/gh-aw/gh-aw/actions/setup/js/nfeature-branch /usr/bin/git /tmp/http-mcp-tegit --port .cfg git rev-�� --show-toplevel erignore /usr/bin/git ExpressionCompilgit -trimpath ache/go/1.25.8/x--show-toplevel git (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 -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv xec.js (or misc/-errorsas GO111MODULE x_amd64/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/github-script/git/ref/tags/v9 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 /home/REDACTED/work/gh-aw/gh-aw/.github/workflows/ace-editor.md x_amd64/compile /usr/bin/git -json GO111MODULE 64/pkg/tool/linu--show-toplevel git rev-�� --git-dir 64/pkg/tool/linutest@example.com /bin/sh _.a GO111MODULE 64/pkg/tool/linu--show-toplevel /bin/sh (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-go/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv user.email test@example.com /usr/bin/git ./../pkg/workflogit 74449c86465297barev-parse nfig/composer/ve--show-toplevel git rev-�� --show-toplevel node /usr/bin/git ch-that-does-notgit git n-dir/sh 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, .object.type] | @tsv --git-dir x_amd64/vet /usr/bin/git _.a rotocol/go-sdk@vrev-parse 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/compile /usr/lib/git-core/git-remote-https _.a KmEF_rn9z 64/pkg/tool/linu--show-toplevel /usr/lib/git-core/git-remote-https (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/setup-node/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv 86_64/git tions/setup/js/node_modules/vite../../../**/*.json /usr/bin/git ./../pkg/workflogit 74449c86465297barev-parse x_amd64/vet git rev-�� --show-toplevel x_amd64/vet /usr/bin/git ch-that-does-notgit git ache/node/24.14.--show-toplevel git (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 ithub/workflows/agent-persona-explorer.md -tests e/git m0s go (http block)
    • Triggering command: /usr/bin/gh gh api /repos/actions/upload-artifact/git/ref/tags/v4 --jq [.object.sha, .object.type] | @tsv k/gh-aw/gh-aw/.github/workflows/archie.md git /usr/bin/gh ignore-path ../.git st/suppress-warn-C 1/x64/bin/node gh work�� list --json /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet --repo owner/repo tions/setup/node--show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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 --git-dir x_amd64/vet /usr/bin/git _.a GO111MODULE 64/pkg/tool/linu--show-toplevel git rev-�� --show-toplevel 64/pkg/tool/linux_amd64/compile /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet _.a GO111MODULE 64/pkg/tool/linu--show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/vet (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 tions/setup/node--get tions/setup/js/nremote.origin.url /usr/bin/git 01 74449c86465297barev-parse x_amd64/vet git init�� /usr/sbin/git x_amd64/vet (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 bility_SameInputSameOutput815203837/001/stability-test.md go /usr/bin/git -json GO111MODULE 64/bin/go git conf�� --get s/test.md /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/link -json GO111MODULE x_amd64/compile /opt/hostedtoolcache/go/1.25.8/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, .object.type] | @tsv /tmp/gh-aw-add-gitattributes-test3607322893 show /opt/hostedtoolcache/node/24.14.1/x64/bin/node HEAD st/suppress-warnrev-parse 1/x64/bin/node node /tmp�� /tmp/TestHashConsistency_WithImports391547459/001/main.md st/dist/workers/**/*.cjs /usr/bin/git ath ../../../.prdocker tions/setup/js/npull cal/bin/git git (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 687656/b455/timeutil.test -trimpath ache/go/1.25.8/x64/pkg/tool/linux_amd64/link -p github.com/githurev-parse -lang=go1.25 ache/go/1.25.8/x64/pkg/tool/linux_amd64/link conf�� 687656/b467/scripts.test Test User 687656/b467/importcfg.link -c=4 -nolocalimports -importcfg 7D8RXanEmFBss/sX9FX53sm1OTZ6jdpoJ_/CWrYu2czG7Ca7ylQP4Z8/vCNYLdc7D8RXanEmFBss (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 /tmp/gh-aw-add-gitattributes-test3607322893/.github/workflows config /opt/hostedtoolcache/node/24.14.1/x64/bin/node remote.origin.urgit st/suppress-warnrev-parse 1/x64/bin/node node /tmp�� /tmp/TestHashConsistency_WithImports391547459/001/main.md st/dist/workers/**/*.cjs /usr/bin/git ath ../../../.prgit tions/setup/js/nrev-parse ndor/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/1/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/1/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet rtcf�� 612197001 om/segmentio/encoding@v0.5.4/iso-test.run=^Test 64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 1 --dir test-logs/run-1 uKJh7UXOD 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linuTest User env rtcfg GO111MODULE cfg GOINSECURE 306054/b047/ GOMODCACHE ache/go/1.25.8/x64/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 /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vite--ignore-path bin/sh node --conditions development go run te 'scripts/**/*.js' --ignore-path .prettierignore --log-level=error st/dist/workers/forks.js k/node_modules/.bin/node 49ddf2908707440agit origin 1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node (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 fG0BeREzZ 64/pkg/tool/linu-test.short=true GOINSECURE r GOMODCACHE 64/pkg/tool/linux_amd64/vet env 3A5uknFb7 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 306054/b012/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 12345 --dir test-logs/run-12345 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet rtcf�� 1916465762 _wTXDDAYc ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE /exithook GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-buildtags (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12345/artifacts --jq .artifacts[].name tions/setup/js/node_modules/vitest/dist/workers/forks.js 1/x64/bin/node nore gin/full-mode-brrev-parse /opt/hostedtoolc--show-toplevel /opt/hostedtoolcache/node/24.14.1/x64/bin/node t-ha�� SameOutput2551326923/001/stability-test.md git .cfg README.md st/suppress-warnrev-parse ode_modules/.bin--show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linuremote (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 QuPWq4ACQ 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env 4015572490 GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 306054/b015/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 12346 --dir test-logs/run-12346 YfB4YDUdE 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu/tmp/go-build313687656/b114/vet.cfg env 1916465762 Ak5qHtlUh 64/pkg/tool/linux_amd64/vet GOINSECURE 306054/b029/ GOMODCACHE 64/pkg/tool/linux_amd64/vet (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/12346/artifacts --jq .artifacts[].name git h nore gin/full-mode-brrev-parse k/gh-aw/gh-aw/ac--show-toplevel /opt/hostedtoolcache/node/24.14.1/x64/bin/node /tmp�� te '**/*.cjs' '**/*.ts' '**/*.json' --ignore-path ../../../.prettierignore git ache/uv/0.11.7/x86_64/node README.md st/suppress-warnrev-parse _modules/.bin/gi--show-toplevel /opt/hostedtoolcache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (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 rtcfg 64/pkg/tool/linux_amd64/vet GOINSECURE flow GOMODCACHE 64/pkg/tool/linux_amd64/vet rtcf�� 612197001 om/segmentio/asm@v1.1.3/cpu/x86/x86.go x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 2 --dir test-logs/run-2 GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE h_wasm.o 64/src/math/big/--show-toplevel 64/pkg/tool/linux_amd64/vet env 588415702/.github/workflows GO111MODULE cfg GOINSECURE b/gh-aw/pkg/tty GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/2/artifacts --jq .artifacts[].name ode_modules/vite/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/n--ignore-path ache/go/1.25.8/x64/bin/sh user.email st/suppress-warnrev-parse 1/x64/lib/node_m--show-toplevel go run 5757-61574/test-1164519761/.github/workflows st/dist/workers/forks.js e_modules/.bin/node 49ddf2908707440a/usr/bin/git origin 1/x64/bin/node /opt/hostedtoolc^remote\..*\.gh-resolved$ (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/3/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linu-lang=go1.25 GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linu-dwarf=false rtcf�� 612197001 go ache/go/1.25.8/x-nolocalimports GOINSECURE 306054/b036/ GOMODCACHE ache/go/1.25.8/x/tmp/go-build313687656/b467/_testmain.go (http block)
    • Triggering command: /usr/bin/gh gh run download 3 --dir test-logs/run-3 cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env 588415702/.github/workflows GO111MODULE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linuconfig (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/3/artifacts --jq .artifacts[].name ode_modules/vite/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/n--ignore-path /home/REDACTED/work/node_modules/.bin/go user.email test@test.com 86_64/node go run 5757-61574/test-1164519761/.github/workflows git 1/x64/bin/node 49ddf2908707440agit origin ode_modules/.bin--show-toplevel /opt/hostedtoolcache/node/24.14.1/x64/bin/node (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/4/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE er GOMODCACHE 64/pkg/tool/linux_amd64/vet rtcf�� 612197001 om/segmentio/asm@v1.1.3/cpu/arm6-ifaceassert ache/go/1.25.8/x64/pkg/tool/linu-nilfunc GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-buildtags (http block)
    • Triggering command: /usr/bin/gh gh run download 4 --dir test-logs/run-4 vohS5K4mu 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env rtcfg GO111MODULE cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/asm (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/4/artifacts --jq .artifacts[].name ode_modules/vite/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/n--ignore-path 1/x64/bin/node user.email st/suppress-warnrev-parse n-dir/node go hash�� Imports1338756625/001/noflag-a.md st/dist/workers/forks.js es/.bin/node 49ddf2908707440agit origin modules/@npmcli/--show-toplevel /opt/hostedtoolcache/node/24.14.1/x64/bin/node (http block)
  • https://api.github.com/repos/github/gh-aw/actions/runs/5/artifacts
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name GO111MODULE 64/pkg/tool/linux_amd64/vet GOINSECURE B3eGt0Jx4HszV7Wirev-parse GOMODCACHE 64/pkg/tool/linux_amd64/vet rtcf�� 612197001 om/segmentio/asm@v1.1.3/keyset/k-test.run=^Test ache/go/1.25.8/x64/pkg/tool/linu-test.short=true GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run download 5 --dir test-logs/run-5 cfg 64/pkg/tool/linux_amd64/vet GOINSECURE GOMOD GOMODCACHE 64/pkg/tool/linutest@example.com rtcf�� boring/sig om/goccy/go-yaml@v1.19.2/parser/color.go ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 306054/b087/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api --paginate repos/{owner}/{repo}/actions/runs/5/artifacts --jq .artifacts[].name ode_modules/vite/home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/n--ignore-path (http block)
  • https://api.github.com/repos/github/gh-aw/actions/workflows
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path 261853208/001' 261853208/001' -importcfg /tmp/go-build313687656/b418/importcfg -pack /home/REDACTED/work/gh-aw/gh-aw/pkg/fileutil/fileutil.go /home/REDACTED/work/gh-aw/gh-aw/pkg/fileutil/tar.go env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 100 GOMOD GOMODCACHE x_amd64/compile env -json o x_amd64/compile GOINSECURE GOMOD cpu/cpu.s x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh run list --json databaseId,number,url,status,conclusion,workflowName,createdAt,startedAt,updatedAt,event,headBranch,headSha,displayTitle --workflow nonexistent-workflow-12345 --limit 6 GOMOD GOMODCACHE 64/pkg/tool/linux_amd64/vet env l.go l_test.go 64/pkg/tool/linux_amd64/compile GOINSECURE %H %ct %D (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github%2Fworkflows%2Faudit-workflows.md
    • Triggering command: /opt/hostedtoolcache/node/24.14.1/x64/bin/node /opt/hostedtoolcache/node/24.14.1/x64/bin/node --experimental-import-meta-resolve --require /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/suppress-warnings.cjs --conditions node --conditions development /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vitest/dist/workers/forks.js -- t git show�� --verify --quiet k/gh-aw/gh-aw/actions/setup/js/ndevelopment --local --get de_modules/.bin/-e git (http block)
  • https://api.github.com/repos/github/gh-aw/contents/.github/workflows/shared/reporting.md
    • Triggering command: /tmp/go-build313687656/b403/cli.test /tmp/go-build313687656/b403/cli.test -test.testlogfile=/tmp/go-build313687656/b403/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true GOINSECURE GOMOD GOMODCACHE go env -json GO111MODULE 64/bin/go GOINSECURE GOMOD GOMODCACHE go (http block)
    • Triggering command: /tmp/go-build3877063547/b403/cli.test /tmp/go-build3877063547/b403/cli.test -test.testlogfile=/tmp/go-build3877063547/b403/testlog.txt -test.paniconexit0 -test.v=true -test.parallel=4 -test.timeout=10m0s -test.run=^Test -test.short=true -u origin k/_temp/uv-pytho"prettier" --write '**/*.cjs' '**/*.ts' '**/*.json' --ignore-path ../../../.pret.prettierignore st/dist/workers/forks.js tion�� --verify l es/.bin/go --verify --quiet k/gh-aw/gh-aw/acnpx prettier --write '../../../**/*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path ../../../.prettierignore 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 --show-toplevel ache/go/1.25.8/x64/pkg/tool/linuTest User /usr/bin/git A8JyAGqbm HJpH/bR5uMPu5Fr3rev-parse ache/go/1.25.8/x--show-toplevel git rev-�� --show-toplevel rtcfg /usr/bin/git OnlyCompiledOutpls aFt_/WeZ-gWqCt5Y-lh ache/go/1.25.8/x/tmp/gh-aw/aw-feature-branch.patch 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 --show-toplevel 64/pkg/tool/linu--jq /usr/bin/git nonexistent-brangit git 1/x64/bin/node /usr/bin/git remo�� -v /opt/hostedtoolcache/node/24.14.rev-parse /usr/bin/git SameOutput255132ls /home/REDACTED/wor-lh .cfg git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v1.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v1.0.0 --jq [.object.sha, .object.type] | @tsv rtcfg GO111MODULE cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env 306054/b179/_pkg_.a TJ4J/EoB_P8I8HxwDW6KATJ4J cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x12345 (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 report.md /home/REDACTED/work/gh-aw/gh-aw/actions/setup/js/node_modules/vite--conditions 1/x64/bin/node node --conditions development git 1/x6�� st-WaDd2P/test-config.json git de_modules/.bin/sh origin/shallow-fgit git es/.bin/node 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, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json 1.5.0/oauthex/au-nolocalimports x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (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 js/**/*.json' ---errorsas ode_modules/vite-ifaceassert 86_64/git * git tions/setup/js/nxterm-color ode_modules/vite-tests 5746�� HEAD .com/repo.git.url ules/.bin/go user.email test@test.com ndor/bin/git git (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v2.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json arm.go x_amd64/compile GOINSECURE GOMOD GOMODCACHE pIPmBhItI2R4 env -json 1.5.0/mcp/client--delta-base-offset x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile �� Action pins sinfocmp GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v2.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE x_amd64/vet GOINSECURE GOMOD r_wasm.s x_amd64/vet (http block)
  • https://api.github.com/repos/github/gh-aw/git/ref/tags/v3.0.0
    • Triggering command: /usr/bin/gh gh api /repos/github/gh-aw/git/ref/tags/v3.0.0 --jq [.object.sha, .object.type] | @tsv -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile env -json GO111MODULE 64/bin/go GOINSECURE GOMOD abi/abi_test.s go (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 js/**/*.json' --ignore-path ../../../.prettierignore ode_modules/vitest/suppress-warnings.cjs /home/REDACTED/.dotnet/tools/git * Initial commit run-script/lib/n/tmp/TestHashStability_SameInputSameOutput2551326923/001/stability-test.md ode_modules/vitest/dist/workers/forks.js rev-�� Gitmain_branch3535746043/001' Gitmain_branch3535746043/001' ules/.bin/sh user.email test@test.com tions/setup/js/n--show-toplevel /bin/sh (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 2592954000/001 GO111MODULE cfg GOINSECURE 306054/b006/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile env 306054/b180/_pkg_.a GO111MODULE cfg GOINSECURE fips140/ecdsa ache/go/1.25.8/x--remote=REDACTED ache/go/1.25.8/xv1.0.0 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/nonexistent/action/git/ref/tags/v999.999.999 --jq [.object.sha, .object.type] | @tsv ch-that-does-not-exist git 1/x64/lib/node_modules/npm/node_-q set-url =main k/gh-aw/gh-aw/ac/tmp/gh-aw-test-runs/20260419-145757-61574/test-2870863960 ache/node/24.14.rev-parse mpor�� 6923/001/stabili@{u} k/gh-aw/gh-aw/actions/setup/js/node_modules/vite--log-level=error k/gh-aw/gh-aw/actions/node_modules/.bin/go origin/shallow-fgit git 1/x64/bin/node k/gh-aw/gh-aw/actest@example.com (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 64/pkg/tool/linux_amd64/vet env 2592954000/001 GO111MODULE cfg GOINSECURE b/gh-aw/pkg/slicrev-parse GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linu-trimpath (http block)
    • Triggering command: /usr/bin/gh gh run view 12345 --repo nonexistent/repo --json status,conclusion 49ddf2908707440agit origin ode_modules/.bin--show-toplevel /opt/hostedtoolcache/node/24.14.1/x64/bin/node -has�� ithub/workflows/agent-persona-explorer.md on e/git /../../.prettiergit erignore development e/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 go env -json GO111MODULE x_amd64/compile GOINSECURE GOMOD GOMODCACHE x_amd64/compile (http block)
    • Triggering command: /usr/bin/gh gh workflow list --repo owner/repo --json name,path,state ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile GOINSECURE 306054/b012/ GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linux_amd64/compile rtcf�� 306054/b108/_pkg_.a rg/x/text@v0.36.0/internal/number/common.go cfg GOINSECURE 306054/b012/equaapi ache/go/1.25.8/x--paginate ache/go/1.25.8/xrepos/{owner}/{repo}/actions/runs/12346/artifacts (http block)
    • Triggering command: /usr/bin/gh gh workflow list --json name,state,path --repo owner/repo es/.bin/go --verify --quiet k/gh-aw/gh-aw/acnpx prettier --write '../../../**/*.json' '!../../../pkg/workflow/js/**/*.json' --ignore-path ../../../.prettierignore node /pre�� ndor/bin/git git es/.bin/git ow-fetch-fail ings.cjs /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 go1.25.8 -c=4 -nolocalimports -importcfg /tmp/go-build313687656/b409/importcfg -pack /tmp/go-build313687656/b409/_testmain.go env xec.js (or misc/-errorsas GO111MODULE x_amd64/asm GOINSECURE GOMOD GOMODCACHE x_amd64/asm (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test-owner/test-repo/actions/secrets --jq .secrets[].name dd files" --quiet modules/@npmcli/run-script/lib/node-gyp-bin/node ental-MOc1EA refs/remotes/ori-c git node /pre�� e1fc80f47c4a8feba6e20c7f..HEAD git tions/node_modules/.bin/git * --stdout e/git git (http block)
  • https://api.github.com/repos/test/repo
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch 588415702/.github/workflows GO111MODULE cfg GOINSECURE b/gh-aw/pkg/tty GOMODCACHE ache/go/1.25.8/x64/pkg/tool/linurev-parse ranc�� 306054/b132/_pkg_.a GO111MODULE cfg GOINSECURE GOMOD GOMODCACHE ache/go/1.25.8/x3 (http block)
    • Triggering command: /usr/bin/gh gh api /repos/test/repo --jq .default_branch run --auto e/git --detach st/suppress-warnrev-parse de_modules/.bin/--show-toplevel e/git -C /tmp/TestGuardPolicyMinIntegrityOnlymin-integrity_with_repos=public_3890748426/001 config /opt/hostedtoolcache/node/24.14.1/x64/bin/node remote.origin.urgit ode_modules/viterev-parse x_amd64/link node (http block)
  • invalid.example.invalid
    • Triggering command: /usr/lib/git-core/git-remote-https /usr/lib/git-core/git-remote-https origin https://invalid.example.invalid/nonexistent-repo.git git conf�� --local --get ode_modules/.bin/git cal/bin/git git /git git add . git tions/setup/node_modules/.bin/git -M main bin/git git (dns block)

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

Copilot AI and others added 2 commits April 19, 2026 14:58
Copilot AI changed the title [WIP] Improve test quality in pkg/agentdrain/miner_test.go Improve pkg/agentdrain/miner_test.go coverage for utility and error-path behavior Apr 19, 2026
Copilot AI requested a review from pelikhan April 19, 2026 15:04
@pelikhan pelikhan marked this pull request as ready for review April 19, 2026 15:05
Copilot AI review requested due to automatic review settings April 19, 2026 15:05
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

Improves unit test coverage and assertion clarity for pkg/agentdrain utilities and error paths, focusing on deterministic behavior and edge cases.

Changes:

  • Refactors TestFlattenEvent into a table-driven suite covering empty stage/event and exclusion scenarios, with deterministic ordering checks.
  • Adds new tests for Tokenize whitespace/token edge cases.
  • Adds explicit error-path tests for Miner.Train on empty/whitespace-only input and for NewMasker invalid regex compilation.
Show a summary per file
File Description
pkg/agentdrain/miner_test.go Expands and restructures tests to cover additional edge cases and error paths for event flattening, tokenization, training, and masker initialization.

Copilot's findings

Tip

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

  • Files reviewed: 1/1 changed files
  • Comments generated: 1

Comment on lines +209 to +222
got := FlattenEvent(tt.evt, tt.exclude)
assert.Equal(t, tt.expected, got, "FlattenEvent output mismatch for case %q", tt.name)
if tt.excludedField != "" {
assert.NotContains(t, got, tt.excludedField, "excluded field should not appear in flattened output")
}
if tt.checkStagePrefix {
assert.True(t, strings.HasPrefix(got, "stage="+tt.evt.Stage), "stage should appear first in flattened output: %q", got)
}
if tt.checkSortedOrder {
latencyIndex := strings.Index(got, "latency_ms=")
queryIndex := strings.Index(got, "query=")
toolIndex := strings.Index(got, "tool=")
assert.True(t, latencyIndex < queryIndex && queryIndex < toolIndex, "keys should be sorted alphabetically in flattened output: %q", got)
}
Copy link

Copilot AI Apr 19, 2026

Choose a reason for hiding this comment

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

In TestFlattenEvent, assert.Equal is used for the primary correctness check, but the test then continues to run additional assertions (excluded field, stage prefix, sorted order). If the equality check fails, the follow-on assertions can produce extra noise or misleading failures. Consider switching the equality to require.Equal (or guarding subsequent checks with if assert.Equal(...) { ... }) so ordering/prefix assertions only run when the baseline output matches expectations; also consider asserting strings.Index results are >= 0 before comparing ordering to make failures clearer if tokens are missing.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

🧪 Test Quality Sentinel Report

Test Quality Score: 100/100

Excellent test quality

Metric Value
New/modified tests analyzed 4
✅ Design tests (behavioral contracts) 4 (100%)
⚠️ Implementation tests (low value) 0 (0%)
Tests with error/edge cases 4 (100%)
Duplicate test clusters 0
Test inflation detected N/A (test-only PR — no production lines changed)
🚨 Coding-guideline violations 0

Test Classification Details

View All Test Classifications (4 tests)
Test File Classification Notes
TestFlattenEvent pkg/agentdrain/miner_test.go ✅ Design Refactored to table-driven; 4 cases including empty stage, all-fields-excluded, and empty event edge cases
TestTokenize pkg/agentdrain/miner_test.go ✅ Design 4 cases including empty string, whitespace-only, single token, and multi-token inputs
TestTrainEmptyLine pkg/agentdrain/miner_test.go ✅ Design Directly tests error path for whitespace-only input; verifies nil result + error message content
TestNewMaskerInvalidPattern pkg/agentdrain/miner_test.go ✅ Design Tests error path for invalid regex; verifies nil masker + error message identifies the failing rule

No Flagged Tests

All new and modified tests passed quality checks.


Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 4 tests — unit (//go:build !integration ✅ present)
  • 🟨 JavaScript: 0 tests changed

Verdict

Check passed. 0% of new tests are implementation tests (threshold: 30%). All 4 tests verify observable behavioral contracts, cover error paths and edge cases, and include descriptive assertion messages throughout. The removal of the indexIn helper in favour of strings.Index is a clean simplification.


📖 Understanding Test Classifications

Design Tests (High Value) verify what the system does:

  • Assert on observable outputs, return values, or state changes
  • Cover error paths and boundary conditions
  • Would catch a behavioral regression if deleted
  • Remain valid even after internal refactoring

Implementation Tests (Low Value) verify how the system does it:

  • Assert on internal function calls (mocking internals)
  • Only test the happy path with typical inputs
  • Break during legitimate refactoring even when behavior is correct
  • Give false assurance: they pass even when the system is wrong

Goal: Shift toward tests that describe the system's behavioral contract — the promises it makes to its users and collaborators.

References: §24632111290

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

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: 100/100. Test quality is excellent — 0% of new tests are implementation tests (threshold: 30%). All 4 new/modified tests verify behavioral contracts, cover error paths and edge cases, include descriptive assertion messages, and the required //go:build !integration build tag is present.

@pelikhan pelikhan merged commit 129490d into main Apr 19, 2026
114 checks passed
@pelikhan pelikhan deleted the copilot/testify-expert-improve-test-quality-again branch April 19, 2026 15:11
@github-actions
Copy link
Copy Markdown
Contributor


Warning

The push_to_pull_request_branch operation failed: Branch copilot/testify-expert-improve-test-quality-again no longer exists on origin (it may have been deleted), can't push to it.. The code changes were not applied.

🏗️ Design Decision Gate — ADR Required

This PR makes significant changes to core business logic directories (pkg/) with 129 new lines of code, but does not have a linked Architecture Decision Record (ADR).

AI has analyzed the PR diff and generated a draft ADR to help you get started:

📄 Draft ADR: docs/adr/27199-table-driven-tests-with-error-path-coverage-for-agentdrain.md

The draft captures the key testing strategy decisions embedded in this PR:

  • Adopting table-driven tests for multi-scenario functions in pkg/agentdrain
  • Preferring stdlib (strings.Index) over bespoke package-local helpers
  • Requiring explicit test cases for all documented error paths

What to do next

  1. Review the draft ADR committed to your branch — it was generated from the PR diff
  2. Complete any missing sections — add context the AI couldn't infer, refine the decision rationale, and verify the alternatives reflect what was genuinely considered
  3. Reference the ADR in this PR body by adding a line such as:

    ADR: ADR-27199: Adopt Table-Driven Tests with Explicit Error-Path Coverage for agentdrain

Once an ADR is linked in the PR body, this gate will re-run and verify the implementation matches the decision.

Why ADRs Matter

"AI made me procrastinate on key design decisions. Because refactoring was cheap, I could always say 'I'll deal with this later.' Deferring decisions corroded my ability to think clearly."

ADRs create a searchable, permanent record of why the codebase looks the way it does. Future contributors (and your future self) will thank you.


📋 Michael Nygard ADR Format Reference

An ADR must contain these four sections to be considered complete:

  • Context — What is the problem? What forces are at play?
  • Decision — What did you decide? Why?
  • Alternatives Considered — What else could have been done?
  • Consequences — What are the trade-offs (positive and negative)?

All ADRs are stored in docs/adr/ as Markdown files numbered by PR number (e.g., 27199-table-driven-tests-with-error-path-coverage-for-agentdrain.md for PR #27199).

🔒 This PR cannot merge until an ADR is linked in the PR body.

References: §24632111294

Note

🔒 Integrity filter blocked 1 item

The following item were blocked because they don't meet the GitHub integrity level.

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

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

🏗️ ADR gate enforced by Design Decision Gate 🏗️ · ● 180.2K ·

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.

[testify-expert] Improve Test Quality: pkg/agentdrain/miner_test.go

3 participants