@@ -218,6 +218,50 @@ else
218218 fail " Write validator round-3-contract.md" " exit 2 with round error" " exit $EXIT_CODE , output: $RESULT "
219219fi
220220
221+ WINDOWS_LOOP_DIR=" ${LOOP_DIR// \/ / \\ } "
222+
223+ # Test 11c: Write validator blocks stale summary with Windows separators
224+ echo " Test 11c: Write validator blocks Windows-path round-3-summary.md"
225+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ round-3-summary.md"
226+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Write", tool_input: {file_path: $file_path}}' )
227+ set +e
228+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-write-validator.sh" 2>&1 )
229+ EXIT_CODE=$?
230+ set -e
231+ if [[ $EXIT_CODE -eq 2 ]] && echo " $RESULT " | grep -qi " round" ; then
232+ pass " Write validator blocks Windows-path round-3-summary.md"
233+ else
234+ fail " Write validator Windows-path round-3-summary.md" " exit 2 with round error" " exit $EXIT_CODE , output: $RESULT "
235+ fi
236+
237+ # Test 11d: Write validator allows current summary with Windows separators
238+ echo " Test 11d: Write validator allows Windows-path round-5-summary.md"
239+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ round-5-summary.md"
240+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Write", tool_input: {file_path: $file_path}}' )
241+ set +e
242+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-write-validator.sh" 2>&1 )
243+ EXIT_CODE=$?
244+ set -e
245+ if [[ $EXIT_CODE -eq 0 ]]; then
246+ pass " Write validator allows Windows-path round-5-summary.md"
247+ else
248+ fail " Write validator Windows-path round-5-summary.md" " exit 0" " exit $EXIT_CODE , output: $RESULT "
249+ fi
250+
251+ # Test 11e: Write validator blocks plan.md backup with Windows separators
252+ echo " Test 11e: Write validator blocks Windows-path plan.md backup"
253+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ plan.md"
254+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Write", tool_input: {file_path: $file_path}}' )
255+ set +e
256+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-write-validator.sh" 2>&1 )
257+ EXIT_CODE=$?
258+ set -e
259+ if [[ $EXIT_CODE -eq 2 ]] && echo " $RESULT " | grep -qi " plan" ; then
260+ pass " Write validator blocks Windows-path plan.md backup"
261+ else
262+ fail " Write validator Windows-path plan.md backup" " exit 2 with plan error" " exit $EXIT_CODE , output: $RESULT "
263+ fi
264+
221265echo " "
222266echo " === Test: Edit Validator Allowlist ==="
223267echo " "
@@ -274,6 +318,48 @@ else
274318 fail " Edit validator round-0-contract.md" " exit 2 with round error" " exit $EXIT_CODE , output: $RESULT "
275319fi
276320
321+ # Test 13d: Edit validator blocks stale summary with Windows separators
322+ echo " Test 13d: Edit validator blocks Windows-path round-3-summary.md"
323+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ round-3-summary.md"
324+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Edit", tool_input: {file_path: $file_path}}' )
325+ set +e
326+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-edit-validator.sh" 2>&1 )
327+ EXIT_CODE=$?
328+ set -e
329+ if [[ $EXIT_CODE -eq 2 ]] && echo " $RESULT " | grep -qi " round" ; then
330+ pass " Edit validator blocks Windows-path round-3-summary.md"
331+ else
332+ fail " Edit validator Windows-path round-3-summary.md" " exit 2 with round error" " exit $EXIT_CODE , output: $RESULT "
333+ fi
334+
335+ # Test 13e: Edit validator allows current summary with Windows separators
336+ echo " Test 13e: Edit validator allows Windows-path round-5-summary.md"
337+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ round-5-summary.md"
338+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Edit", tool_input: {file_path: $file_path}}' )
339+ set +e
340+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-edit-validator.sh" 2>&1 )
341+ EXIT_CODE=$?
342+ set -e
343+ if [[ $EXIT_CODE -eq 0 ]]; then
344+ pass " Edit validator allows Windows-path round-5-summary.md"
345+ else
346+ fail " Edit validator Windows-path round-5-summary.md" " exit 0" " exit $EXIT_CODE , output: $RESULT "
347+ fi
348+
349+ # Test 13f: Edit validator blocks plan.md backup with Windows separators
350+ echo " Test 13f: Edit validator blocks Windows-path plan.md backup"
351+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ plan.md"
352+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Edit", tool_input: {file_path: $file_path}}' )
353+ set +e
354+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-edit-validator.sh" 2>&1 )
355+ EXIT_CODE=$?
356+ set -e
357+ if [[ $EXIT_CODE -eq 2 ]] && echo " $RESULT " | grep -qi " plan" ; then
358+ pass " Edit validator blocks Windows-path plan.md backup"
359+ else
360+ fail " Edit validator Windows-path plan.md backup" " exit 2 with plan error" " exit $EXIT_CODE , output: $RESULT "
361+ fi
362+
277363# Test 14: Edit validator blocks round-4-todos.md
278364echo " Test 14: Edit validator blocks round-4-todos.md"
279365HOOK_INPUT=' {"tool_name": "Edit", "tool_input": {"file_path": "' $LOOP_DIR ' /round-4-todos.md"}}'
@@ -369,6 +455,34 @@ else
369455 fail " Read validator round-3-contract.md" " exit 2 with round error" " exit $EXIT_CODE , output: $RESULT "
370456fi
371457
458+ # Test 18c: Read validator blocks stale summary with Windows separators
459+ echo " Test 18c: Read validator blocks Windows-path round-3-summary.md"
460+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ round-3-summary.md"
461+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Read", tool_input: {file_path: $file_path}}' )
462+ set +e
463+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-read-validator.sh" 2>&1 )
464+ EXIT_CODE=$?
465+ set -e
466+ if [[ $EXIT_CODE -eq 2 ]] && echo " $RESULT " | grep -qi " round" ; then
467+ pass " Read validator blocks Windows-path round-3-summary.md"
468+ else
469+ fail " Read validator Windows-path round-3-summary.md" " exit 2 with round error" " exit $EXIT_CODE , output: $RESULT "
470+ fi
471+
472+ # Test 18d: Read validator allows current contract with Windows separators
473+ echo " Test 18d: Read validator allows Windows-path round-5-contract.md"
474+ WINDOWS_FILE_PATH=" ${WINDOWS_LOOP_DIR} \\ round-5-contract.md"
475+ HOOK_INPUT=$( jq -nc --arg file_path " $WINDOWS_FILE_PATH " ' {tool_name: "Read", tool_input: {file_path: $file_path}}' )
476+ set +e
477+ RESULT=$( echo " $HOOK_INPUT " | " $PROJECT_ROOT /hooks/loop-read-validator.sh" 2>&1 )
478+ EXIT_CODE=$?
479+ set -e
480+ if [[ $EXIT_CODE -eq 0 ]]; then
481+ pass " Read validator allows Windows-path round-5-contract.md"
482+ else
483+ fail " Read validator Windows-path round-5-contract.md" " exit 0" " exit $EXIT_CODE , output: $RESULT "
484+ fi
485+
372486echo " "
373487echo " === Test: Bash Validator Allowlist (Path-Restricted) ==="
374488echo " "
0 commit comments