Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Octobors doesn't find all comments #43

Open
tgolsson opened this issue Feb 28, 2023 · 0 comments
Open

Octobors doesn't find all comments #43

tgolsson opened this issue Feb 28, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@tgolsson
Copy link
Member

Describe the bug

One of my PRs had received full approval, but the bot wasn't accepting that it was reviewed. While inspecting logs I found that it was reporting the wrong review state:

2023-02-28 15:40:08 | INFO repo{name="xxxx"}:pr{number=8710}: octobors::process: Not yet approved by review
2023-02-28 15:40:08 | INFO repo{name="xxxx"}:pr{number=8710}: octobors::review: review user=repi review=ChangeRequested

Inspecting the list of reviews it reported, I found that the list had only 30 elements, from the start of the PR. Since the latest were missing, I wrote a small code-snippet (see bottom) replicating the merge-check. This code reported 57 reviews and approved. Worth noting is that 30 items is the number of items per page.

This may be related to our usage of ghProxy, as the code here will bypass the proxy for each following link as I can understand it:

octobors/src/context.rs

Lines 69 to 72 in 6b6bbb2

while let Some(previous) = page {
reviews.extend(previous.items);
page = self.inner.get_page(&previous.next).await?;
}

To Reproduce

No idea.

Expected behavior

All comments are found by the bot.

Additional context

use anyhow::Context;
use octobors::review::{Approval, Review};

#[tokio::main]
async fn main() {
    let token = std::env::var("GITHUB_TOKEN")
        .context("failed to read GITHUB_TOKEN environment variable")
        .unwrap()
        .trim()
        .to_string();

    let client = octobors::context::Client::new(
        token,
        "EmbarkStudios".to_string(),
        Some("https://ghproxy.embark.net/"),
        &[(
            "x-ghproxy-auth".to_owned(),
            "----".to_owned(),
        )],
    )
    .unwrap();

    let res = client.get_pull_request_reviews("xxxx", 8710).await.unwrap();
    dbg!(res.len());
    let reviews =
        octobors::review::Reviews::new("tgolsson", octobors::review::CommentEffect::RequestsChange)
            .record_reviews(
                res.iter()
                    .map(Review::from_octocrab_review)
                    .map(Option::unwrap)
                    .collect(),
            );

    dbg!(&reviews, reviews.approved(Approval::Required));
}
@tgolsson tgolsson added the bug Something isn't working label Feb 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant