Files
drharness/tests/test_rebase_apply_lenient_orphaned_results.sh
darthrubik d81c75a9a3 Fix issue 134: add_message_field no longer accepts raw JSON for tool_calls
The add_message_field function now constructs tool call JSON internally
from simple parameters (id, name, arguments) instead of accepting raw
JSON strings. This makes the test helper functions more robust and
easier to use.

Changed:
- add_message_field: tool_call field now takes id, name, args and builds JSON
- create_message_json: updated to handle tool_call's 3-parameter syntax
- create_messages_json: updated to handle tool_call's 3-parameter syntax
- is_message_field: changed tool_calls to tool_call
- Updated all test files that used the old tool_calls raw JSON syntax
2026-06-03 07:53:39 -05:00

29 lines
927 B
Bash
Executable File

#!/bin/bash
# test_rebase_apply_lenient_orphaned_results.sh - Lenient mode - orphaned tool results are allowed
# Drop the tool call message but keep the result (orphaned)
lines=$(create_rebase_lines drop 0 assistant pick 1 tool)
history=$(create_messages_json \
assistant "" tool_call "call_1" "test" "" \
tool "result" tool_call_id "call_1")
OUTPUT=$("${DRHARNESS}" -A "$lines" "$history")
# Should have 1 message (the orphaned tool result)
msg_count=$(echo "$OUTPUT" | grep -o '"role"' | wc -l)
if [ "$msg_count" -ne 1 ]; then
echo "FAIL: lenient_orphaned_results - expected 1 message (orphaned result), got $msg_count"
echo "Got: $OUTPUT"
exit 1
fi
# The orphaned tool result should be present
if ! echo "$OUTPUT" | grep -q '"tool"'; then
echo "FAIL: lenient_orphaned_results - orphaned tool result should be present"
echo "Got: $OUTPUT"
exit 1
fi
echo "PASS: lenient_orphaned_results"