fix(workflow): order findings before footer; test the report stash
Self-review of #784: (1) the tc.ReviewReport = report stash was untested, so a regression dropping it would silently omit the findings section; (2) the section rendered after the workflow footer, reading as content-after-signature. Move the findings before the footer and pin the StageReview->implementPRBody integration with a test.
This commit is contained in:
1 parent
36c7b9d3c6
commit
8a5d8814d2
2 files changed
+23
-4
No files matched your search
@@ -202,10 +202,10 @@ func Implement() Workflow {
|
||||
// not full price. When the adversarial review ran, its findings section is
|
||||
// appended so the PR states what the reviewer checked and found (h019.6).
|
||||
func implementPRBody(tc *TaskContext) string {
|
||||
body := fmt.Sprintf("%s\n\n---\n*workflow: implement · %d iterations · %s*",
|
||||
tc.BuildSummary, tc.Task.Iterations, formatTokenUsage(tc.Task.TokensUsed, tc.RunUsage))
|
||||
summary := tc.BuildSummary
|
||||
if section := renderPRReviewSection(tc.ReviewReport); section != "" {
|
||||
body += "\n\n" + section
|
||||
summary += "\n\n" + section
|
||||
}
|
||||
return body
|
||||
return fmt.Sprintf("%s\n\n---\n*workflow: implement · %d iterations · %s*",
|
||||
summary, tc.Task.Iterations, formatTokenUsage(tc.Task.TokensUsed, tc.RunUsage))
|
||||
}
|
||||
@@ -85,3 +85,22 @@ func TestImplementPRBodyCarriesZeroFindingSection(t *testing.T) {
|
||||
t.Fatalf("PR body lost the build summary:\n%s", body)
|
||||
}
|
||||
}
|
||||
|
||||
// TestStageReviewStashesReportForPRBody pins the integration between
|
||||
// StageReview and implementPRBody: a passing review must land on
|
||||
// tc.ReviewReport, or the PR body silently omits the findings section
|
||||
// (renderPRReviewSection returns "" for a zero-value report).
|
||||
func TestStageReviewStashesReportForPRBody(t *testing.T) {
|
||||
tc, _ := reviewTaskContext(t, true)
|
||||
tc.Reviewer = &fakeReviewer{report: NewCompletedReviewReport(nil, "clean")}
|
||||
|
||||
if err := StageReview().Run(t.Context(), tc); err != nil {
|
||||
t.Fatalf("StageReview().Run() error = %v", err)
|
||||
}
|
||||
if !tc.ReviewReport.Ran() {
|
||||
t.Fatal("ReviewReport not stashed after a passing review; the PR body would omit the findings section")
|
||||
}
|
||||
if tc.ReviewReport.Status != ReviewStatusCompleted {
|
||||
t.Errorf("ReviewReport.Status = %q, want %q", tc.ReviewReport.Status, ReviewStatusCompleted)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user