Conversation
|
I have a few open questions/issues regarding this PR:
Edit: |
|
Quick update regarding connected events: |
|
Good idea! I agree, it does not fit into the GitHubWrapper. So, just store it in the json file and we will find the related issue later. (1) We do all the other processing in codeface-extraction. Why should we leave this one post-processing step to coronet? Would be inconsistent, I guess. So, I'd suggest to compute the connected issue in codeface-extraction. |
|
This PR is ready for review, but should be merged after PR #31 is merged. |
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for handling new GitHub event types related to issue management, specifically: issue type changes, state changes (reopened), parent/sub-issue relationships, and connected events. The changes enhance the existing GitHub API wrapper to capture and process these additional event types.
Key changes include:
- New data models for issue types (
TypeData) and state reasons (StateReason) - Support for tracking sub-issues and external commits
- Enhanced event processing for the newly supported event types
- Improved commit hash extraction by filtering out code blocks
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
TypeData.java |
New data model for issue type information from GitHub's API |
StateReason.java |
New enum for issue/PR state reasons (completed, reopened, not_planned, duplicate) |
IssueDataProcessor.java |
Added sub-issue parsing, external commit tracking, and code block filtering in hash extraction |
IssueData.java |
Added type field and sub-issues list to issue data model |
GitHubRepository.java |
Added external commit URL fetching and registered new event processors |
GitHubCommit.java |
Added external commit tracking flag |
EventDataProcessor.java |
Added processors for state change, issue type change, and connected events |
EventData.java |
Added new event data classes for state changes, issue type changes, parent/sub-issue changes, and connected events |
README.md |
Added documentation about referenced events and data processing |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
I am satisfied with the changes in this PR. However, we also need to satisfy Copilot in this and the previous PR. |
|
And please add you copyright header to StateReason.java, since you have modified it yourself now. |
external commits that reference an issue can now be fetched. They will be marked with 'commitReferencesIssueExternal'. To that end, this commit adds an 'external' field to each commit and a new method to extract commits using the full url instead of just the relative one within the repo. Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
references to issues are now only found if they are ouside a code environment (starting and ending with three '`'). This mirrors GitHubs behaviour. Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
Add paragraph that documents intended and unintended behaviour for 'referenced' events Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
reformat README and nested if statement Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
change BE words for consistency Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
Getter previously did not use method parameter. Also renamed and added docs to match existing methods. Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
using stringbuilder instead of appending, which would result in copying the string Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
introduce new state reason and type data classes Signed-off-by: Shiraz Jafri <shirazjafri@outlook.com>
Add new event data subclass for state changed events Signed-off-by: Shiraz Jafri <shirazJafri@outlook.com>
Add new enum and eventdata subclasses to track changes in issue types Signed-off-by: Shiraz Jafri <shirazJafri@outlook.com>
no longer serializing change_type field in IssueTypeChangedEventData Signed-off-by: Shiraz Jafri <shirazJafri@outlook.com>
Introduce new subclasses for parent and subissue events Signed-off-by: Shiraz jarfi <shirazJafri@outlook.com>
Introduce new event data subclass for connected events Signed-off-by: Shiraz Jafri <shirazJafri@outlook.com>
key was duplicated with different values, overwriting previous entry Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
also add event ids and subissue numbers to data SHA-1 extraction now only recognises hexadecimal strings length 7 and above (previously 5) Issue and Event data are extended by simple fields to hold event ids and subissue numbers Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
also fix copyright headers in new files Signed-off-by: Leo Sendelbach
Parernt- and Subissues can not have a 'changed' event None and Any state reasons were not achievable Also removed the state reason field from issue data StateChangedEvents can now have a commit (issues can be closed by a commit) Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
instead of assigning completed as default case, now throw an error. If new state reasons are added later on githubs side, the occurence of this error should prevent us from not noticing that change. Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
suggestions contain a codeblock using the suggestion keyword after opening the block. Add a field to reviewCommentData and result json for this boolean Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Comments suppressed due to low confidence (2)
src/de/uni_passau/fim/gitwrapper/EventDataProcessor.java:1
- The inner class
StateChangedEventDatais declared aspublic classinsideEventData.java, but should be declared aspublic static classto match the pattern of other inner event classes likeReferencedEventDataandLabeledEventDatain the same file.
/**
src/de/uni_passau/fim/gitwrapper/IssueDataProcessor.java:431
- Variable 'String stateReasonValue' is never read.
String stateReasonValue = (stateReasonElement != null && !stateReasonElement.isJsonNull())
? stateReasonElement.getAsString()
: null;
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Fixes: - case sensitive check for suggestion - minor spelling issue - artifact from state reasons in issue data - debug comment - copyright headers Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
If no userdata is found except for the username, initialize the dummy with that username Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
This allows us to extract the reason for locking a conversation Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 12 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- update documentation, fix spelling - add new fields to 'freeze' method - use stringbuilder instead of concatenation - fix deserialization of new event type - change state change event to inherit from referenced event Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Parse commits from referenced commits | ||
| Stream<ReferencedLink<List<String>>> referencedCommits = issue.getEventsList().stream() | ||
| .filter(eventData -> eventData instanceof EventData.ReferencedEventData) | ||
| .filter(eventData -> eventData instanceof EventData.ReferencedEventData || eventData instanceof EventData.StateChangedEventData) |
There was a problem hiding this comment.
The || eventData instanceof EventData.StateChangedEventData check is redundant because StateChangedEventData extends ReferencedEventData, so the first instanceof check already covers it. This can be simplified to just eventData instanceof EventData.ReferencedEventData.
| .filter(eventData -> eventData instanceof EventData.ReferencedEventData || eventData instanceof EventData.StateChangedEventData) | |
| .filter(eventData -> eventData instanceof EventData.ReferencedEventData) |
| return DUMMY_USER; | ||
| if (username == null || username.isEmpty()) { | ||
| LOG.warning("Could not get information about unknown user!"); | ||
| (guess ? guessedUsersByUsername : strictUsersByUsername).put(username, DUMMY_USER); |
There was a problem hiding this comment.
When username is null, calling .put(username, DUMMY_USER) on a ConcurrentHashMap will throw a NullPointerException, since ConcurrentHashMap does not allow null keys. You should either skip the cache insertion when username is null, or return DUMMY_USER immediately without caching.
| (guess ? guessedUsersByUsername : strictUsersByUsername).put(username, DUMMY_USER); |
There was a problem hiding this comment.
I agree with copilot here. We should not put null or "" into the dicct.
| // filter out everything in code block | ||
| String[] texts = text.split("```"); | ||
| StringBuilder sb = new StringBuilder(); | ||
| for (int i = 0; i < texts.length; i++) { | ||
| if (i % 2 == 0) { | ||
| sb.append(texts[i]); | ||
| } | ||
| } | ||
| text = sb.toString(); |
There was a problem hiding this comment.
The code block filtering logic (splitting on ``` and keeping even-indexed segments) is duplicated here and in extractHashtags (lines 306-314). Consider extracting this into a private helper method (e.g., stripCodeBlocks(String text)) to avoid duplication and make future changes easier.
| * JSON String, as it is not needed for further processing. | ||
| */ | ||
| LOG.info("Malformed JSON String when querying data for commit " + url + ". Neglect files element."); | ||
| String jsonStringFromURL = getJSONStringFromURL(url).get(); |
There was a problem hiding this comment.
getJSONStringFromURL(url).get() is called without first checking isPresent(). If the URL fails to return data (e.g., the server responds with an error or the resource was deleted), this will throw a NoSuchElementException. While the same pattern exists in the original getGithubCommit method, it's still risky here—especially since this method is specifically designed for external/fallback commit lookups that are more likely to fail. Consider handling the empty Optional case gracefully.
| String jsonStringFromURL = getJSONStringFromURL(url).get(); | |
| Optional<String> jsonStringOptional = getJSONStringFromURL(url); | |
| if (!jsonStringOptional.isPresent()) { | |
| LOG.warning("Could not retrieve JSON String when querying data for commit " + url + " after malformed response."); | |
| Optional<GitHubCommit> res = Optional.empty(); | |
| checkedHashes.put(hash, res); | |
| return res; | |
| } | |
| String jsonStringFromURL = jsonStringOptional.get(); |
There was a problem hiding this comment.
While the other comments of @copilot make sense to me, I am not sure about this one.
@Leo-Send What do you think? Is this something that makes sense? I have the feeling that this is nonsense. The printed log warning seems to be unrelated to the isPresent call that Copilot suggests. Or do you perceive it differently?
There was a problem hiding this comment.
The case described by copilot can only happen if the api returns null (since every other return should be castable to a string), which I believe would be an indicator of the api being completely unavailable. I do not think we should continue the execution in this case.
| * Gets the type of the issue. | ||
| * | ||
| * @return the type | ||
| */ |
There was a problem hiding this comment.
The Javadoc comment has inconsistent indentation—the * characters are indented one space less than the rest of the Javadoc comments in this file (4 spaces instead of 5). See the surrounding methods like getState() at line 193 for the correct format.
| * Gets the type of the issue. | |
| * | |
| * @return the type | |
| */ | |
| * Gets the type of the issue. | |
| * | |
| * @return the type | |
| */ |
Remove unnecessary type check, refactor into new helperfunction, and formatting Signed-off-by: Leo Sendelbach <s8lesend@stud.uni-saarland.de>
Adds functionality for the following events: