- 2267
// Progress and tool chatter are the noise; the answer itself - 2268
// is the thing that was waited for. - 2269
DeliveryKind::Progress | DeliveryKind::ToolResult | DeliveryKind::ToolCall => { - 2270
Disposition::HoldUntilComplete - 2271
} - 2272
_ => Disposition::Send, - 2273
}, - 2274
Cadence::Digest => match kind { - 2275
DeliveryKind::Alert => Disposition::Send, - 2276
_ => Disposition::HoldForDigest, - 2277
}, - 2278
} - 2279
} - 2280
} - 2281
- 2282
/// Deliveries that stop a run until somebody answers. Never batched. - 2283
fn needs_a_person_now(kind: DeliveryKind) -> bool { - 2284
matches!(kind, DeliveryKind::Approval) - 2285
} - 2286
- 2287
#[cfg(test)] - 2288
mod posture_tests { - 2289
use super::*; - 2290
- 2291
fn posture(cadence: Cadence, urgency: Urgency) -> DeliveryPosture { - 2292
DeliveryPosture { cadence, urgency } - 2293
} - 2294
- 2295
#[test] - 2296
fn intent_labels_map_to_delivery_posture() { - 2297
assert_eq!( - 2298
DeliveryPosture::from_intent_labels("on-completion", "quiet"), - 2299
posture(Cadence::OnCompletion, Urgency::Quiet) - 2300
); - 2301
assert_eq!( - 2302
DeliveryPosture::from_intent_labels("unknown", "unknown"), - 2303
DeliveryPosture::default() - 2304
); - 2305
} - 2306
- 2307
/// The behaviour this exists for: overnight work sends a roll-up, not a - 2308
/// stream of progress nobody is awake to read. - 2309
#[test] - 2310
fn an_unattended_run_holds_its_chatter_for_the_digest() { - 2311
let quiet = posture(Cadence::Digest, Urgency::Quiet); - 2312
assert_eq!( - 2313
quiet.disposition(DeliveryKind::Progress), - 2314
Disposition::HoldForDigest - 2315
); - 2316
assert_eq!( - 2317
quiet.disposition(DeliveryKind::Assistant), - 2318
Disposition::HoldForDigest - 2319
); - 2320
} - 2321
- 2322
/// A held approval gate is a stopped run. Batching it would turn a - 2323
/// question into a hang, so it always goes out. - 2324
#[test] - 2325
fn an_approval_always_goes_out_whatever_the_cadence() { - 2326
for cadence in [Cadence::Live, Cadence::OnCompletion, Cadence::Digest] { - 2327
for urgency in [Urgency::Interrupt, Urgency::Notify, Urgency::Quiet] { - 2328
assert_eq!( - 2329
posture(cadence, urgency).disposition(DeliveryKind::Approval), - 2330
Disposition::Send, - 2331
"{cadence:?}/{urgency:?} batched an approval" - 2332
); - 2333
} - 2334
} - 2335
} - 2336
- 2337
/// An irreversible step's confirmation must not wait until morning. - 2338
#[test] - 2339
fn interrupt_urgency_overrides_every_cadence() { - 2340
let urgent = posture(Cadence::Digest, Urgency::Interrupt); - 2341
assert_eq!( - 2342
urgent.disposition(DeliveryKind::Assistant), - 2343
Disposition::Send - 2344
); - 2345
assert_eq!( - 2346
urgent.disposition(DeliveryKind::Progress), - 2347
Disposition::Send - 2348
); - 2349
} - 2350
- 2351
/// Alerts are already the exception path; a digest must not swallow one. - 2352
#[test] - 2353
fn an_alert_is_never_held_for_a_digest() { - 2354
assert_eq!( - 2355
posture(Cadence::Digest, Urgency::Quiet).disposition(DeliveryKind::Alert), - 2356
Disposition::Send - 2357
); - 2358
} - 2359
- 2360
/// On-completion holds the chatter and sends the answer. - 2361
#[test] - 2362
fn on_completion_holds_progress_but_not_the_result() { - 2363
let posture = posture(Cadence::OnCompletion, Urgency::Notify); - 2364
assert_eq!( - 2365
posture.disposition(DeliveryKind::Progress), - 2366
Disposition::HoldUntilComplete - 2367
); - 2368
assert_eq!( - 2369
posture.disposition(DeliveryKind::Assistant), - 2370
Disposition::Send - 2371
); - 2372
} - 2373
- 2374
/// The default reproduces the behaviour before any of this existed. - 2375
#[test] - 2376
fn the_default_posture_sends_everything() { - 2377
let default = DeliveryPosture::default(); - 2378
for kind in [ - 2379
DeliveryKind::Assistant, - 2380
DeliveryKind::Progress, - 2381
DeliveryKind::Alert, - 2382
DeliveryKind::Approval, - 2383
DeliveryKind::ToolResult, - 2384
] { - 2385
assert_eq!(default.disposition(kind), Disposition::Send); - 2386
} - 2387
} - 2388
} - 2389
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.