Skip to content

Commit 808f9ff

Browse files
authored
Merge pull request #1784 from Urgau/compiler_fcp_details
Use rfcbot style for FCPs in the prioritization agenda
2 parents 89b98f2 + 7506b21 commit 808f9ff

File tree

5 files changed

+97
-6
lines changed

5 files changed

+97
-6
lines changed

src/actions.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,29 @@ pub struct IssueDecorator {
5454
pub mcp_details: Option<MCPDetails>,
5555
}
5656

57+
#[derive(Serialize, Deserialize, Debug)]
58+
pub struct FCPConcernDetails {
59+
pub name: String,
60+
pub reviewer_login: String,
61+
pub concern_url: String,
62+
}
63+
64+
#[derive(Serialize, Deserialize, Debug)]
65+
pub struct FCPReviewerDetails {
66+
pub github_login: String,
67+
pub zulip_id: Option<u64>,
68+
}
69+
5770
#[derive(Serialize, Deserialize, Debug)]
5871
pub struct FCPDetails {
5972
pub bot_tracking_comment_html_url: String,
6073
pub bot_tracking_comment_content: String,
6174
pub initiating_comment_html_url: String,
6275
pub initiating_comment_content: String,
76+
pub disposition: String,
77+
pub should_mention: bool,
78+
pub pending_reviewers: Vec<FCPReviewerDetails>,
79+
pub concerns: Vec<FCPConcernDetails>,
6380
}
6481

6582
#[derive(Serialize, Deserialize, Debug)]
@@ -130,6 +147,7 @@ impl<'a> Action for Step<'a> {
130147
let query = query.clone();
131148
handles.push(tokio::task::spawn(async move {
132149
let _permit = semaphore.acquire().await?;
150+
let fcps_groups = ["proposed_fcp", "in_pre_fcp", "in_fcp"];
133151
let mcps_groups = [
134152
"mcp_new_not_seconded",
135153
"mcp_old_not_seconded",
@@ -140,7 +158,7 @@ impl<'a> Action for Step<'a> {
140158
let issues = query
141159
.query(
142160
&repository,
143-
name == "proposed_fcp",
161+
fcps_groups.contains(&name.as_str()),
144162
mcps_groups.contains(&name.as_str())
145163
&& repository.full_name.contains("rust-lang/compiler-team"),
146164
&gh,

src/github.rs

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ pub struct Comment {
364364
pub html_url: String,
365365
pub user: User,
366366
#[serde(alias = "submitted_at")] // for pull request reviews
367+
pub created_at: chrono::DateTime<Utc>,
368+
#[serde(alias = "submitted_at")] // for pull request reviews
367369
pub updated_at: chrono::DateTime<Utc>,
368370
#[serde(default, rename = "state")]
369371
pub pr_review_state: Option<PullRequestReviewState>,
@@ -1715,11 +1717,19 @@ impl<'q> IssuesQuery for Query<'q> {
17151717
.with_context(|| "Unable to get issues.")?;
17161718

17171719
let fcp_map = if include_fcp_details {
1718-
crate::rfcbot::get_all_fcps().await?
1720+
crate::rfcbot::get_all_fcps()
1721+
.await
1722+
.with_context(|| "Unable to get all fcps from rfcbot.")?
17191723
} else {
17201724
HashMap::new()
17211725
};
17221726

1727+
let zulip_map = if include_fcp_details {
1728+
Some(crate::team_data::zulip_map(client).await?)
1729+
} else {
1730+
None
1731+
};
1732+
17231733
let mut issues_decorator = Vec::new();
17241734
let re = regex::Regex::new("https://github.com/rust-lang/|/").unwrap();
17251735
let re_zulip_link = regex::Regex::new(r"\[stream\]:\s").unwrap();
@@ -1748,11 +1758,51 @@ impl<'q> IssuesQuery for Query<'q> {
17481758
.get_comment(&client, fk_initiating_comment.try_into()?)
17491759
.await?;
17501760

1761+
// TODO: agree with the team(s) a policy to emit actual mentions to remind FCP
1762+
// voting member to cast their vote
1763+
let should_mention = false;
17511764
Some(crate::actions::FCPDetails {
17521765
bot_tracking_comment_html_url,
17531766
bot_tracking_comment_content,
17541767
initiating_comment_html_url: init_comment.html_url.clone(),
17551768
initiating_comment_content: quote_reply(&init_comment.body),
1769+
disposition: fcp
1770+
.fcp
1771+
.disposition
1772+
.as_deref()
1773+
.unwrap_or("<unknown>")
1774+
.to_string(),
1775+
should_mention,
1776+
pending_reviewers: fcp
1777+
.reviews
1778+
.iter()
1779+
.filter_map(|r| {
1780+
(!r.approved).then(|| crate::actions::FCPReviewerDetails {
1781+
github_login: r.reviewer.login.clone(),
1782+
zulip_id: zulip_map
1783+
.as_ref()
1784+
.map(|map| {
1785+
map.users
1786+
.iter()
1787+
.find(|&(_, &github)| github == r.reviewer.id)
1788+
.map(|v| *v.0)
1789+
})
1790+
.flatten(),
1791+
})
1792+
})
1793+
.collect(),
1794+
concerns: fcp
1795+
.concerns
1796+
.iter()
1797+
.map(|c| crate::actions::FCPConcernDetails {
1798+
name: c.name.clone(),
1799+
reviewer_login: c.reviewer.login.clone(),
1800+
concern_url: format!(
1801+
"{}#issuecomment-{}",
1802+
issue.html_url, c.comment.id
1803+
),
1804+
})
1805+
.collect(),
17561806
})
17571807
} else {
17581808
None

src/rfcbot.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub struct FCP {
1515
}
1616
#[derive(Serialize, Deserialize, Debug, Clone)]
1717
pub struct Reviewer {
18-
pub id: u32,
18+
pub id: u64,
1919
pub login: String,
2020
}
2121
#[derive(Serialize, Deserialize, Debug, Clone)]
@@ -24,10 +24,16 @@ pub struct Review {
2424
pub approved: bool,
2525
}
2626
#[derive(Serialize, Deserialize, Debug, Clone)]
27+
pub struct Concern {
28+
pub name: String,
29+
pub comment: StatusComment,
30+
pub reviewer: Reviewer,
31+
}
32+
#[derive(Serialize, Deserialize, Debug, Clone)]
2733
pub struct FCPIssue {
2834
pub id: u32,
2935
pub number: u32,
30-
pub fk_milestone: Option<String>,
36+
pub fk_milestone: Option<u32>,
3137
pub fk_user: u32,
3238
pub fk_assignee: Option<u32>,
3339
pub open: bool,
@@ -57,6 +63,7 @@ pub struct StatusComment {
5763
pub struct FullFCP {
5864
pub fcp: FCP,
5965
pub reviews: Vec<Review>,
66+
pub concerns: Vec<Concern>,
6067
pub issue: FCPIssue,
6168
pub status_comment: StatusComment,
6269
}

templates/_issues_rfcbot.tt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{% import "_issue.tt" as issue %}
2+
3+
{% macro render(issues, indent="", empty="None.") %}
4+
{%- for issue in issues %}
5+
{%- if issue.fcp_details is object %}
6+
{{indent}}- {{issue.fcp_details.disposition}}: [{{issue.title}} ({{issue.repo_name}}#{{issue.number}})]({{issue.fcp_details.bot_tracking_comment_html_url}})
7+
{{indent}}{{indent}}-{% for reviewer in issue.fcp_details.pending_reviewers %} @{% if issue.fcp_details.should_mention %}{% else %}_{% endif %}**|{{reviewer.zulip_id}}**{%else%} no pending checkboxs{% endfor %}
8+
{{indent}}{{indent}}-{% if issue.fcp_details.concerns|length > 0 %} concerns:{% endif %}{% for concern in issue.fcp_details.concerns %} [{{concern.name}} (by {{concern.reviewer_login}})]({{concern.concern_url}}){%else%} no pending concerns{% endfor -%}
9+
{% else %}
10+
{{indent}}- {{issue::render(issue=issue)}}
11+
{%- endif -%}
12+
{%else%}
13+
{{empty}}
14+
{%endfor-%}
15+
{% endmacro %}

templates/prioritization_agenda.tt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{% import "_issues.tt" as issues %}
22
{% import "_meetings.tt" as meetings %}
3+
{% import "_issues_rfcbot.tt" as issues_rfcbot %}
34

45
---
56
tags: weekly, rustc
@@ -28,9 +29,9 @@ note_id: xxx
2829
- Old MCPs (not seconded, take a look)
2930
{{-issues::render(issues=mcp_old_not_seconded, indent=" ", with_age=true, empty="No old proposals this time.")}}
3031
- Pending FCP requests (check your boxes!)
31-
{{-issues::render(issues=in_pre_fcp, indent=" ", empty="No pending FCP requests this time.")}}
32+
{{-issues_rfcbot::render(issues=in_pre_fcp, indent=" ", empty="No pending FCP requests this time.")}}
3233
- Things in FCP (make sure you're good with it)
33-
{{-issues::render(issues=in_fcp, indent=" ", empty="No FCP requests this time.")}}
34+
{{-issues_rfcbot::render(issues=in_fcp, indent=" ", empty="No FCP requests this time.")}}
3435
- Accepted MCPs
3536
{{-issues::render(issues=mcp_accepted, indent=" ", empty="No new accepted proposals this time.")}}
3637
- MCPs blocked on unresolved concerns

0 commit comments

Comments
 (0)