Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
examples/.certs/
itk/target/
itk/a2a-itk/
itk/Cargo.lock
itk/raw_results.json
itk/itk_rust.json
itk/logs/
187 changes: 0 additions & 187 deletions itk/process_results.py

This file was deleted.

64 changes: 58 additions & 6 deletions itk/run_itk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,68 @@ RESPONSE=$(curl -s -X POST http://127.0.0.1:8000/run \
-H "Content-Type: application/json" \
-d "@$SCENARIO_FILE")

# Validate the ITK response shape BEFORE branching into nightly/CI post-processing.
# Guards against both branches silently accepting a malformed or error response:
# - CI mode: prevents an unhandled AttributeError inside the summariser.
# - Nightly mode: prevents the metrics processor from producing an empty/invalid
# history entry that would then be uploaded to the release asset.
Comment on lines +95 to +99
echo "$RESPONSE" | python3 -c "
import sys, json
raw = sys.stdin.read()
try:
data = json.loads(raw)
except json.JSONDecodeError as e:
print(f'ERROR: could not parse ITK response JSON: {e}', file=sys.stderr)
print(f'Raw response: {raw}', file=sys.stderr)
sys.exit(1)
if not isinstance(data, dict):
print(f'ERROR: ITK response is not a JSON object (got {type(data).__name__})', file=sys.stderr)
sys.exit(1)
if 'detail' in data:
print(f'ERROR: ITK service returned an error: {data[\"detail\"]}', file=sys.stderr)
sys.exit(1)
if 'results' not in data:
print(f'ERROR: ITK response missing \"results\" field. Keys: {list(data.keys())}', file=sys.stderr)
sys.exit(1)
if not isinstance(data['results'], dict):
print(f'ERROR: ITK response \"results\" field is not an object (got {type(data[\"results\"]).__name__})', file=sys.stderr)
sys.exit(1)
"
RESULT=$?
if [ $RESULT -ne 0 ]; then
echo "ITK response failed validation. Container logs:"
docker logs itk-service
exit $RESULT
fi

if [ "${ITK_NIGHTLY_RUN^^}" = "TRUE" ]; then
echo "Nightly run detected. Saving raw results and processing history..."
echo "Nightly run detected. Saving raw results and running process_results.py..."
echo "$RESPONSE" > raw_results.json
python3 process_results.py nightly \
--scenarios "$SCENARIO_FILE" \
--output itk_rust.json \
--history-url https://github.com/a2aproject/a2a-rs/releases/download/nightly-metrics/itk_rust.json
python3 a2a-itk/scripts/process_results.py \
--history_output_file itk_rust.json \
--history_url https://github.com/a2aproject/a2a-rs/releases/download/nightly-metrics/itk_rust.json
RESULT=$?
else
echo "$RESPONSE" | python3 process_results.py ci
echo "--------------------------------------------------------"
echo "ITK TEST RESULTS:"
echo "--------------------------------------------------------"
echo "$RESPONSE" | python3 -c "
import sys, json
data = json.loads(sys.stdin.read())
all_passed = data.get('all_passed', False)
for name, value in data['results'].items():
if isinstance(value, dict):
passed = bool(value.get('passed', False))
elif isinstance(value, bool):
passed = value
else:
passed = False
print(f'{name}: {\"PASSED\" if passed else \"FAILED\"}')
print('--------------------------------------------------------')
print(f'OVERALL STATUS: {\"PASSED\" if all_passed else \"FAILED\"}')
if not all_passed:
sys.exit(1)
"
RESULT=$?
fi
set -e
Expand Down
Loading