- 1001
None, - 1002
&receipts, - 1003
false, - 1004
); - 1005
assert_eq!(reported, None); - 1006
} - 1007
- 1008
#[test] - 1009
fn test_direct_substantive_answer_not_blocked_for_inspection_spec() { - 1010
let p = StopPolicy::default(); - 1011
let mut reading = vak_intent::Reading::general(); - 1012
reading.act = vak_intent::Act::Locate; - 1013
let spec = vak_intent::OutcomeSpec::from_reading( - 1014
"explain the architectural differences", - 1015
&reading, - 1016
1, - 1017
); - 1018
let receipts = ReceiptSummary::default(); - 1019
- 1020
// Substantive direct analysis without false tool claims or execution demands -> allowed - 1021
let substantive_answer = "Optimistic locking assumes multiple transactions can complete without affecting each other. It verifies no other transaction has modified the data before committing. In contrast, pessimistic locking acquires locks immediately upon reading."; - 1022
let blocked = p.evaluate_receipts( - 1023
"explain the architectural differences", - 1024
substantive_answer, - 1025
Some(&spec), - 1026
&receipts, - 1027
false, - 1028
); - 1029
assert_eq!(blocked, None); - 1030
- 1031
// Empty or non-substantive answer -> blocked - 1032
let blocked_empty = p.evaluate_receipts( - 1033
"explain the architectural differences", - 1034
"Okay", - 1035
Some(&spec), - 1036
&receipts, - 1037
false, - 1038
); - 1039
assert!(matches!( - 1040
blocked_empty, - 1041
Some(BlockReason::ExecutionReceiptMissing { .. }) - 1042
)); - 1043
} - 1044
- 1045
#[test] - 1046
fn test_is_code_path_accurately_classifies_code_vs_doc_paths() { - 1047
assert!(is_code_path("src/main.rs")); - 1048
assert!(is_code_path("backend/app.py")); - 1049
assert!(is_code_path("web/index.ts")); - 1050
assert!(is_code_path("scripts/deploy.sh")); - 1051
- 1052
assert!(!is_code_path("README.md")); - 1053
assert!(!is_code_path("docs/architecture.md")); - 1054
assert!(!is_code_path("recipes/sourdough.txt")); - 1055
assert!(!is_code_path("data/analysis.csv")); - 1056
assert!(!is_code_path("notes.org")); - 1057
} - 1058
- 1059
#[test] - 1060
fn test_universal_doc_modification_with_verify_not_blocked_on_bash() { - 1061
let p = StopPolicy::default(); - 1062
let prompt = "Update README.md to describe the release steps and verify that all links are formatted correctly."; - 1063
let final_text = "Updated README.md with release steps and verified that the Markdown links match the repository structure."; - 1064
- 1065
let receipts = ReceiptSummary { - 1066
total_tool_calls: 2, - 1067
successful_tool_calls: 2, - 1068
files_modified: 1, - 1069
code_files_modified: 0, - 1070
doc_files_modified: 1, - 1071
read_or_inspected: 1, - 1072
..Default::default() - 1073
}; - 1074
- 1075
// Even though prompt says "verify that", since no code was modified and no code execution was demanded, - 1076
// it must NOT block on non-existent bash commands or stale verification! - 1077
let blocked = p.evaluate_receipts(prompt, final_text, None, &receipts, false); - 1078
assert_eq!(blocked, None); - 1079
- 1080
let blocked_stale = p.evaluate_receipts(prompt, final_text, None, &receipts, true); - 1081
assert_eq!(blocked_stale, None); - 1082
} - 1083
- 1084
#[test] - 1085
fn test_universal_research_and_lifestyle_with_verify_not_blocked() { - 1086
let p = StopPolicy::default(); - 1087
let prompt = - 1088
"Compare the top 3 pour-over drippers and verify that the brew ratios are accurate."; - 1089
let final_text = "Here is a detailed comparison of Hario V60, Kalita Wave, and Chemex. All brew ratios are verified between 1:15 and 1:17 for balanced extraction across light and medium roasts."; - 1090
- 1091
let receipts = ReceiptSummary { - 1092
total_tool_calls: 1, - 1093
successful_tool_calls: 1, - 1094
read_or_inspected: 1, - 1095
..Default::default() - 1096
}; - 1097
- 1098
let blocked = p.evaluate_receipts(prompt, final_text, None, &receipts, false); - 1099
assert_eq!(blocked, None); - 1100
} - 1101
- 1102
#[test] - 1103
fn test_code_modification_with_verify_blocked_without_execution() { - 1104
let p = StopPolicy::default(); - 1105
let prompt = - 1106
"Fix the off-by-one bug in quicksort.py and verify that the sort works correctly."; - 1107
let final_text = "I fixed the index in quicksort.py."; - 1108
- 1109
let receipts = ReceiptSummary { - 1110
total_tool_calls: 1, - 1111
successful_tool_calls: 1, - 1112
files_modified: 1, - 1113
code_files_modified: 1, - 1114
doc_files_modified: 0, - 1115
..Default::default() - 1116
}; - 1117
- 1118
// Code was modified and prompt asks to "verify that" -> must block with VerificationMissing - 1119
let blocked = p.evaluate_receipts(prompt, final_text, None, &receipts, false); - 1120
assert_eq!(blocked, Some(BlockReason::VerificationMissing)); - 1121
- 1122
// If code files were modified after test ran, stale verification blocks - 1123
let with_bash = ReceiptSummary { - 1124
total_tool_calls: 2, - 1125
successful_tool_calls: 2, - 1126
substantive_bash_calls: 1, - 1127
files_modified: 1, - 1128
code_files_modified: 1, - 1129
..Default::default() - 1130
}; - 1131
let blocked_stale = p.evaluate_receipts(prompt, final_text, None, &with_bash, true); - 1132
assert_eq!(blocked_stale, Some(BlockReason::VerificationStale)); - 1133
} - 1134
} - 1135
Indexing the workspace…
Vakyartha documentation is discovering safe artifacts, anchors, and source references.