feat(forgejo-opencode-review): Submit review verdicts in Forgejo #52
No reviewers
Labels
No labels
automerge
bug
dependencies
duplicate
enhancement
help wanted
invalid
migrations
question
vulnerability
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Reference
Personal/woodpecker-plugins!52
Loading…
Reference in a new issue
No description provided.
Delete branch "forgejo-opencode-review/approve-or-changes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
approveandchangesverdicts to ForgejoAPPROVEandREQUEST_CHANGESreview events.COMMENTreviews for new inline findings.Verification
cargo test -p forgejo-opencode-reviewcargo clippy -p forgejo-opencode-review -- -D warningscargo fmt --checkgit diff --checkReview Summary
Core logic looks correct:
review_event()mapsapprove/changestoAPPROVE/REQUEST_CHANGEScase-insensitively, submitting an event with an empty comment list is valid for Forgejo, a failed review submission only logs a warning (consistent with the rest of the plugin), the new unit test covers the mapping, and README step 11 matches the new flow.But the integration tests never reach the code they now claim to verify:
GET .../pulls/42/filesmock registered without apagematcher returns[]. It therefore answers thepage=1request, so the plugin exits at thefiltered.is_empty()check before running opencode or POSTing anything. Theexpected_reviewmock added in this PR — and the summary expectation edited here — are never exercised; these tests would pass even ifreview_eventalways returnedNone. Same applies tointegration_posts_summary_and_inline_review. Suggested fix: mount thepage=1mock before the empty one (or add apage=1query matcher to it) and assert withserver.verify()/.expect(1).summary_bodyappends a trailing\n\n<!-- forgejo-opencode-review -->that the exact-match expectation omits.Other notes:
hallucinated line -> file-levelhandling (diagram + step 12) that the code does not implement —c.linegoes straight tonew_position/old_position, and file-level fallback only happens whenlineisNone.APPROVE/REQUEST_CHANGESthat can gate merges — submitter-controlled text can now steer merge-blocking state. Consider an opt-in setting for submittingAPPROVE, or document that the bot's approval must not be counted as a trusted review.*🤖 Review by opencode (opencode/mimo-v2.6-flash-free) — verdict: changes
Code review findings from opencode.
@ -89,0 +84,4 @@alt Verdict is approve or changesPlugin->>Forgejo: POST /pulls/{index}/reviews (APPROVE or REQUEST_CHANGES)else Has new inline commentsPlugin->>Plugin: Build diff position map and drop duplicate findings@ -204,3 +213,2 @@.collect();if !new_comments.is_empty() {info!(count = new_comments.len(), "posting new inline comments");let review_event = review_event(&parsed.verdict, !new_comments.is_empty());This will be used in a closed environment so its not a problem
@ -702,3 +726,3 @@let expected_body: serde_json::Value = match serde_json::from_str(r##"{"body": "# Review Summary\n\nLooks good.\n\n---\n*🤖 Review by opencode (anthropic/claude-sonnet-4.5) — verdict: **comment**"}"##,r##"{"body": "# Review Summary\n\nLooks good.\n\n---\n*🤖 Review by opencode (anthropic/claude-sonnet-4.5) — verdict: **approve**"}"##,@ -719,6 +743,24 @@ mod tests {).await;let expected_review = serde_json::json!({View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.