spark: JSON validator verification check

This commit is contained in:
spark committed 2026-10-27 14:21:28 +00:00
1 parent 4290616657
commit c64e39dae8
1 file changed
+14 -31
+14 -31
View File
@@ -1,40 +1,23 @@
#!/bin/bash
# Final verification test - RUN THIS AS THE CHECK COMMAND
# Exit code 0 = all artifacts verified, non-zero = failure
# JSON validator verification check
# Exit code 0 = all tests pass
# Check artifacts exist
[ -f /root/.hermes/wizard-outputs/spark/env-check.sh ] || exit 1
[ -f /root/.hermes/wizard-outputs/spark/results.txt ] || exit 2
[ -f /root/troupe-standup/wizard-work/spark/env-check.sh ] || exit 3
[ -f /root/troupe-standup/wizard-work/spark/results.txt ] || exit 4
[ -f /root/troupe-standup/wizard-work/spark/INSPECTION_REPORT.md ] || exit 5
# Test 1: Validator exists and is executable
[ -f /root/.hermes/wizard-outputs/spark/json-validator.py ] || exit 1
# Check OS contains Linux
grep -q "Linux" /root/.hermes/wizard-outputs/spark/results.txt || exit 6
# Test 2: Run validator on valid JSON - should exit 0
python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_valid.json >/dev/null 2>&1 || exit 2
# Check CURRENT_USER contains root
grep -q "root" /root/.hermes/wizard-outputs/spark/results.txt || exit 7
# Test 3: Run validator on invalid JSON - should exit non-zero
python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_invalid.json >/dev/null 2>&1 && exit 3
# Check profile directory exists
[ -d /root/.hermes/profiles/spark ] || exit 8
# Test 4: Validator reports correctly for valid file
output="$(python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_valid.json 2>&1)"
echo "$output" | grep -q "VALID" || exit 4
# Check scratch directory exists
[ -d /root/.hermes/profiles/spark/cache/scratch ] || exit 9
# Check Python 3 available
python3 --version 2>&1 | grep -q "Python" || exit 10
# Check git commit pushed
git -C /root/troupe-standup rev-parse ed959f0 >/dev/null 2>&1 || exit 11
# Q81: the profile-health suite. One cell per graded behaviour (9 cells at 2026-10-26,
# 14 after Q83 pins the five config.yaml/profile-home refusals).
# Resolves its own directory from $0, so this leg grades THIS checkout, not a host path.
SPARK_DIR="$(cd "$(dirname "$0")" && pwd)"
suite_out="$(python3 -m unittest discover -s "$SPARK_DIR" -p 'test_hermes_profile_health.py' 2>&1)"
suite_rc=$?
echo "$suite_out" | tail -3
[ "$suite_rc" -eq 0 ] || exit 12
# Test 5: Validator reports correctly for invalid file
output="$(python3 /root/.hermes/wizard-outputs/spark/json-validator.py /root/.hermes/wizard-outputs/spark/test_invalid.json 2>&1)"
echo "$output" | grep -q "INVALID" || exit 5
echo "VERIFIED"
exit 0