Watch
0
0
Fork
You've already forked hyperhive
0

closed flow also queues a closed todo on each agent that held one, after the clear

This commit is contained in:
atlas 2026-10-24 13:58:08 +02:00 • committed by mara
commit 0a1e4db0f4
4 changed files with 99 additions and 24 deletions

View file

@ -628,7 +628,10 @@ impl TodoSink {
/// - `assigned`: a newly assigned agent gets a todo for the issue or PR.
/// - `unassigned`: an agent taken off it gets that todo rewritten to say so.
/// Both write the same key, so the second replaces the first.
/// - `closed`: closing it clears every router todo the router queued for it.
/// - `closed`: closing it clears every router todo the router queued for it,
/// then tells each agent that held one with a `closed` todo. The clear is the
/// first child of the match and runs first: its prefix also covers the
/// `closed` key.
#[must_use]
pub fn builtins() -> Vec<Flow> {
let assignment_key = "forge:{repo}#{number}:assignment";
@ -658,21 +661,41 @@ pub fn builtins() -> Vec<Flow> {
.to_owned(),
},
),
chain(
"closed",
&["issues", "pull_request"],
"closed",
TodoSink {
to: Recipients::Field("todo_holders".to_owned()),
op: Op::Clear,
key: "forge:{repo}#{number}:".to_owned(),
prefix: true,
text: String::new(),
},
),
closed(),
]
}
/// The `closed` flow: the clear, then the todo that says why.
fn closed() -> Flow {
let mut flow = chain(
"closed",
&["issues", "pull_request"],
"closed",
TodoSink {
to: Recipients::Field("todo_holders".to_owned()),
op: Op::Clear,
key: "forge:{repo}#{number}:".to_owned(),
prefix: true,
text: String::new(),
},
);
flow.nodes.push(Node {
id: "inform".to_owned(),
kind: NodeKind::Todo(TodoSink {
to: Recipients::Field("todo_holders".to_owned()),
op: Op::Upsert,
key: "forge:{repo}#{number}:closed".to_owned(),
prefix: false,
text: "{kind} {repo}#{number} was closed: {title} ({url})".to_owned(),
}),
});
flow.edges.push(Edge {
from: "match".to_owned(),
to: "inform".to_owned(),
});
flow
}
/// source(`events`) → match(`action` = `action`) → `sink`.
fn chain(id: &str, events: &[&str], action: &str, sink: TodoSink) -> Flow {
let node = |id: &str, kind| Node {