Skip to content

Commit 4279369

Browse files
committed
Fix overflowing integer when parsing GH comments IDs
1 parent e51632f commit 4279369

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
@@ -648,7 +648,7 @@ impl Issue {
648648
self.state == IssueState::Open
649649
}
650650

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

21282122
// TODO: agree with the team(s) a policy to emit actual mentions to remind FCP
21292123
// 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)