diff --git a/src/safe_outputs/submit_pr_review.rs b/src/safe_outputs/submit_pr_review.rs
index 8c63d6f4..6c5294cb 100644
--- a/src/safe_outputs/submit_pr_review.rs
+++ b/src/safe_outputs/submit_pr_review.rs
@@ -168,18 +168,31 @@ async fn fetch_authenticated_user_id(
Ok(Ok(user_id))
}
+/// Shared context for ADO PR vote API calls.
+struct PrVoteCtx<'a> {
+ client: &'a reqwest::Client,
+ base_url: &'a str,
+ encoded_repo: &'a str,
+ pull_request_id: i32,
+ token: &'a str,
+}
+
/// Self-approval guard: returns `Some(failure)` when a positive vote targets a PR the
/// authenticated user created; returns `None` when the vote is allowed to proceed.
async fn check_self_approval(
- client: &reqwest::Client,
- base_url: &str,
- encoded_repo: &str,
- pull_request_id: i32,
+ ctx: &PrVoteCtx<'_>,
user_id: &str,
event: &str,
vote_value: i32,
- token: &str,
) -> anyhow::Result