-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Enhance multi-stage review orchestrator with issue deduplication #177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule frontend
updated
7 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
113 changes: 113 additions & 0 deletions
113
...analysis-engine/src/main/java/org/rostilos/codecrow/analysisengine/util/VcsDiffUtils.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,113 @@ | ||
| package org.rostilos.codecrow.analysisengine.util; | ||
|
|
||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| import java.io.IOException; | ||
|
|
||
| /** | ||
| * Shared utility for computing delta diffs between commits with content filtering. | ||
| * <p> | ||
| * Centralises the fetch + filter + error-handling logic that was previously | ||
| * duplicated across BitbucketAiClientService, GithubAiClientService, and | ||
| * GitlabAiClientService. The caller passes a provider-agnostic | ||
| * {@link CommitRangeDiffFetcher} lambda so no VCS-specific imports are needed. | ||
| */ | ||
| public final class VcsDiffUtils { | ||
|
|
||
| private static final Logger log = LoggerFactory.getLogger(VcsDiffUtils.class); | ||
|
|
||
| /** | ||
| * When the delta diff size exceeds this fraction of the full diff size, | ||
| * the analysis escalates from INCREMENTAL back to FULL mode because the | ||
| * delta is almost as large as the original. | ||
| */ | ||
| public static final double INCREMENTAL_ESCALATION_THRESHOLD = 0.5; | ||
|
|
||
| /** | ||
| * Minimum delta-diff size (in characters) below which the diff is considered | ||
| * trivially small and always qualifies for incremental mode. | ||
| */ | ||
| public static final int MIN_DELTA_DIFF_SIZE = 500; | ||
|
|
||
| private VcsDiffUtils() { | ||
| // utility class | ||
| } | ||
|
|
||
| /** | ||
| * Provider-agnostic callback for obtaining the raw diff between two commits. | ||
| * <p> | ||
| * Implementations typically delegate to a VCS-specific action class | ||
| * (e.g. {@code GetCommitRangeDiffAction}) or to | ||
| * {@code VcsOperationsService.getCommitRangeDiff}. | ||
| */ | ||
| @FunctionalInterface | ||
| public interface CommitRangeDiffFetcher { | ||
| /** | ||
| * @param workspace workspace slug / owner / namespace | ||
| * @param repoSlug repository slug | ||
| * @param baseCommit base (previously analysed) commit hash | ||
| * @param headCommit head (current) commit hash | ||
| * @return raw unified diff between the two commits | ||
| * @throws IOException on network or parsing errors | ||
| */ | ||
| String fetch(String workspace, String repoSlug, | ||
| String baseCommit, String headCommit) throws IOException; | ||
| } | ||
|
|
||
| /** | ||
| * Fetches the delta diff between two commits, applies the content filter, | ||
| * and returns the filtered result. Returns {@code null} on failure | ||
| * (non-blocking — errors are logged as warnings). | ||
| * | ||
| * @param fetcher provider-agnostic diff retriever | ||
| * @param workspace workspace slug / owner / namespace | ||
| * @param repoSlug repository slug | ||
| * @param baseCommit base commit hash (the last successfully analysed one) | ||
| * @param headCommit head commit hash (the current one) | ||
| * @param contentFilter content-size filter to strip oversised file diffs | ||
| * @return filtered delta diff, or {@code null} if fetching failed | ||
| */ | ||
| public static String fetchDeltaDiff( | ||
| CommitRangeDiffFetcher fetcher, | ||
| String workspace, | ||
| String repoSlug, | ||
| String baseCommit, | ||
| String headCommit, | ||
| DiffContentFilter contentFilter) { | ||
| try { | ||
| String rawDeltaDiff = fetcher.fetch(workspace, repoSlug, baseCommit, headCommit); | ||
| return contentFilter.filterDiff(rawDeltaDiff); | ||
| } catch (IOException e) { | ||
| log.warn("Failed to fetch delta diff from {} to {}: {}", | ||
| truncateHash(baseCommit), | ||
| truncateHash(headCommit), | ||
| e.getMessage()); | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Determines whether an incremental analysis should be escalated back to | ||
| * FULL mode based on the delta-diff size relative to the full diff. | ||
| * | ||
| * @param deltaDiffLength length of the delta diff in characters | ||
| * @param fullDiffLength length of the full PR/commit diff in characters | ||
| * @return {@code true} if the delta is large enough to warrant full re-analysis | ||
| */ | ||
| public static boolean shouldEscalateToFull(int deltaDiffLength, int fullDiffLength) { | ||
| if (deltaDiffLength <= MIN_DELTA_DIFF_SIZE) { | ||
| return false; | ||
| } | ||
| if (fullDiffLength <= 0) { | ||
| return false; | ||
| } | ||
| return (double) deltaDiffLength / fullDiffLength > INCREMENTAL_ESCALATION_THRESHOLD; | ||
| } | ||
|
|
||
| private static String truncateHash(String hash) { | ||
| return (hash != null && hash.length() > 7) | ||
| ? hash.substring(0, 7) | ||
| : String.valueOf(hash); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
java-ecosystem/libs/ast-parser/src/main/resources/META-INF/MANIFEST.MF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| Manifest-Version: 1.0 | ||
| Automatic-Module-Name: org.rostilos.codecrow.astparser |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add explicit assertions for the new
aiBaseUrlrecord field.These tests updated constructor arguments but never verify
request.aiBaseUrl(), so regressions on this new component can slip through.Suggested assertion additions
@@ assertThat(request.aiProvider()).isEqualTo("openai"); assertThat(request.aiModel()).isEqualTo("gpt-4"); assertThat(request.aiApiKey()).isEqualTo("api-key"); + assertThat(request.aiBaseUrl()).isNull(); assertThat(request.pullRequestId()).isEqualTo(42L); @@ assertThat(request.projectId()).isEqualTo(1L); assertThat(request.aiProvider()).isEqualTo("anthropic"); assertThat(request.aiModel()).isEqualTo("claude-3"); + assertThat(request.aiBaseUrl()).isNull(); assertThat(request.question()).isEqualTo("What is this code doing?"); @@ assertThat(request.projectId()).isEqualTo(1L); + assertThat(request.aiBaseUrl()).isNull(); assertThat(request.pullRequestId()).isEqualTo(42L);Also applies to: 57-57, 77-77, 149-149
🤖 Prompt for AI Agents