fix. harden Go review flow
Fix runner bootstrap and auth handling, preserve queued SHAs, make event/job acceptance atomic, fence stale runs, correct retries and prompts, add fake end-to-end coverage, and fix deployment defaults. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,24 @@ func TestResultValidationAndFormatting(t *testing.T) {
|
||||
t.Fatalf("missing formatted details: %s", body)
|
||||
}
|
||||
}
|
||||
func TestBuildPromptUsesGenericIntentForBareReview(t *testing.T) {
|
||||
prompt := BuildPrompt(domain.ParsedCommand{Name: "review", Raw: "@codex review", Mode: "summary"}, domain.DefaultRepoReviewConfig(), domain.PullRequestContext{BaseSHA: "base", HeadSHA: "head"})
|
||||
if contains(prompt, "review: review\n") || !contains(prompt, "review: review this pull request and report introduced issues.") {
|
||||
t.Fatalf("unexpected bare-review prompt: %s", prompt)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarkdownCommentIncludesStructuredSummaryAndSuggestion(t *testing.T) {
|
||||
suggestion := "Use a checked conversion."
|
||||
result := domain.ReviewResult{Verdict: "has_issues", Confidence: .8, Summary: "Summary", MarkdownComment: "Primary markdown", Findings: []domain.Finding{{Severity: "medium", File: "x.go", LineStart: 2, LineEnd: 2, Title: "Issue", Body: "Details", Suggestion: &suggestion}}}
|
||||
body := FormatResultComment("head", result, true)
|
||||
for _, part := range []string{"Structured Findings", "Verdict: `has_issues`", "Summary", "Use a checked conversion."} {
|
||||
if !contains(body, part) {
|
||||
t.Fatalf("formatted comment missing %q: %s", part, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func contains(s, needle string) bool {
|
||||
for i := 0; i+len(needle) <= len(s); i++ {
|
||||
if s[i:i+len(needle)] == needle {
|
||||
|
||||
Reference in New Issue
Block a user