Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,20 +125,21 @@ fn gate_envelope(input: &str) -> Result<String, String> {
let added = parse_added_lines(&req.diff);
// Union base checkpoint names from both the repo and global base registries, mirroring the
// native CLI (`local_base.union(&global_base)`). `None` only when neither was supplied.
let base_names: Option<Vec<String>> = match (&req.base_repo_registry_yaml, &req.base_global_registry_yaml)
{
(None, None) => None,
(repo, global) => {
let mut names: std::collections::BTreeSet<String> = std::collections::BTreeSet::new();
if let Some(y) = repo {
names.extend(extract_checkpoint_names(y));
}
if let Some(y) = global {
names.extend(extract_checkpoint_names(y));
let base_names: Option<Vec<String>> =
match (&req.base_repo_registry_yaml, &req.base_global_registry_yaml) {
(None, None) => None,
(repo, global) => {
let mut names: std::collections::BTreeSet<String> =
std::collections::BTreeSet::new();
if let Some(y) = repo {
names.extend(extract_checkpoint_names(y));
}
if let Some(y) = global {
names.extend(extract_checkpoint_names(y));
}
Some(names.into_iter().collect())
}
Some(names.into_iter().collect())
}
};
};

let fired = detect(&compiled, &files, &added, base_names.as_deref());
let acks = extract_acks(&req.commit_msg);
Expand Down Expand Up @@ -628,6 +629,9 @@ checkpoints:
.any(|f| f["name"] == "guard-removed"),
"checkpoint_removed guard should fire on a global-base removal: {body}"
);
assert_eq!(body["exit_class"], 2, "an unacked removed-checkpoint blocks");
assert_eq!(
body["exit_class"], 2,
"an unacked removed-checkpoint blocks"
);
}
}
Loading