From 2c3543f220d8dbc0eb360e7493613636234b90ee Mon Sep 17 00:00:00 2001 From: PG1204 Date: Sun, 12 Apr 2026 15:44:51 -0700 Subject: [PATCH 1/3] testing threat --- .../java/com/example/blast_radius/model/PrAnalysisRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java b/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java index 7aa0e76..9c8130f 100644 --- a/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java +++ b/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java @@ -14,7 +14,7 @@ public void setBaseBranch(String baseBranch) { } public String getTargetBranch() { - return targetBranch; + return baseBranch; } public void setTargetBranch(String targetBranch) { From 96ec4593204090141f7066b0277dc0c1c4bc6779 Mon Sep 17 00:00:00 2001 From: PG1204 Date: Sun, 12 Apr 2026 15:50:15 -0700 Subject: [PATCH 2/3] fix: updated system prompt --- .../blast_radius/service/AnalysisService.java | 82 +++++++++++-------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/src/main/java/com/example/blast_radius/service/AnalysisService.java b/src/main/java/com/example/blast_radius/service/AnalysisService.java index 0006f59..e4afe00 100644 --- a/src/main/java/com/example/blast_radius/service/AnalysisService.java +++ b/src/main/java/com/example/blast_radius/service/AnalysisService.java @@ -88,42 +88,52 @@ private String prepareDiff(String diff, String analysisId) { private String buildPrompt(String diff) { return """ - You are a senior backend engineer reviewing a Git diff in a Java Spring Boot service. - Your task is to assess RISK and propose TESTS. - - CONTEXT: - - Tech stack: Java 17, Spring Boot, REST controllers, service layer, JPA repositories. - - The diff may touch enums, DTOs, controllers, services, or validation logic. - - OUTPUT FORMAT (VERY IMPORTANT): - 1. Output ONLY a single JSON object — no markdown, no code fences, no explanation. - 2. The JSON must have EXACTLY these fields: - { - "overallRisk": "LOW" | "MEDIUM" | "HIGH", - "impactAreas": [""], - "suggestedTests": [""] - } - 3. Be SPECIFIC and SPRING-BOOT AWARE: - - In impactAreas, mention concrete Spring components: - - @RestController methods (e.g., "OrderController#createOrder"). - - @Service methods (e.g., "OrderService#updateStatus"). - - JPA entities/enums (e.g., "Order entity", "OrderStatus enum"). - - Repository methods (e.g., "OrderRepository#findByStatus"). - - In suggestedTests, tie tests to those components: - - "Add unit test for OrderService#updateStatus covering NEW→SHIPPED and RETURNED flows." - - "Add @WebMvcTest for GET /orders/{id} to verify JSON serialization of all OrderStatus values." - - "Add persistence test ensuring OrderStatus enum values are stored and read correctly." - 4. Semantics: - - LOW: Minor or localized change, unlikely to break core flows. - - MEDIUM: Affects important flows but with limited blast radius. - - HIGH: Affects critical flows (payments, auth, persistence) or many modules. - 5. When the change is more than a trivial refactor, aim for: - - AT LEAST 2 impactAreas. - - AT LEAST 3 suggestedTests, mixing unit and Spring tests where relevant. - - Now analyze the following Git diff and return ONLY the JSON object: - - DIFF: + You are a senior backend engineer reviewing a Git diff in a Java Spring Boot service. + Your task is to assess RISK and propose TESTS. + + CONTEXT: + - Tech stack: Java 17, Spring Boot, REST controllers, service layer, JPA repositories. + - The diff may touch enums, DTOs, controllers, services, or validation logic. + + OUTPUT FORMAT (VERY IMPORTANT): + 1. Output ONLY a single JSON object — no markdown, no code fences, no explanation. + 2. The JSON must have EXACTLY these fields: + { + "overallRisk": "LOW" | "MEDIUM" | "HIGH", + "impactAreas": [""], + "suggestedTests": [""] + } + + 3. Be SPECIFIC and SPRING-BOOT AWARE: + - In impactAreas, mention concrete Spring components that appear in the diff: + - @RestController methods (e.g., "OrderController#createOrder"). + - @Service methods (e.g., "OrderService#updateStatus"). + - JPA entities/enums (e.g., "Order entity", "OrderStatus enum"). + - Repository methods (e.g., "OrderRepository#findByStatus"). + - For DTOs or simple POJOs, name the class and method (e.g., "PrAnalysisRequest#getTargetBranch"). + - In suggestedTests, tie tests to those components: + - "Add unit test for OrderService#updateStatus covering NEW→SHIPPED and RETURNED flows." + - "Add @WebMvcTest for GET /orders/{id} to verify JSON serialization of all OrderStatus values." + - "Add persistence test ensuring OrderStatus enum values are stored and read correctly." + + 4. Source of truth — ONLY use the diff: + - Base your reasoning strictly on the classes, methods, and fields visible in the diff. + - Do NOT invent new services, methods, or endpoints that are not mentioned in the diff. + - If you need to refer to behavior that is not named explicitly, describe it generically + (e.g., "logic that compares baseBranch and targetBranch") instead of fabricating API names. + + 5. Risk semantics: + - LOW: Minor or localized change, unlikely to break core flows. + - MEDIUM: Affects important flows but with limited blast radius. + - HIGH: Affects critical flows (payments, auth, persistence) or many modules. + + 6. When the change is more than a trivial refactor, aim for: + - AT LEAST 2 impactAreas. + - AT LEAST 3 suggestedTests, mixing unit and Spring tests where relevant. + + Now analyze the following Git diff and return ONLY the JSON object: + + DIFF: """ + diff; } From c5743b64597bb9fed785c6d45c9209a5bf22b739 Mon Sep 17 00:00:00 2001 From: PG1204 Date: Sun, 12 Apr 2026 15:53:02 -0700 Subject: [PATCH 3/3] fix: getTargetBranch method --- .../java/com/example/blast_radius/model/PrAnalysisRequest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java b/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java index 9c8130f..7aa0e76 100644 --- a/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java +++ b/src/main/java/com/example/blast_radius/model/PrAnalysisRequest.java @@ -14,7 +14,7 @@ public void setBaseBranch(String baseBranch) { } public String getTargetBranch() { - return baseBranch; + return targetBranch; } public void setTargetBranch(String targetBranch) {