manager: Mark completion using a label
All checks were successful
/ build (push) Successful in 1m7s

Don't use the open/close state of the issues to mark their completion.
This has friction with dependencies, because you can only add
dependencies on open issues.

Instead, issues are marked as completed using a "Completed" label now.
This commit is contained in:
Rahix 2025-05-23 00:44:36 +02:00
parent 8ae5ff6b81
commit b484256246
2 changed files with 14 additions and 11 deletions

View file

@ -127,7 +127,7 @@ The status of each element is determined as follows:
- **MISSING** when the element has not yet been achieved. - **MISSING** when the element has not yet been achieved.
- **ASSIGNED** when the issue has been assigned to someone. This means we are making progress! - **ASSIGNED** when the issue has been assigned to someone. This means we are making progress!
- **COMPLETED** when the issue gets closed. Achievement unlocked! - **COMPLETED** when the issue is labelled `Completed`. Achievement unlocked!
#### Important notes #### Important notes
There are a few gotchas that you should be aware of: There are a few gotchas that you should be aware of:
@ -136,10 +136,5 @@ There are a few gotchas that you should be aware of:
unfortunately. You can force a trigger by editing the issue body or quickly unfortunately. You can force a trigger by editing the issue body or quickly
adding and then removing the `Stale` label. adding and then removing the `Stale` label.
- You cannot add dependencies on closed issues via the Forgejo interface. To
model such dependencies, temporarily reopen the dependency issue and close it
again after adding the relationship.
- Issues that should no longer be a part of the techtree should either be - Issues that should no longer be a part of the techtree should either be
deleted (looses all tracking) or they can be made inert by removing the deleted (looses all tracking) or they can be made inert by closing them.
`Type/###` label.

View file

@ -77,10 +77,12 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
.context("Issue is missing a title")? .context("Issue is missing a title")?
.to_owned(); .to_owned();
let ty_labels: Vec<_> = issue let labels = issue
.labels .labels
.as_ref() .as_ref()
.context("Issue does not have any labels")? .context("Issue does not have any labels")?;
let ty_labels: Vec<_> = labels
.iter() .iter()
.filter_map(|l| l.name.as_deref()) .filter_map(|l| l.name.as_deref())
.filter(|l| l.starts_with("Type/")) .filter(|l| l.starts_with("Type/"))
@ -100,9 +102,15 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
.unwrap() .unwrap()
.to_owned(); .to_owned();
let has_completed_label = labels
.iter()
.any(|l| l.name.as_deref() == Some("Completed"));
let status = match issue.state.context("Missing issue state")? { let status = match issue.state.context("Missing issue state")? {
forgejo_api::structs::StateType::Open => { forgejo_api::structs::StateType::Open => {
if issue.assignee.is_some() if has_completed_label {
crate::tree::ElementStatus::Completed
} else if issue.assignee.is_some()
|| issue || issue
.assignees .assignees
.as_ref() .as_ref()
@ -114,7 +122,7 @@ fn element_from_issue(issue: &forgejo_api::structs::Issue) -> anyhow::Result<cra
crate::tree::ElementStatus::Missing crate::tree::ElementStatus::Missing
} }
} }
forgejo_api::structs::StateType::Closed => crate::tree::ElementStatus::Completed, forgejo_api::structs::StateType::Closed => anyhow::bail!("Ignoring closed issue!"),
}; };
Ok(crate::tree::Element { Ok(crate::tree::Element {