Review every new snapshot with an agent from the other vendor

This commit is contained in:
Ian Gulliver
2026-10-15 16:33:17 -07:00
parent a539ddab43
commit e9039cceb4
39 changed files with 1737 additions and 218 deletions
+38
View File
@@ -0,0 +1,38 @@
package agents
import (
"testing"
"g.fc.run/misc/byre/internal/api"
)
func TestReviewVendor(t *testing.T) {
if got := reviewVendor(api.Claude); got != api.Codex {
t.Fatalf("reviewer for a claude task: %s", got)
}
if got := reviewVendor(api.Codex); got != api.Claude {
t.Fatalf("reviewer for a codex task: %s", got)
}
}
func TestReviewLine(t *testing.T) {
result := map[string]any{
"summary": "Mostly fine.",
"findings": []any{
map[string]any{"severity": "high", "title": "Nil map write", "detail": "Panics on first use.", "path": "a.go", "line": float64(12)},
map[string]any{"severity": "low", "title": "Typo", "detail": "Spelling."},
},
}
got := reviewLine(api.Review{SnapshotN: 3, State: api.ReviewStateDone, Result: &result})
want := "review of snapshot 3: Mostly fine.\n" +
" - [high] Nil map write (a.go:12): Panics on first use.\n" +
" - [low] Typo: Spelling."
if got != want {
t.Fatalf("reviewLine:\n%s\nwant:\n%s", got, want)
}
failed := reviewLine(api.Review{SnapshotN: 4, State: api.ReviewStateFailed, Error: "boom"})
if failed != "review of snapshot 4 failed: boom" {
t.Fatalf("failed reviewLine %q", failed)
}
}