From 0493f9103e1a740878305023131795c66e69d950 Mon Sep 17 00:00:00 2001 From: nfebe Date: Tue, 6 Oct 2026 10:04:32 +0100 Subject: [PATCH] feat(review): Preserve revisions and execution results --- internal/core/client.go | 2 + internal/core/client_test.go | 6 +- internal/core/testdata/review-execution.json | 105 +++++++++++++++++++ 3 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 internal/core/testdata/review-execution.json diff --git a/internal/core/client.go b/internal/core/client.go index 5ac2c36..a6ac704 100644 --- a/internal/core/client.go +++ b/internal/core/client.go @@ -559,6 +559,7 @@ type Read struct { Summary Summary `json:"summary"` Suggestions []Suggestion `json:"suggestions"` Notes map[string]string `json:"notes"` + Execution json.RawMessage `json:"execution,omitempty"` } // Commit is one commit the branch has that the branch it left does not. @@ -592,6 +593,7 @@ type Review struct { type Ask struct { Repository string `json:"repository"` Against string `json:"against"` + Head string `json:"head,omitempty"` Title string `json:"title"` Description string `json:"description"` Skills []string `json:"skills"` diff --git a/internal/core/client_test.go b/internal/core/client_test.go index a5b1aa3..7efb629 100644 --- a/internal/core/client_test.go +++ b/internal/core/client_test.go @@ -211,6 +211,7 @@ func TestHealthyIsFalseWhenTheCoreIsNotThere(t *testing.T) { // field nobody named is dropped without a word: the commits a branch is ahead // by went missing that way, and the page that drew them looked simply empty. func TestNothingTheCoreSaysAboutAReviewIsDroppedInTransit(t *testing.T) { + execution := fixture(t, "review-execution.json") client := serving(t, map[string]func(http.ResponseWriter, *http.Request){ "/api/local/reviews/abc": func(w http.ResponseWriter, r *http.Request) { w.Write([]byte(`{"data":{ @@ -222,7 +223,7 @@ func TestNothingTheCoreSaysAboutAReviewIsDroppedInTransit(t *testing.T) { "review":{"verdict":"COMMENT","suggestions":[ {"path":"a.py","start_line":2,"comment":"c","category":"BUG", "existing_code":"was","suggested_code":"is"} - ]} + ],"execution":` + string(execution) + `} } }}`)) }, @@ -244,6 +245,9 @@ func TestNothingTheCoreSaysAboutAReviewIsDroppedInTransit(t *testing.T) { } suggestions := read.Review.Read.Suggestions + if !strings.Contains(string(read.Review.Read.Execution), "review-0") { + t.Fatal("review execution details were dropped") + } if len(suggestions) != 1 { t.Fatalf("got %d suggestions, want 1", len(suggestions)) } diff --git a/internal/core/testdata/review-execution.json b/internal/core/testdata/review-execution.json new file mode 100644 index 0000000..df67e26 --- /dev/null +++ b/internal/core/testdata/review-execution.json @@ -0,0 +1,105 @@ +{ + "reviews": [ + { + "participant": "review-0", + "repetition": 1, + "error": "" + }, + { + "participant": "review-0", + "repetition": 2, + "error": "" + }, + { + "participant": "review-0", + "repetition": 3, + "error": "" + } + ], + "evaluations": [ + { + "participant": "deterministic", + "repetition": 1, + "error": "", + "judgments": [] + }, + { + "participant": "evaluation-0", + "repetition": 1, + "error": "", + "judgments": [ + { + "candidate": 0, + "status": "supported", + "reason": "The migration changes an existing applied operation.", + "evidence": [ + "db/0001_charges.py: return 1" + ] + } + ] + }, + { + "participant": "evaluation-0", + "repetition": 2, + "error": "", + "judgments": [ + { + "candidate": 0, + "status": "supported", + "reason": "The migration changes an existing applied operation.", + "evidence": [ + "db/0001_charges.py: return 1" + ] + } + ] + } + ], + "analysis_coverage": [ + { + "tool": "semgrep", + "paths": [], + "unsupported": [], + "unavailable": [ + "db/0001_charges.py" + ], + "languages": [], + "checks": [ + "static-analysis" + ], + "skipped": [] + } + ], + "analysis_findings": [], + "file_languages": { + "db/0001_charges.py": "python" + }, + "unchecked": [ + "db/0001_charges.py" + ], + "producers": [ + [ + "review-0:1", + "review-0:2", + "review-0:3" + ] + ], + "candidates": [ + { + "file_name": "db/0001_charges.py", + "position": 3, + "start_line": 2, + "end_line": 2, + "side": "RIGHT", + "comment": "Add a new migration instead.", + "category": "BUG", + "trigger": null, + "blast": null, + "impact": null, + "certainty": null, + "comment_only": false, + "suggested_code": " pass\n", + "existing_code": " return 1\n", + "claims": [] + } + ] +}