[team] Review fixes: a deployment ticket and a MAC on target.request, an unknown author is unsatisfiable under others, a signed request cannot be refused afterwards; TEAM.md limits; v0.18.1

This commit is contained in:
2026-11-17 12:44:54 +01:00
parent f95c768bfa
commit 98d56f4673
10 changed files with 167 additions and 26 deletions
+14 -5
View File
@@ -58,6 +58,12 @@ fn expected(n: usize, env: &str, author_is_member: bool, set: &[String]) -> Verd
}
"production" => {
// "1 by someone other than the release author when the team has 2+ members"
// ... and the rule must know the author: someone no member is (or nobody named) cannot be excluded.
if n >= 2 && !author_is_member {
return Verdict::Unsatisfiable(
"the release's author is not a member the team knows, so the rule cannot exclude them",
);
}
let author_excluded = n >= 2 && author_is_member;
let counted = distinct.iter().filter(|m| !(author_excluded && m.as_str() == id(0))).count();
if counted >= 1 { Verdict::Allowed(KeyRole::Release) } else { Verdict::Need(1) }
@@ -125,11 +131,14 @@ fn several_approvals_others_and_approver_lists() {
evaluate(&p, &three, "production", "mnovak", &[id(1), id(2)]).verdict,
Verdict::Allowed(KeyRole::Release)
);
// Someone not named as the author (a release by a non-member): every member counts.
assert_eq!(
evaluate(&p, &three, "production", "stranger", &[id(0), id(1)]).verdict,
Verdict::Allowed(KeyRole::Release)
);
// Someone no member is, or nobody named: the rule cannot exclude the author, so it refuses (core 0.18.1).
for author in ["stranger", ""] {
assert!(matches!(
evaluate(&p, &three, "production", author, &[id(0), id(1)]).verdict,
Verdict::Unsatisfiable(_)
));
assert!(matches!(may_approve(&p, &three, "production", author, &id(1)), Err(TeamError::NotEligible(_))));
}
// Only member 1 may approve staging.
p.set_rule(EnvRule { env: "staging".into(), approvals: 1, others: false, approvers: vec![id(1)] }).unwrap();