| 1 | package jobs |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "reasonix/internal/evidence" |
| 7 | ) |
| 8 | |
| 9 | func TestTaskMutationEvidencePreservesPathsWithoutRisk(t *testing.T) { |
| 10 | summary := evidence.ChildEvidenceSummary{ |
| 11 | WorkspaceRoot: "/workspace/toolbox", |
| 12 | Receipts: []evidence.Receipt{{ |
| 13 | ToolName: "edit_file", |
| 14 | Success: true, |
| 15 | Write: true, |
| 16 | Mutation: true, |
| 17 | Paths: []string{"/workspace/toolbox/internal/agent/worker.go"}, |
| 18 | }}, |
| 19 | } |
| 20 | meta := mutationEvidenceForArtifact(summary) |
| 21 | if meta == nil || meta.Risk != "" || len(meta.Paths) != 1 || meta.Paths[0] != summary.Receipts[0].Paths[0] { |
| 22 | t.Fatalf("ordinary workspace mutation evidence = %+v, want paths without risk", meta) |
| 23 | } |
| 24 | |
| 25 | summary.Receipts[0].Paths = []string{"/workspace/toolbox/internal/auth/session.go"} |
| 26 | meta = mutationEvidenceForArtifact(summary) |
| 27 | if meta == nil || meta.Risk != "" || len(meta.Paths) != 1 || meta.Paths[0] != summary.Receipts[0].Paths[0] { |
| 28 | t.Fatalf("sensitive workspace mutation evidence = %+v, want paths without risk", meta) |
| 29 | } |
| 30 | } |
| 31 |