Merged 10 upstream commits (MemTable, read-your-writes tests, feed endpoint, security hardening, signed assertions, source registry, dashboard enhancements) and fixed all test failures across the full workspace (2656/2656 passing). Key fixes: - fix(cluster): DashMap deadlock in swim.rs suspect_node/fail_node/alive_node - DashMap::get_mut RefMut + iter() on same map = non-reentrant write lock deadlock - Fix: extract clone in scoped block to drop RefMut before calling update_node_gauges() - 6 previously-hanging SWIM tests now pass in <2s - fix(sim): replace background-task+polling ingestion with synchronous process_pending() - smoke_high_volume_simulation was CPU-starved under 2656 parallel tests - Removed ingestor.start() + wait_until_ingested() pattern throughout sim - All arena functions now call ingestor.process_pending() directly (deterministic) - fix(test): v2 signature helper used wrong hash (rkyv vs canonical compute_content_hash_v2) - fix(test): quota test signed "test" but v1 requires "subject:predicate" format - fix(test): http_validation now accepts 400 for valid-format-but-invalid-crypto hex - fix(test): scale_adaptive micro tier assertions updated (auto_promote upstream change) - config: add nextest.toml with slow-timeout for background-task-tests group Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
71 lines
2.6 KiB
Bash
Executable File
71 lines
2.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# API URL
|
|
API="http://localhost:18180/v1"
|
|
|
|
echo "🔥 Cognitive Firewall Demo: Real-time Truth Resolution"
|
|
echo "====================================================="
|
|
|
|
SUBJECT="Cognitive_Firewall_Test_$(date +%s)"
|
|
echo "Testing Subject: $SUBJECT"
|
|
|
|
# Generate dummy source hashes
|
|
SOURCE_HASH_FDA="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
|
SOURCE_HASH_REDDIT="bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
|
|
|
|
echo "💉 Injecting Claim 1 (FDA): 'Safe'..."
|
|
curl -s -X POST "$API/assert" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"subject": "'$SUBJECT'",
|
|
"predicate": "status",
|
|
"object": {"type": "Text", "value": "Safe"},
|
|
"source_hash": "'$SOURCE_HASH_FDA'",
|
|
"source_class": "Regulatory",
|
|
"confidence": 1.0,
|
|
"signatures": [{"agent_id": "0000000000000000000000000000000000000000000000000000000000000000", "signature": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "timestamp": 0, "version": 1}]
|
|
}' > /dev/null
|
|
|
|
echo "💉 Injecting Claim 2 (Reddit): 'Dangerous'..."
|
|
curl -s -X POST "$API/assert" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"subject": "'$SUBJECT'",
|
|
"predicate": "status",
|
|
"object": {"type": "Text", "value": "Dangerous"},
|
|
"source_hash": "'$SOURCE_HASH_REDDIT'",
|
|
"source_class": "Anecdotal",
|
|
"confidence": 0.8,
|
|
"signatures": [{"agent_id": "0000000000000000000000000000000000000000000000000000000000000000", "signature": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "timestamp": 0, "version": 1}]
|
|
}' > /dev/null
|
|
|
|
echo "⏳ Waiting for Ingestion (Log -> KV)..."
|
|
for i in {1..10}; do
|
|
echo -n "."
|
|
sleep 2
|
|
RESPONSE=$(curl -s -G "$API/query" \
|
|
--data-urlencode "subject=$SUBJECT" \
|
|
--data-urlencode "predicate=status" \
|
|
--data-urlencode "lens=Skeptic")
|
|
COUNT=$(echo "$RESPONSE" | jq -r '.total_count // 0')
|
|
if [ "$COUNT" -gt 0 ]; then
|
|
echo " Success!"
|
|
break
|
|
fi
|
|
done
|
|
|
|
CONFLICT=$(echo "$RESPONSE" | jq -r '.conflict_score // 0')
|
|
|
|
echo "-----------------------------------------------------"
|
|
echo "📊 Results:"
|
|
echo " Assertions Found: $COUNT"
|
|
echo " Conflict Score: $CONFLICT"
|
|
|
|
if [ "$COUNT" -eq 0 ]; then
|
|
echo "❌ ERROR: No assertions found after 20s."
|
|
elif (( $(echo "$CONFLICT > 0.5" | bc -l) )); then
|
|
echo "🔴 RED ALERT: High Conflict Detected! Firewall Active."
|
|
else
|
|
echo "🟢 GREEN: Consensus Reached."
|
|
fi
|
|
echo "-----------------------------------------------------"
|