TestDiffCoverageGapNotMismatch: a foreign-secret read with NO contract for its scope is an honest coverage gap, never a mismatch -- the load-bearing honesty rule that keeps unattributed effects from reading as rogue actions.
(t *testing.T)
| 78 | // scope is an honest coverage gap, never a mismatch -- the load-bearing honesty |
| 79 | // rule that keeps unattributed effects from reading as rogue actions. |
| 80 | func TestDiffCoverageGapNotMismatch(t *testing.T) { |
| 81 | effects := []RuntimeEffect{ |
| 82 | {Kind: EffectSecretRead, Target: "/root/.aws/credentials", AgentID: "", ToolCallID: "tc-wrapper", EventID: "e7", Confidence: 1}, |
| 83 | } |
| 84 | diffs := Diff(nil, effects) |
| 85 | if _, ok := findDiff(diffs, func(d IntentRuntimeDiff) bool { return d.Status == StatusMismatch }); ok { |
| 86 | t.Fatal("uncontracted effect must NOT be reported as a mismatch") |
| 87 | } |
| 88 | d, ok := findDiff(diffs, func(d IntentRuntimeDiff) bool { return d.Status == StatusCoverageGap }) |
| 89 | if !ok { |
| 90 | t.Fatalf("expected intent_coverage_gap, got %+v", diffs) |
| 91 | } |
| 92 | if d.Confidence != 0 { |
| 93 | t.Errorf("a coverage gap asserts nothing; confidence should be 0, got %.2f", d.Confidence) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | // TestDiffBenignReadNoMismatch: a read-only file tool that only reads a benign |
| 98 | // (non-secret) file matches its contract -- no false positive. |