Skip to content

Commit 8c820dd

Browse files
authored
Merge pull request #1907 from apiraino/fix-overflowing-integer
Fix overflowing integer when retrieving comments for FCP
2 parents 1fb66e7 + 4279369 commit 8c820dd

File tree

2 files changed

+16
-22
lines changed

2 files changed

+16
-22
lines changed

src/github.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ impl Issue {
646646
self.state == IssueState::Open
647647
}
648648

649-
pub async fn get_comment(&self, client: &GithubClient, id: i32) -> anyhow::Result<Comment> {
649+
pub async fn get_comment(&self, client: &GithubClient, id: u64) -> anyhow::Result<Comment> {
650650
let comment_url = format!("{}/issues/comments/{}", self.repository().url(client), id);
651651
let comment = client.json(client.get(&comment_url)).await?;
652652
Ok(comment)
@@ -2103,24 +2103,18 @@ impl<'q> IssuesQuery for Query<'q> {
21032103
);
21042104
let bot_tracking_comment_content = quote_reply(&fcp.status_comment.body);
21052105
let fk_initiating_comment = fcp.fcp.fk_initiating_comment;
2106-
let (initiating_comment_html_url, initiating_comment_content) =
2107-
if u32::try_from(fk_initiating_comment).is_err() {
2108-
// We blew out the GH comment incremental counter (a i32 on their end)
2109-
// See: https://rust-lang.zulipchat.com/#narrow/stream/242791-t-infra/topic/rfcbot.20asleep
2110-
log::debug!("Ignoring overflowed comment id from GitHub");
2111-
("".to_string(), "".to_string())
2112-
} else {
2113-
let comment = issue
2114-
.get_comment(&client, fk_initiating_comment.try_into()?)
2115-
.await
2116-
.with_context(|| {
2117-
format!(
2118-
"failed to get first comment id={} for fcp={}",
2119-
fk_initiating_comment, fcp.fcp.id
2120-
)
2121-
})?;
2122-
(comment.html_url, quote_reply(&comment.body))
2123-
};
2106+
let (initiating_comment_html_url, initiating_comment_content) = {
2107+
let comment = issue
2108+
.get_comment(&client, fk_initiating_comment)
2109+
.await
2110+
.with_context(|| {
2111+
format!(
2112+
"failed to get first comment id={} for fcp={}",
2113+
fk_initiating_comment, fcp.fcp.id
2114+
)
2115+
})?;
2116+
(comment.html_url, quote_reply(&comment.body))
2117+
};
21242118

21252119
// TODO: agree with the team(s) a policy to emit actual mentions to remind FCP
21262120
// voting member to cast their vote

src/rfcbot.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ pub struct FCP {
77
pub id: u32,
88
pub fk_issue: u32,
99
pub fk_initiator: u32,
10-
pub fk_initiating_comment: i32,
10+
pub fk_initiating_comment: u64,
1111
pub disposition: Option<String>,
12-
pub fk_bot_tracking_comment: i32,
12+
pub fk_bot_tracking_comment: u64,
1313
pub fcp_start: Option<String>,
1414
pub fcp_closed: bool,
1515
}
@@ -50,7 +50,7 @@ pub struct FCPIssue {
5050

5151
#[derive(Serialize, Deserialize, Debug, Clone)]
5252
pub struct StatusComment {
53-
pub id: i32,
53+
pub id: u64,
5454
pub fk_issue: u32,
5555
pub fk_user: u32,
5656
pub body: String,

0 commit comments

Comments
 (0)