Gitea Integrations issues fixes#33
Conversation
LiveReview Pre-Commit Check: skipped manually
LiveReview Pre-Commit Check: ran (iter:3, coverage:100%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
| baseURL, owner, repo, prNumber, reviewID, len(replyText)) | ||
| func (c *APIClient) postInlineCommentReplyMultipart(baseURL, owner, repo string, prNumber int, event *UnifiedWebhookEventV2, replyText string, reviewID, replyCommentID int64, username, password string) error { | ||
| log.Printf("[DIAG] postInlineCommentReplyMultipart ENTRY: baseURL=%s, owner=%s, repo=%s, prNumber=%d, reviewID=%d, replyCommentID=%d, replyTextLen=%d", | ||
| baseURL, owner, repo, prNumber, reviewID, replyCommentID, len(replyText)) |
…ccuracy LiveReview Pre-Commit Check: ran (iter:3, coverage:68%)
|
Severity: info Implement Comprehensive Gitea IntegrationOverviewThis change set significantly enhances Gitea integration, improving webhook processing, API interactions, and comment handling. It standardizes network calls and refines how Gitea's unique inline review events are interpreted and processed. New documentation outlines known Gitea-specific issues. Technical Highlights
Impact
|
| LineType: lineType, | ||
| } | ||
| } | ||
| break // Take the first mention we find |
There was a problem hiding this comment.
Severity: critical
This break statement contradicts the stated solution for 'Race Condition Handling for Multiple Bot Comments' (TODO #4 in gitea_issues.md).
Suggestions:
- Remove this
breakstatement. The solution explicitly mentions 'Removed early break after finding first suitable comment' and 'Collect all suitable comments instead of breaking after first match'. This needs to be removed to implement the intended fix for race conditions.
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
| return true, ResponseScenarioV2{ | ||
| Type: "review_submission", | ||
| Reason: "Gitea review submission (requires scan of inline comments)", | ||
| Confidence: 0.5, // Low confidence until we find a mention in the scan |
There was a problem hiding this comment.
What is this confidence value? where it is used and why it is 0.5?
There was a problem hiding this comment.
Gitea doesn't have proper webhooks.
whenever new comment posted, it doesn't have any data in the webhook.
So, there is a 50% probability whether the reply is needed or not based on fetching the recent comment posted in the PR.
So, it is set up to 0.5 to identify the confidence level of the comment.
| } | ||
|
|
||
| req, err := http.NewRequest("GET", apiURL, nil) | ||
| req, err := networkgithub.NewRequest(http.MethodGet, apiURL, nil) |
There was a problem hiding this comment.
Why did this change to networkGitHub? What is the difference?
There was a problem hiding this comment.
This might not be related to Gitea issues, but this change has to be done due to rule 2 in Copilot instructions and security audits.
- All the network operations should be defined in a single module with proper security doc mentioned in the network. md
- This rule mainly focuses on any HTTP request that should be done through a single model.
| } | ||
| // Construct the official API patch URL which reliably accepts PAT authentication. | ||
| // We prioritize this over the UI-based patch_url often found in webhook metadata. | ||
| baseURL := strings.TrimRight(token.ProviderURL, "/") |
There was a problem hiding this comment.
What is the difference here from previous patchURL construction?
There was a problem hiding this comment.
The old version was directly fetching the patch URL in the UI, which was added to send in the webhook.
which may need auth to view the page.
As I checked a few cases, the path URL was not sent in the webhook from the Gitea side.
So, I just reordered to use an actual API call with a PAT token to view diff.
|
Did you test other Git providers (eg: github) with these new changes? |
There were no major changes with other Git providers other than the network module refactor. So, it will work as expected. |
LiveReview Pre-Commit Check: ran (iter:1, coverage:0%)
did you tested? |
Tested now. |
Gitea is a Git provider that LR supports as a PR review. But it has some bugs in posting comments.
Problems
Solution
What's left for now