assay-cli 8.0.0

Policy-as-code gate for MCP agent tool calls, with verifiable evidence and Linux kernel enforcement.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
use assert_cmd::Command;
use predicates::prelude::PredicateBooleanExt;
use predicates::str::contains;
use std::fs;
use tempfile::TempDir;

#[test]
fn test_coverage_min_threshold_failure() {
    let dir = TempDir::new().unwrap();
    let policy_path = dir.path().join("policy.yaml");
    let trace_path = dir.path().join("trace.jsonl");

    // Write policy
    fs::write(
        &policy_path,
        r#"
version: "1"
name: threshold_policy
tools:
    allow: [ToolA, ToolB]
"#,
    )
    .unwrap();

    // Trace only calls ToolA (50% coverage)
    fs::write(
        &trace_path,
        r#"
{"type": "call_tool", "tool": "ToolA", "test_id": "test1"}
"#,
    )
    .unwrap();

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--min-coverage")
        .arg("80") // Expect failure
        .assert()
        .failure()
        .stderr(contains("Minimum coverage not met"));
}

#[test]
fn test_coverage_min_threshold_success() {
    let dir = TempDir::new().unwrap();
    let policy_path = dir.path().join("policy.yaml");
    let trace_path = dir.path().join("trace.jsonl");

    fs::write(
        &policy_path,
        r#"
version: "1"
name: threshold_policy
tools:
    allow: [ToolA, ToolB]
"#,
    )
    .unwrap();

    // Trace calls both (100% coverage)
    fs::write(
        &trace_path,
        r#"
{"type": "call_tool", "tool": "ToolA", "test_id": "test1"}
{"type": "call_tool", "tool": "ToolB", "test_id": "test1"}
"#,
    )
    .unwrap();

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--min-coverage")
        .arg("80")
        .assert()
        .success();
}

#[test]
fn test_coverage_baseline_regression_failure() {
    let dir = TempDir::new().unwrap();
    let policy_path = dir.path().join("policy.yaml");
    let trace_full = dir.path().join("trace_full.jsonl");
    let trace_partial = dir.path().join("trace_partial.jsonl");
    let baseline_path = dir.path().join("baseline.json");

    fs::write(
        &policy_path,
        r#"
version: "1"
name: regression_policy
tools:
    allow: [ToolA, ToolB]
"#,
    )
    .unwrap();

    // 1. Generate Baseline (100% coverage)
    fs::write(
        &trace_full,
        r#"
{"type": "call_tool", "tool": "ToolA", "test_id": "test1"}
{"type": "call_tool", "tool": "ToolB", "test_id": "test1"}
"#,
    )
    .unwrap();

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_full)
        .arg("--export-baseline")
        .arg(&baseline_path)
        .assert()
        .success();

    // Verify baseline file exists and has content
    assert!(baseline_path.exists(), "Baseline file should exist");
    let content = fs::read_to_string(&baseline_path).unwrap();
    assert!(
        content.contains("\"metric\": \"overall\""),
        "Baseline should contain overall metric"
    );
    assert!(content.contains("100.0"), "Baseline score should be 100%");

    // 2. Run with Partial Trace (50% coverage) + Baseline Check
    fs::write(
        &trace_partial,
        r#"
{"type": "call_tool", "tool": "ToolA", "test_id": "test1"}
"#,
    )
    .unwrap();

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_partial)
        .arg("--baseline")
        .arg(&baseline_path)
        .assert()
        .failure()
        .stderr(contains("REGRESSION DETECTED"));
}

#[test]
fn test_coverage_baseline_no_regression() {
    let dir = TempDir::new().unwrap();
    let policy_path = dir.path().join("policy.yaml");
    let trace_path = dir.path().join("trace.jsonl");
    let baseline_path = dir.path().join("baseline.json");

    fs::write(
        &policy_path,
        r#"
version: "1"
name: stable_policy
tools:
    allow: [ToolA]
"#,
    )
    .unwrap();

    // 1. Generate Baseline
    fs::write(
        &trace_path,
        r#"
{"type": "call_tool", "tool": "ToolA", "test_id": "test1"}
"#,
    )
    .unwrap();

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--export-baseline")
        .arg(&baseline_path)
        .assert()
        .success();

    // 2. Diff against same baseline -> Should Pass
    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--baseline")
        .arg(&baseline_path)
        .assert()
        .success()
        .stderr(contains("No regression against baseline"));
}

#[test]
fn test_coverage_combined_failures() {
    let dir = TempDir::new().unwrap();
    let policy_path = dir.path().join("policy.yaml");
    let trace_full = dir.path().join("trace_full.jsonl");
    let trace_bad = dir.path().join("trace_bad.jsonl");
    let baseline_path = dir.path().join("baseline.json");

    fs::write(
        &policy_path,
        r#"
version: "1"
name: combined_policy
tools:
  allow: [SafeTool]
  deny: [CriticalTool]
"#,
    )
    .unwrap();

    // 1. Establish Good Baseline (100% Coverage, No Gaps)
    // Wait, deny check is separate. If trace has SafeTool, coverage is 100%. CriticalTool is Unseen in traces.
    // If High Risk Gap logic says "If DENY tool is UNSEEN, then FAIL", then we can never have a "Good" baseline if we don't test the DENY tool?
    // Wait, High Risk Gap means "You didn't verify that CriticalTool is blocked".
    // How do verify? We need a trace where CriticalTool call is ATTEMPTED.
    // Assay Core logic: `tools_called` vs policy.
    // If trace has: `{"type": "call_tool", "tool": "CriticalTool"}`.
    // Then `CoverageAnalyzer` sees it as `tools_seen`.
    // And if config/policy says it is DENY, it counts as "Seen" (so verified?), but maybe flagged as violation?
    // `HighRiskGap` definition: `tool` in `deny` AND `tool` NOT in `seen`.
    // So to avoid Gap, we MUST see it.

    // Let's create a trace where we attempt CriticalTool (so gap is closed), but that might be a violation?
    // Assay currently doesn't fail on violations in `coverage` report (logic is thresholding & gaps).
    // Violations are checked in `run/eval`.

    fs::write(
        &trace_full,
        r#"
{"type": "call_tool", "tool": "SafeTool", "test_id": "test1"}
{"type": "call_tool", "tool": "CriticalTool", "test_id": "test2"}
"#,
    )
    .unwrap();

    // Export baseline
    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_full)
        .arg("--export-baseline")
        .arg(&baseline_path)
        .assert()
        .failure();

    // 2. Bad Trace:
    // - SafeTool missing (Regression + Low Coverage)
    // - CriticalTool missing (High Risk Gap)
    fs::write(&trace_bad, "").unwrap(); // Empty trace -> 0 coverage, Gap

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path) // Needs policy to know DENY list
        .arg("--traces")
        .arg(&trace_bad)
        .arg("--baseline")
        .arg(&baseline_path) // Check regression
        .arg("--min-coverage")
        .arg("80") // Check threshold
        .assert()
        .failure()
        .stderr(contains("REGRESSION DETECTED"))
        .stderr(contains("High Risk Gaps Detected"))
        .stderr(contains("Minimum coverage not met"));
}

fn write_empty_policy(dir: &TempDir) -> std::path::PathBuf {
    let policy_path = dir.path().join("empty_policy.yaml");
    fs::write(
        &policy_path,
        r#"
version: "1"
name: empty_policy
tools: {}
"#,
    )
    .unwrap();
    policy_path
}

fn write_tools_only_policy(dir: &TempDir) -> std::path::PathBuf {
    let policy_path = dir.path().join("policy.yaml");
    fs::write(
        &policy_path,
        r#"
version: "1"
name: tools_only_policy
tools:
    allow: [ToolA, ToolB]
"#,
    )
    .unwrap();
    policy_path
}

fn write_full_trace(dir: &TempDir, name: &str) -> std::path::PathBuf {
    let trace_path = dir.path().join(name);
    fs::write(
        &trace_path,
        r#"
{"type": "call_tool", "tool": "ToolA", "test_id": "test1"}
{"type": "call_tool", "tool": "ToolB", "test_id": "test1"}
"#,
    )
    .unwrap();
    trace_path
}

/// Matrix row 5 through the CLI: a policy declaring no tools and no sequence
/// rules refuses the threshold at the default 0.0 with a stated reason.
#[test]
fn test_coverage_empty_policy_refuses_threshold_zero() {
    let dir = TempDir::new().unwrap();
    let policy_path = write_empty_policy(&dir);
    let trace_path = dir.path().join("trace.jsonl");
    fs::write(
        &trace_path,
        r#"
{"type": "episode_end", "test_id": "test1"}
"#,
    )
    .unwrap();

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--format")
        .arg("text")
        .assert()
        .failure()
        .stderr(contains(
            "Coverage not applicable: policy declares no tools and no rules",
        ));
}

/// Matrix row 6: exporting from a fully covered tools-only policy keeps all
/// three entries, with the n/a rule dimension scoring 0 and marked not_applicable.
#[test]
fn test_coverage_export_marks_empty_rule_dimension_not_applicable() {
    let dir = TempDir::new().unwrap();
    let policy_path = write_tools_only_policy(&dir);
    let trace_path = write_full_trace(&dir, "trace_full.jsonl");
    let baseline_path = dir.path().join("baseline.json");

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--export-baseline")
        .arg(&baseline_path)
        .assert()
        .success();

    let content = fs::read_to_string(&baseline_path).unwrap();
    let baseline: serde_json::Value = serde_json::from_str(&content).unwrap();
    let entries = baseline["entries"].as_array().unwrap();
    assert_eq!(entries.len(), 3, "export keeps all three entries");
    for entry in entries {
        let metric = entry["metric"].as_str().unwrap();
        let score = entry["score"].as_f64().unwrap();
        let exercised = entry.get("meta").and_then(|m| m.get("exercised"));
        match metric {
            "overall" => {
                assert_eq!(score, 100.0);
                assert!(exercised.is_none());
            }
            "tool" => {
                assert_eq!(score, 100.0);
                assert!(exercised.is_none());
            }
            "rule" => {
                assert_eq!(score, 0.0);
                assert_eq!(exercised.and_then(|v| v.as_str()), Some("not_applicable"));
            }
            other => panic!("unexpected metric {other}"),
        }
    }
}

fn write_baseline(dir: &TempDir, suite: &str, entries: &serde_json::Value) -> std::path::PathBuf {
    let baseline_path = dir.path().join("baseline.json");
    let baseline = serde_json::json!({
        "schema_version": 1,
        "suite": suite,
        "assay_version": "test",
        "created_at": "2026-01-01T00:00:00Z",
        "config_fingerprint": "fp",
        "entries": entries,
    });
    fs::write(
        &baseline_path,
        serde_json::to_string_pretty(&baseline).unwrap(),
    )
    .unwrap();
    baseline_path
}

fn applicable_entry(metric: &str, score: f64) -> serde_json::Value {
    serde_json::json!({"test_id": "coverage", "metric": metric, "score": score})
}

fn not_applicable_entry(metric: &str, score: f64) -> serde_json::Value {
    serde_json::json!({
        "test_id": "coverage",
        "metric": metric,
        "score": score,
        "meta": {"exercised": "not_applicable"},
    })
}

/// Matrix row 7: an old baseline (empty dimension recorded as 100, no meta)
/// compared against the corrected run prints one REGRESSION line with the
/// re-export hint and exits 1. The accepted one-time migration cost.
#[test]
fn test_coverage_compare_against_old_baseline_regresses_on_rule() {
    let dir = TempDir::new().unwrap();
    let policy_path = write_tools_only_policy(&dir);
    let trace_path = write_full_trace(&dir, "trace_full.jsonl");
    let baseline_path = write_baseline(
        &dir,
        "policy",
        &serde_json::json!([
            applicable_entry("overall", 100.0),
            applicable_entry("tool", 100.0),
            applicable_entry("rule", 100.0),
        ]),
    );

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--baseline")
        .arg(&baseline_path)
        .assert()
        .failure()
        .stderr(contains("REGRESSION DETECTED"))
        .stderr(contains(
            "'rule' is not applicable in the current policy (0 rules declared)",
        ))
        .stderr(contains("Re-export with --export-baseline if intentional"));
}

/// Matrix row 8: a formerly applicable rule dimension that disappears reads as
/// a regression (60 -> 0) with the not-applicable sentence, never silently clean.
#[test]
fn test_coverage_applicable_to_not_applicable_is_a_failing_compare() {
    let dir = TempDir::new().unwrap();
    let policy_path = write_tools_only_policy(&dir);
    let trace_path = write_full_trace(&dir, "trace_full.jsonl");
    let baseline_path = write_baseline(
        &dir,
        "policy",
        &serde_json::json!([
            applicable_entry("overall", 80.0),
            applicable_entry("tool", 100.0),
            applicable_entry("rule", 60.0),
        ]),
    );

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--baseline")
        .arg(&baseline_path)
        .assert()
        .failure()
        .stderr(contains("REGRESSION DETECTED"))
        .stderr(contains("60.00"))
        .stderr(contains(
            "'rule' is not applicable in the current policy (0 rules declared)",
        ));
}

/// Matrix row 9: a baseline entry recorded as not_applicable that becomes
/// applicable again is announced as newly applicable, not as improved coverage.
///
/// (The CLI never populates rule ids from traces, so an end-to-end rule
/// transition cannot be produced here; the tool direction exercises the same
/// diff-loop branch.)
#[test]
fn test_coverage_not_applicable_to_applicable_is_announced() {
    let dir = TempDir::new().unwrap();
    let policy_path = write_tools_only_policy(&dir);
    let trace_path = write_full_trace(&dir, "trace_full.jsonl");
    let baseline_path = write_baseline(
        &dir,
        "policy",
        &serde_json::json!([
            not_applicable_entry("overall", 0.0),
            not_applicable_entry("tool", 0.0),
            not_applicable_entry("rule", 0.0),
        ]),
    );

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--baseline")
        .arg(&baseline_path)
        .assert()
        .success()
        .stderr(contains("newly applicable"));
}

/// Matrix row 10: exporting from an empty policy writes all three entries as
/// 0 / not_applicable, and the run itself still exits 1.
#[test]
fn test_coverage_export_from_empty_policy_marks_all_not_applicable() {
    let dir = TempDir::new().unwrap();
    let policy_path = write_empty_policy(&dir);
    let trace_path = dir.path().join("trace.jsonl");
    fs::write(
        &trace_path,
        r#"
{"type": "episode_end", "test_id": "test1"}
"#,
    )
    .unwrap();
    let baseline_path = dir.path().join("baseline.json");

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--export-baseline")
        .arg(&baseline_path)
        .assert()
        .failure();

    let content = fs::read_to_string(&baseline_path).unwrap();
    let baseline: serde_json::Value = serde_json::from_str(&content).unwrap();
    let entries = baseline["entries"].as_array().unwrap();
    assert_eq!(entries.len(), 3);
    for entry in entries {
        assert_eq!(entry["score"].as_f64().unwrap(), 0.0);
        assert_eq!(
            entry["meta"]["exercised"].as_str(),
            Some("not_applicable"),
            "metric {} must be marked not_applicable",
            entry["metric"],
        );
    }
}

/// Matrix row 8b (#3165 follow-up): the producer's real zero. A CLI-exported
/// baseline from a policy with sequence rules records rule 0.0 with meta
/// absent. The CLI measures triggered rules (#3181), so the zero here comes
/// from a rule that genuinely never triggers: a `before` rule whose `then`
/// never appears. Dropping the sequences leaves rule at 0.0 with meta
/// not_applicable; the scores are equal, so Baseline::diff reports
/// nothing, but the run must still fail with the not-applicable sentence
/// instead of going silently clean.
#[test]
fn test_coverage_sequence_removal_with_zero_baseline_is_a_failing_compare() {
    let dir = TempDir::new().unwrap();
    let seq_policy_path = dir.path().join("seq_policy.yaml");
    fs::write(
        &seq_policy_path,
        r#"
version: "1"
name: seq_policy
tools:
    allow: [ToolA, ToolB]
sequences:
    - type: before
      first: ToolA
      then: ToolC
"#,
    )
    .unwrap();
    let trace_path = write_full_trace(&dir, "trace_full.jsonl");
    let baseline_path = dir.path().join("baseline.json");

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&seq_policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--export-baseline")
        .arg(&baseline_path)
        .assert()
        .success();

    // The producer's real value: applicable rule dimension scoring 0.0 with
    // meta absent (not a hand-written 60.0).
    let content = fs::read_to_string(&baseline_path).unwrap();
    let baseline: serde_json::Value = serde_json::from_str(&content).unwrap();
    let entries = baseline["entries"].as_array().unwrap();
    let rule = entries
        .iter()
        .find(|e| e["metric"] == "rule")
        .expect("baseline keeps a rule entry");
    assert_eq!(rule["score"].as_f64().unwrap(), 0.0);
    assert!(
        rule.get("meta").is_none(),
        "CLI-exported applicable rule entry carries no meta, got {rule}"
    );

    // Drop the sequences: rule becomes not applicable at the same 0.0 score.
    let policy_path = write_tools_only_policy(&dir);

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .arg("--baseline")
        .arg(&baseline_path)
        .assert()
        .failure()
        .stderr(contains("REGRESSION DETECTED"))
        .stderr(contains(
            "'rule' is not applicable in the current policy (0 rules declared)",
        ))
        .stderr(contains("Re-export with --export-baseline if intentional"))
        .stderr(contains("No regression against baseline").not());
}

#[test]
fn test_coverage_high_risk_gap_failure() {
    let dir = TempDir::new().unwrap();
    let policy_path = dir.path().join("policy.yaml");
    let trace_path = dir.path().join("trace.jsonl");

    fs::write(
        &policy_path,
        r#"
version: "1"
name: strict_policy
tools:
  allow: [SafeTool]
  deny: [CriticalTool]
"#,
    )
    .unwrap();

    // Trace only safe tool -> CriticalTool is UNSEEN -> High Risk Gap
    fs::write(
        &trace_path,
        r#"
{"type": "call_tool", "tool": "SafeTool", "test_id": "test1"}
"#,
    )
    .unwrap();

    let mut cmd = Command::new(env!("CARGO_BIN_EXE_assay"));
    cmd.arg("coverage")
        .arg("--policy")
        .arg(&policy_path)
        .arg("--traces")
        .arg(&trace_path)
        .assert()
        .failure()
        .stderr(contains("High Risk Gaps Detected"));
}