Repository navigation
Fix Aider Go test stub package declarations - #72164
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
|
||
| ```bash | ||
| go list -f '{{if and (not .TestGoFiles) (not .XTestGoFiles)}}{{.Dir}} {{.Name}}{{end}}' ./... > /tmp/gh-aw/agent/aider-untested-packages && sed '/^$/d' /tmp/gh-aw/agent/aider-untested-packages | head -5 | ||
| go list -f '{{if and (not .TestGoFiles) (not .XTestGoFiles)}}{{.Dir}} {{.Name}}{{end}}' ./... > /tmp/gh-aw/agent/aider-untested-packages && count=0 && while IFS= read -r row; do if [ -n "$row" ]; then directory="${row% *}"; package="${row##* }"; (set -C; printf 'package %s\n\nimport "testing"\n\nfunc TestPlaceholder_TODO(t *testing.T) {\n\tt.Skip("not yet implemented")\n}\n' "$package" > "$directory/${package}_test.go") || exit 1; printf '%s %s\n' "$directory" "$package"; count=$((count + 1)); if [ "$count" -eq 3 ]; then break; fi; fi; done < /tmp/gh-aw/agent/aider-untested-packages |
There was a problem hiding this comment.
Added canonical path resolution and a workspace containment check before writing each stub; paths resolving outside the workspace are rejected. Fixed in e3c8f29.
Regenerate the Aider workflow lock from merged sources, preserving the deterministic stub fix and incoming runner updates. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Include the model-routing update that landed during validation of the preceding base merge. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused fix preserves existing safeguards and adds regression coverage, with no unresolved blocking issues.
No open issues 🎉
What changed in this PR
Fixes Aider’s Go test-stub workflow by using go list package metadata instead of model-authored package declarations.
Changes:
- Generates skipped-test stubs directly, preserving the three-package limit and overwrite protection.
- Adds regression coverage for package names, spaced paths, compilation, write limits, collisions, and discovery failures.
- Refreshes workflow hash bindings without changing permissions or runtime configuration.
| File | Description |
|---|---|
pkg/workflow/aider_discovery_test.go |
Tests generated stubs and generation safeguards. |
.github/workflows/daily-go-test-stubs-aider.md |
Replaces model-authored stubs with deterministic generation. |
.github/workflows/daily-go-test-stubs-aider.lock.yml |
Updates body and admission hashes for the revised workflow. |
Review effort: Max
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: e5327b6
|
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: e3c8f29
|
…bassoon # Conflicts: # .github/workflows/daily-go-test-stubs-aider.lock.yml Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot address the following outstanding work in one pass:
Push the necessary fixes, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved. Use the pr-finisher skill and stop when only human review or CI remains; do not trigger CI. Sous-chef head: 0555e9f
|
…bassoon # Conflicts: # .github/workflows/daily-go-test-stubs-aider.lock.yml Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
There was a problem hiding this comment.
💥 [THE END] — Illustrated by Smoke Claude · claude · sonnet46 · ~81 AIC · ⌖ ~7 AIC · ⊞ 926
Comment /smoke-claude to run again
|
|
||
| func TestAiderDiscoveryUsesGoPackagesAndActualNames(t *testing.T) { | ||
| dir := t.TempDir() | ||
| dir := filepath.Join(t.TempDir(), "workspace with spaces") |
There was a problem hiding this comment.
Good improvement! Using filepath.Join(t.TempDir(), "workspace with spaces") ensures the test covers paths with spaces, which is important for cross-platform compatibility. Consider also adding a test case with Unicode characters in the path for broader coverage.
| for name, content := range map[string]string{ | ||
| "go.mod": "module example.test/aider\n\ngo 1.20\n", | ||
| "cmd/hyphenated/main.go": "package main\n", | ||
| "cmd/hyphenated/main.go": "package main\nfunc main() {}\n", |
There was a problem hiding this comment.
Nice fix! Adding func main() {} to the package stub makes it a valid Go package with a main function, which correctly satisfies the go toolchain requirements for a main package. This prevents false positives in the aider discovery process.
|
|
||
| ```bash | ||
| go list -f '{{if and (not .TestGoFiles) (not .XTestGoFiles)}}{{.Dir}} {{.Name}}{{end}}' ./... > /tmp/gh-aw/agent/aider-untested-packages && sed '/^$/d' /tmp/gh-aw/agent/aider-untested-packages | head -5 | ||
| workspace="$(pwd -P)" && go list -f '{{if and (not .TestGoFiles) (not .XTestGoFiles)}}{{.Dir}} {{.Name}}{{end}}' ./... > /tmp/gh-aw/agent/aider-untested-packages && count=0 && while IFS= read -r row; do if [ -n "$row" ]; then directory="${row% *}"; package="${row##* }"; resolved="$(realpath -- "$directory")" || exit 1; case "$resolved" in "$workspace"|"$workspace"/*) ;; *) printf 'Refusing to write outside workspace: %s\n' "$resolved" >&2; exit 1 ;; esac; (set -C; printf 'package %s\n\nimport "testing"\n\nfunc TestPlaceholder_TODO(t *testing.T) {\n\tt.Skip("not yet implemented")\n}\n' "$package" > "$resolved/${package}_test.go") || exit 1; printf '%s %s\n' "$resolved" "$package"; count=$((count + 1)); if [ "$count" -eq 3 ]; then break; fi; fi; done < /tmp/gh-aw/agent/aider-untested-packages |
|
🎉 This pull request is included in a new release. Release: |

Why
Run 40360891821 failed because Aider derived test package declarations from directory names instead of using Go's reported package names. It generated invalid or conflicting packages in command directories, so formatting failed before tests or PR submission.
Changes
go listpackage metadata instead of asking the model to author package declarations.Validation
make fmtgo test ./pkg/workflow -run 'TestAider(Discovery|StubGeneration|DailyGoValidationContracts|DebtDiscovery)' -count=1make recompilemake agent-report-progressNormal compilation succeeded with existing warnings. Dry-run compilation was interrupted during model-inventory collection and emitted no diagnostic lock. No workflows were dispatched or rerun; the separate OTLP authorization problem is outside this fix.
✨ PR Review Safe Output Test - Run 40425303201