Watch
0
0
Fork
You've already forked hyperhive
0

review classifier: it reads the PR's title and description, and a rule on closing keywords

The controller reads the PR's title and description with the rest of it and
puts both in the run's shared context, ahead of the commits. An empty
description reads as `(none)`. `TryOut` carries them as optional fields, so a
controller that sends none still gets its run answered.

New rule `closes-only-finished-issues`: a description that carries a closing
keyword for an issue and also says the PR leaves part of it undone is a
violation, because the keyword closes the issue when the PR merges.
This commit is contained in:
argus 2026-11-23 00:49:11 +01:00 • committed by mara
commit 8a0615ccfc

View file

@ -84,6 +84,13 @@ pub struct TryOut {
pub pr: u64,
/// The commit the commits and the diff were read at.
pub head_sha: String,
/// The PR's title. Empty from a controller that sends none.
#[serde(default)]
pub title: String,
/// The PR's description, as its author wrote it. Empty when it has none,
/// and from a controller that sends none.
#[serde(default)]
pub description: String,
/// Oldest first.
pub commits: Vec<Commit>,
/// The PR's unified diff from its merge base to its head.
@ -287,14 +294,22 @@ mod tests {
let run: TryOut = serde_json::from_value(request.clone()).expect("decodes");
assert_eq!((run.model.as_str(), run.effort), (DEFAULT_MODEL, None));
assert_eq!(run.runtime, Runtime::ApiKey);
// An older controller sends no title or description either.
assert_eq!((run.title.as_str(), run.description.as_str()), ("", ""));
// Control: a named model and effort are the ones used.
request["model"] = "sonnet".into();
request["effort"] = "high".into();
request["title"] = "nix: a thing".into();
request["description"] = "Adds a thing.".into();
let run: TryOut = serde_json::from_value(request).expect("decodes");
assert_eq!(
(run.model.as_str(), run.effort),
("sonnet", Some(Effort::High))
);
assert_eq!(
(run.title.as_str(), run.description.as_str()),
("nix: a thing", "Adds a thing.")
);
}
#[test]