Closed woojiahao closed 3 months ago
For the second fix, the primary issue is that the comment is added before the assignee issue could be detected which falsely sets the issue to be "responded" when the assignee field is actually blank.
Inverting the order would resolve this issue logically, but the current updateIssue
is dependent on the updated GitHub comments which means that the inherent behavior is tied to the old ordering (create comment -> assign issue metadata) than the new one.
Effectively, the current updateIssue
method isn't pure enough to treat it as an atomic operation as it attempts to create an Issue
model as well.
I'm currently investigating ways to fix this issue, one way is to create a "shadow" copy of updateIssue
that does not perform the automatic parsing from GitHubIssue
-> Issue
until the final operation is completed.
For the sake of clarity, the following is the original flow of creating a team response
sequenceDiagram
participant Caller
participant i as IssueService
participant g as GitHubService
Caller ->> i : createTeamResponse(Issue)
i ->> g : createIssueComment
g -->> i : GitHubComment
i ->> i : Update Issue githubComments field with latest comments
i ->> i : updateIssue
i ->> g : updateIssue
alt valid fields
g -->> i : GitHubIssue
i ->> i : createIssueModel(GitHubIssue)
else else
g -->> i : Error
i ->> i : Parse error
end
i -->> Caller : Complete
The new flow proposed does the following
sequenceDiagram
participant Caller
participant i as IssueService
participant g as GitHubService
Caller ->> i : createTeamResponse(Issue)
i ->> i : updateIssuePure
i ->> g : updateIssue
alt valid fields
g -->> i : GitHubIssue
i ->> g : createIssueComment
g -->> i : GitHubComment
i ->> i : Update Issue githubComments field with latest comments
i ->> i : createIssueModel(GitHubIssue)
i -->> Caller : Complete
else else
g -->> i : Error
i ->> i : Parse error
i -->> Caller : Terminate operation
end
@luminousleek Thank you for the review :) I have updated my commit message and addressed the comments!
Re refactoring the issues service: it does appear that a final step for several other methods is to perform an effective DTO mapping from GithubIssue
to Issue
. Perhaps the team might want to consider a proper logical split between the logic that retrieves data from the Github API and the logic that performs the DTO mapping. I feel that this can help to make the code a lot clearer. It also helps to create more atomic operations for issue querying with the Github API. Just my 2 cents!
Attention: Patch coverage is 0%
with 14 lines
in your changes are missing coverage. Please review.
Project coverage is 54.50%. Comparing base (
5e7ed48
) to head (87d6ae5
).
Files | Patch % | Lines |
---|---|---|
src/app/core/services/issue.service.ts | 0.00% | 14 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Summary:
Fixes #1262
Changes Made:
updateIssue
errors to detect when assignees are invalid and providing custom error messagesProposed Commit Message: