Skip to content

Commit 8cb9df6

Browse files
spastorinoNiko Matsakis
andauthored
Avoid fetching a whole list, just redirectly look for the issue by id or title (#288)
* Avoid fetching a whole list, just redirectly look for the issue by id or title * use existing issue if found otherwise create new issue and link * tolerate errors, stop if no progress is being made * link to the new tracking issues --------- Co-authored-by: Niko Matsakis <nikomat@amazon.com>
1 parent 77395d1 commit 8cb9df6

26 files changed

+283
-205
lines changed

crates/rust-project-goals-cli/src/rfc.rs

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ use rust_project_goals::{
1313
gh::{
1414
issue_id::{IssueId, Repository},
1515
issues::{
16-
change_milestone, create_comment, create_issue, list_tracking_issues, lock_issue,
17-
sync_assignees, FLAGSHIP_LABEL, LOCK_TEXT,
16+
change_milestone, create_comment, create_issue, fetch_issue, list_issues_in_milestone, lock_issue, sync_assignees, FLAGSHIP_LABEL, LOCK_TEXT
1817
},
1918
labels::GhLabel,
2019
},
@@ -141,19 +140,32 @@ pub fn generate_issues(
141140
progress_bar::Color::Blue,
142141
progress_bar::Style::Bold,
143142
);
143+
let mut success = 0;
144144
for action in actions.into_iter() {
145145
progress_bar::print_progress_bar_info(
146146
"Action",
147147
&format!("{}", action),
148148
progress_bar::Color::Green,
149149
progress_bar::Style::Bold,
150150
);
151-
action.execute(repository, &timeframe)?;
151+
if let Err(e) = action.execute(repository, &timeframe) {
152+
progress_bar::print_progress_bar_info(
153+
"Error",
154+
&format!("{}", e),
155+
progress_bar::Color::Red,
156+
progress_bar::Style::Bold,
157+
);
158+
} else {
159+
success += 1;
160+
}
152161
progress_bar::inc_progress_bar();
153162

154163
std::thread::sleep(Duration::from_millis(sleep));
155164
}
156165
progress_bar::finalize_progress_bar();
166+
if success == 0 {
167+
anyhow::bail!("all actions failed, aborting")
168+
}
157169
} else {
158170
eprintln!("Actions to be executed:");
159171
for action in &actions {
@@ -163,6 +175,7 @@ pub fn generate_issues(
163175
eprintln!("Use `--commit` to execute the actions.");
164176
return Ok(());
165177
}
178+
166179
}
167180
}
168181

@@ -266,15 +279,33 @@ fn initialize_issues<'doc>(
266279
.map(|goal_document| issue(timeframe, goal_document))
267280
.collect::<anyhow::Result<_>>()?;
268281

269-
// Compare desired issues against existing issues
270-
let existing_issues = list_tracking_issues(repository)?;
282+
// the list of existing issues in the target milestone
283+
let milestone_issues = list_issues_in_milestone(repository, timeframe)?;
271284

272285
let mut actions = BTreeSet::new();
286+
287+
// Go through each of the issues we want to exist (derived from the goals defined in the target folder)
273288
for desired_issue in desired_issues {
274-
match existing_issues.iter().find(|issue| {
275-
let issue_id = IssueId::new(repository.clone(), issue.number);
276-
Some(&issue_id) == desired_issue.tracking_issue || issue.title == desired_issue.title
277-
}) {
289+
// Check if we already created a tracking issue...
290+
//
291+
let existing_issue = if let Some(tracking_issue) = desired_issue.tracking_issue {
292+
// a. We first check if there is a declared tracking issue in the markdown file.
293+
// If so, then we just load its information from the repository by number.
294+
Some(fetch_issue(repository, tracking_issue.number)?)
295+
} else {
296+
// b. If the markdown does not have a declared tracking issue, then we can search through
297+
// the issues in the milestone for one with the correct title.
298+
// We could also do a fresh GH query for an issue with the desired title
299+
// but that is slower.
300+
//
301+
// This addresses a kind of awkward gap in our handling-- when a new project goal
302+
// is created, we first create an issue for it, then do a loop and execute again.
303+
// This second time, we will find the issue with the known title, get its
304+
// number, and put that number into the markdown.
305+
milestone_issues.iter().find(|issue| issue.title == desired_issue.title).cloned()
306+
};
307+
308+
match existing_issue {
278309
Some(existing_issue) => {
279310
if existing_issue.assignees != desired_issue.assignees {
280311
actions.insert(GithubAction::SyncAssignees {
@@ -539,6 +570,8 @@ impl GithubAction<'_> {
539570
remove_owners,
540571
add_owners,
541572
} => {
573+
// NOTE: Swallow errors here because sometimes people are not present in the org.
574+
// We don't want to stop everything for that.
542575
sync_assignees(repository, number, &remove_owners, &add_owners)?;
543576
Ok(())
544577
}

crates/rust-project-goals/src/gh/issues.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub fn fetch_issue(repository: &Repository, issue: u64) -> anyhow::Result<Existi
112112
.arg("view")
113113
.arg(&format!("{issue}"))
114114
.arg("--json")
115-
.arg("title,assignees,number,comments,body,state,labels")
115+
.arg("title,assignees,number,comments,body,state,labels,milestone")
116116
.output()?;
117117

118118
let e_i: ExistingGithubIssueJson = serde_json::from_slice(&output.stdout)?;
@@ -127,10 +127,6 @@ pub fn list_issues_in_milestone(
127127
list_issues(repository, &[("-m", timeframe)])
128128
}
129129

130-
pub fn list_tracking_issues(repository: &Repository) -> anyhow::Result<Vec<ExistingGithubIssue>> {
131-
list_issues(repository, &[("-l", "C-tracking-issue")])
132-
}
133-
134130
pub fn list_issues(
135131
repository: &Repository,
136132
filter: &[(&str, &str)],
@@ -142,7 +138,9 @@ pub fn list_issues(
142138
.arg("issue")
143139
.arg("list")
144140
.arg("-s")
145-
.arg("all");
141+
.arg("all")
142+
.arg("-L")
143+
.arg("5000");
146144

147145
for (opt, val) in filter {
148146
cmd.arg(opt);

src/2025h1/all-hands.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Organize Rust All-Hands 2025
22

3-
| Metadata | |
4-
|:-----------------|----------------------|
5-
| Point of contact | @m-ou-se |
6-
| Teams | <!-- TEAMS WITH ASKS --> |
7-
| Task owners | <!-- TASK OWNERS --> |
8-
| Status | Proposed for flagship |
9-
| Zulip channel | N/A |
3+
| Metadata | |
4+
| :-- | :-- |
5+
| :----------------- | ---------------------- |
6+
| Point of contact | @m-ou-se |
7+
| Teams | <!-- TEAMS WITH ASKS --> |
8+
| Task owners | <!-- TASK OWNERS --> |
9+
| Status | Proposed for flagship |
10+
| Zulip channel | N/A |
11+
| Tracking issue | [rust-lang/rust-project-goals#263] |
1012

1113
## Summary
1214

@@ -129,4 +131,4 @@ Me too!
129131

130132
> There will be an unconference at the same venue that will host groups like the embedded working group, Rust for Linux, Bevy maintainers, UI/App developers, and a few other groups. That part is handled by RustNL as a mostly separate event, that just happens to take place in the same location.
131133
>
132-
> RustNL will of course share which groups that will be once they confirm, so we can coordinate potential collaboration with these groups. But from a organisation (and funding) perspective, we treat the all-hands and the unconference as mostly separate events, which is why I didn't include it in the project goal.
134+
> RustNL will of course share which groups that will be once they confirm, so we can coordinate potential collaboration with these groups. But from a organisation (and funding) perspective, we treat the all-hands and the unconference as mostly separate events, which is why I didn't include it in the project goal.

src/2025h1/arm-sve-sme.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# SVE and SME on AArch64
22

3-
| Metadata | |
4-
|:-----------------|-----------------------------|
5-
| Point of contact | @davidtwco |
6-
| Teams | <!-- TEAMS WITH ASKS --> |
7-
| Task owners | <!-- TASK OWNERS --> |
8-
| Status | Proposed |
9-
| Zulip channel | N/A |
3+
| Metadata | |
4+
| :-- | :-- |
5+
| :----------------- | ----------------------------- |
6+
| Point of contact | @davidtwco |
7+
| Teams | <!-- TEAMS WITH ASKS --> |
8+
| Task owners | <!-- TASK OWNERS --> |
9+
| Status | Proposed |
10+
| Zulip channel | N/A |
11+
| Tracking issue | [rust-lang/rust-project-goals#270] |
1012

1113
*Arm's Rust team is @davidtwco, @adamgemmell, @jacobbramley, @JamieCunliffe and @Jamesbarford, as
1214
well as @mrkajetanp and @harmou01 as graduates on rotation. This goal will be primarily worked on
@@ -186,4 +188,4 @@ Definitions for terms used above:
186188

187189
## Frequently asked questions
188190

189-
None yet.
191+
None yet.

src/2025h1/build-std.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# build-std
22

3-
| Metadata | |
4-
|:-----------------|------------------|
5-
| Point of contact | @davidtwco |
6-
| Teams | <!-- TEAMS WITH ASKS --> |
7-
| Task owners | <!-- TASK OWNERS --> |
8-
| Status | Proposed |
9-
| Zulip channel | N/A |
3+
| Metadata | |
4+
| :-- | :-- |
5+
| :----------------- | ------------------ |
6+
| Point of contact | @davidtwco |
7+
| Teams | <!-- TEAMS WITH ASKS --> |
8+
| Task owners | <!-- TASK OWNERS --> |
9+
| Status | Proposed |
10+
| Zulip channel | N/A |
11+
| Tracking issue | [rust-lang/rust-project-goals#274] |
1012

1113
*Arm's Rust team is @davidtwco, @adamgemmell, @jacobbramley, @JamieCunliffe and @Jamesbarford. This
1214
goal will be primarily worked on by @adamgemmell, but @davidtwco can always be contacted for
@@ -145,4 +147,4 @@ Definitions for terms used above:
145147

146148
## Frequently asked questions
147149

148-
None yet.
150+
None yet.

src/2025h1/cargo-plumbing.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Prototype a new set of Cargo "plumbing" commands
22

3-
| Metadata | |
4-
|:-----------------|-------------------------|
5-
| Point of contact | @epage |
6-
| Teams | <!-- TEAMS WITH ASKS --> |
7-
| Task owners | <!-- TASK OWNERS --> |
8-
| Status | Proposed for mentorship |
9-
| Zulip channel | N/A |
3+
| Metadata | |
4+
| :-- | :-- |
5+
| :----------------- | ------------------------- |
6+
| Point of contact | @epage |
7+
| Teams | <!-- TEAMS WITH ASKS --> |
8+
| Task owners | <!-- TASK OWNERS --> |
9+
| Status | Proposed for mentorship |
10+
| Zulip channel | N/A |
11+
| Tracking issue | [rust-lang/rust-project-goals#264] |
1012

1113
## Summary
1214

@@ -155,4 +157,4 @@ Definitions for terms used above:
155157
* Compiler [Major Change Proposal (MCP)](https://forge.rust-lang.org/compiler/mcp.html) is used to propose a 'larger than average' change and get feedback from the compiler team.
156158
* Library [API Change Proposal (ACP)](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html) describes a change to the standard library.
157159

158-
## Frequently asked questions
160+
## Frequently asked questions

src/2025h1/compiletest-directive-rework.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Making compiletest more maintainable: reworking directive handling
22

3-
| Metadata | |
4-
|:-----------------|-------------------------|
5-
| Point of contact | @jieyouxu |
6-
| Teams | <!-- TEAMS WITH ASKS --> |
7-
| Task owners | <!-- TASK OWNERS --> |
8-
| Status | Proposed |
9-
| Zulip channel | N/A |
3+
| Metadata | |
4+
| :-- | :-- |
5+
| :----------------- | ------------------------- |
6+
| Point of contact | @jieyouxu |
7+
| Teams | <!-- TEAMS WITH ASKS --> |
8+
| Task owners | <!-- TASK OWNERS --> |
9+
| Status | Proposed |
10+
| Zulip channel | N/A |
11+
| Tracking issue | [rust-lang/rust-project-goals#259] |
1012

1113
## Summary
1214

@@ -141,4 +143,4 @@ discussed and eventually should contain a complete summary of the points raised
141143
-->
142144

143145
[@jieyouxu]: https://github.com/jieyouxu
144-
[`compiletest`]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest
146+
[`compiletest`]: https://github.com/rust-lang/rust/tree/master/src/tools/compiletest

src/2025h1/eii.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Externally Implementable Items
22

3-
| Metadata | |
4-
|:-----------------|--------------------|
5-
| Point of contact | @m-ou-se |
6-
| Teams | <!-- TEAMS WITH ASKS --> |
7-
| Task owners | <!-- TASK OWNERS --> |
8-
| Status | Proposed |
9-
| Zulip channel | N/A |
3+
| Metadata | |
4+
| :-- | :-- |
5+
| :----------------- | -------------------- |
6+
| Point of contact | @m-ou-se |
7+
| Teams | <!-- TEAMS WITH ASKS --> |
8+
| Task owners | <!-- TASK OWNERS --> |
9+
| Status | Proposed |
10+
| Zulip channel | N/A |
11+
| Tracking issue | [rust-lang/rust-project-goals#254] |
1012

1113
## Summary
1214

@@ -117,4 +119,4 @@ The experimental feature we implement should:
117119

118120
## Frequently asked questions
119121

120-
- None yet.
122+
- None yet.

src/2025h1/improve-rustc-codegen.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
1111
-->
1212

13-
| Metadata | |
14-
|:-----------------|-------------|
15-
| Point of contact | @folkertdev |
16-
| Teams | <!-- TEAMS WITH ASKS --> |
17-
| Task owners | <!-- TASK OWNERS --> |
18-
| Status | Proposed |
19-
| Zulip channel | N/A |
13+
| Metadata | |
14+
| :-- | :-- |
15+
| :----------------- | ------------- |
16+
| Point of contact | @folkertdev |
17+
| Teams | <!-- TEAMS WITH ASKS --> |
18+
| Task owners | <!-- TASK OWNERS --> |
19+
| Status | Proposed |
20+
| Zulip channel | N/A |
21+
| Tracking issue | [rust-lang/rust-project-goals#258] |
2022

2123
## Summary
2224

@@ -119,4 +121,4 @@ None yet
119121
120122
*This is a good place to elaborate on your reasoning above -- for example, why did you put the design axioms in the order that you did? It's also a good place to put the answers to any questions that come up during discussion. The expectation is that this FAQ section will grow as the goal is discussed and eventually should contain a complete summary of the points raised along the way.*
121123
122-
-->
124+
-->

src/2025h1/libtest-json.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Finish the libtest json output experiment
22

3-
| Metadata | |
4-
|:-----------------|-----------------------------|
5-
| Point of contact | @epage |
6-
| Teams | <!-- TEAMS WITH ASKS --> |
7-
| Task owners | <!-- TASK OWNERS --> |
8-
| Status | Proposed |
9-
| Zulip channel | N/A |
3+
| Metadata | |
4+
| :-- | :-- |
5+
| :----------------- | ----------------------------- |
6+
| Point of contact | @epage |
7+
| Teams | <!-- TEAMS WITH ASKS --> |
8+
| Task owners | <!-- TASK OWNERS --> |
9+
| Status | Proposed |
10+
| Zulip channel | N/A |
11+
| Tracking issue | [rust-lang/rust-project-goals#255] |
1012

1113
## Summary
1214

@@ -89,4 +91,4 @@ Definitions for terms used above:
8991
* Compiler [Major Change Proposal (MCP)](https://forge.rust-lang.org/compiler/mcp.html) is used to propose a 'larger than average' change and get feedback from the compiler team.
9092
* Library [API Change Proposal (ACP)](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html) describes a change to the standard library.
9193

92-
## Frequently asked questions
94+
## Frequently asked questions

0 commit comments

Comments
 (0)