Skip to content
Merged
Show file tree
Hide file tree
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: 32 additions & 0 deletions pkgs/fleet/crates/fleet-queue/src/turso_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2404,6 +2404,34 @@ mod tests {
);
}

#[test]
fn completion_gate_slice_class_requires_evidence() {
// #12233 F2c: a feature_slice completion with no artifact is
// rejected, exactly like a fix — the gate is the actual
// completion path (verb_complete runs gate_completion before
// any mutation), not just the class mapping.
let slice = CompletionClass::Slice;
assert!(gate(&slice, &json!({})).is_err());
assert!(gate(&slice, &json!({"note": "did stuff"})).is_err());
assert!(gate(&slice, &json!({"evidence": ""})).is_err());
assert!(gate(&slice, &json!({"evidence": []})).is_err());
// Evidence of the delivered slice completes — and, unlike a
// fix, needs no verified disposition: the parent issue stays
// open while slices land, so an open parent with no
// disposition is not a rejection.
let evidence =
json!({"pr_url": "https://github.com/developing-today/code/pull/12570"});
assert!(gate(&slice, &evidence).is_ok());
assert!(
gate_with(&slice, Some(1062), false, &[], &evidence).is_ok(),
"an open parent issue must not block a slice completion"
);
assert!(
gate(&slice, &json!({"commit": "abc123"})).is_ok(),
"a commit is slice evidence too"
);
}

#[test]
fn completion_gate_rejects_disposition_for_another_issue() {
// #10611: the readback must describe the packet's issue — a
Expand Down Expand Up @@ -2999,6 +3027,10 @@ mod tests {
completion_class(&json!({"kind": "triage"})),
CompletionClass::Triage
);
assert_eq!(
completion_class(&json!({"kind": "feature_slice"})),
CompletionClass::Slice
);
assert_eq!(completion_class(&json!({})), CompletionClass::Ungated);
// Ungated completions never gate, whatever the result.
assert_eq!(gate(&CompletionClass::Ungated, &json!({})).unwrap(), None);
Expand Down
19 changes: 19 additions & 0 deletions pkgs/fleet/crates/fleet-queue/src/turso_queue/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,12 @@ pub(crate) enum CompletionClass {
/// Work that produces an artifact: completion requires an
/// evidence reference recorded on the task.
Fix,
/// A feature slice delivers one criterion of a larger issue
/// (#12233 F2c): completion requires evidence of the delivered
/// slice, but the parent issue stays open by design, so no
/// verified-disposition readback — that would demand closure
/// or a follow-up for work that is meant to continue.
Slice,
/// Triage annotates and validates; it never completes the
/// issue. Completion re-enqueues the follow-on by default.
Triage,
Expand All @@ -876,6 +882,7 @@ pub(crate) enum CompletionClass {
pub(crate) fn completion_class(payload: &Value) -> CompletionClass {
match payload.get("kind").and_then(|k| k.as_str()) {
Some("small_fix") | Some("ci_investigation") | Some("pr_shepherd") => CompletionClass::Fix,
Some("feature_slice") => CompletionClass::Slice,
Some("triage") => CompletionClass::Triage,
_ => CompletionClass::Ungated,
}
Expand Down Expand Up @@ -967,6 +974,18 @@ pub(crate) fn gate_completion(
verified(result, ctx)?;
Ok(None)
}
CompletionClass::Slice => {
// #12233 F2c: a slice completes on evidence of the
// delivered slice alone — no verified disposition, so
// the parent issue may stay open while slices land.
if evidence_ref(result).is_none() {
return Err("complete_task: feature_slice completion requires an evidence \
reference on the result (merged PR, commit, or \
verified-closure note); the task remains claimed"
.to_string());
}
Ok(None)
}
CompletionClass::Triage => {
let outcome = result
.get("triage_outcome")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
//! verdict is the claim-time staleness check's job, #10626).
//!
//! Only kinds that work one issue one way take part: small_fix,
//! triage, and pr_shepherd (per PR set). ci_investigation and
//! second_pass are recurring by design and file as before. A packet
//! triage, and pr_shepherd (per PR set). ci_investigation,
//! second_pass and feature_slice are recurring by design and file
//! as before — a feature_slice parent issue carries many slices in
//! parallel, one dedupe key per slice ordinal (#12233 F2c). A packet
//! may declare `dedupe_exempt: true` (a recurring kind) or
//! `dedupe_override: "<reason>"` (a deliberate parallel, recorded
//! as a `dedupe_override` event on the new task). A quarantined
Expand Down Expand Up @@ -200,7 +202,7 @@ mod tests {

#[test]
fn recurring_kinds_exempt_and_issueless_take_no_part() {
for kind in ["ci_investigation", "second_pass"] {
for kind in ["ci_investigation", "second_pass", "feature_slice"] {
let p = json!({"kind": kind, "repo": "developing-today/code", "issue": {"number": 5}});
assert!(work_identity(&task("queued", p)).is_none(), "{kind}");
}
Expand Down
Loading