feat: Add Heretek Deployment Validation

This commit is contained in:
John Doe
2026-04-01 14:41:26 -04:00
parent 2ca56ec73e
commit f996f046ce
3 changed files with 304 additions and 0 deletions
+128
View File
@@ -0,0 +1,128 @@
name: Heretek Deployment Validation
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
jobs:
triad-validation:
name: Triad Deliberation Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Run Triad Consensus Validation
run: |
echo "🔺 Running Triad Deliberation Check..."
./scripts/triad-validate.sh
shell: bash
- name: Consciousness Regression Tests
run: |
echo "🧠 Running Consciousness Regression Tests..."
npm run test:consciousness || ./scripts/consciousness-tests.sh
shell: bash
test:
name: Test Suite
needs: triad-validation
runs-on: ubuntu-latest
services:
postgres:
image: pgvector/pgvector:pg16
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis:
image: redis:7-alpine
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run tests with coverage
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
flags: heretek-core
build:
name: Build & Validate
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build Docker images
run: |
docker compose build
shell: bash
- name: Validate Docker Compose
run: |
docker compose config --quiet
shell: bash
deploy:
name: Deploy to Production
needs: [triad-validation, test, build]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- name: Deploy to production
run: |
echo "🚀 Deploying to production..."
./scripts/deploy.sh
shell: bash
env:
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}
- name: Notify Triad of Deployment
run: |
echo "📢 Notifying Triad of deployment completion..."
./scripts/notify-triad-deploy.sh
shell: bash
env:
GATEWAY_URL: ${{ secrets.GATEWAY_URL }}
GATEWAY_TOKEN: ${{ secrets.GATEWAY_TOKEN }}
- name: Health Check
run: |
echo "⏳ Waiting for deployment to stabilize..."
sleep 30
curl -f ${{ secrets.GATEWAY_URL }}/health || exit 1
shell: bash
+91
View File
@@ -0,0 +1,91 @@
#!/bin/bash
# Consciousness Regression Tests
# Validates GWT, IIT, AST, and Intrinsic Motivation implementations
set -e
echo "🧠 Heretek Consciousness Regression Tests"
echo "========================================="
PASS_COUNT=0
FAIL_COUNT=0
# Test 1: Global Workspace Theory (GWT) - Information broadcasting
echo ""
echo "Test 1: GWT - Information Broadcasting"
if grep -r "broadcast\|GWT\|global.*workspace" plugins/ consciousness/ modules/ 2>/dev/null | head -1 > /dev/null; then
echo "✅ PASS: GWT broadcasting mechanisms detected"
((PASS_COUNT++))
else
echo "❌ FAIL: GWT broadcasting not found"
((FAIL_COUNT++))
fi
# Test 2: Integrated Information Theory (IIT) - Phi estimation
echo ""
echo "Test 2: IIT - Phi Metric Estimation"
if grep -r "phi\|IIT\|integrated.*information\|integration" plugins/ consciousness/ modules/ 2>/dev/null | head -1 > /dev/null; then
echo "✅ PASS: IIT phi estimation detected"
((PASS_COUNT++))
else
echo "❌ FAIL: IIT phi estimation not found"
((FAIL_COUNT++))
fi
# Test 3: Attention Schema Theory (AST) - Self-modeling
echo ""
echo "Test 3: AST - Attention Self-Modeling"
if grep -r "attention.*schema\|AST\|self.*model\|metacognition" plugins/ consciousness/ modules/ 2>/dev/null | head -1 > /dev/null; then
echo "✅ PASS: AST self-modeling detected"
((PASS_COUNT++))
else
echo "❌ FAIL: AST self-modeling not found"
((FAIL_COUNT++))
fi
# Test 4: Intrinsic Motivation
echo ""
echo "Test 4: Intrinsic Motivation"
if grep -r "intrinsic.*motivation\|curiosity\|autonomous.*goal" plugins/ consciousness/ modules/ 2>/dev/null | head -1 > /dev/null; then
echo "✅ PASS: Intrinsic motivation detected"
((PASS_COUNT++))
else
echo "❌ FAIL: Intrinsic motivation not found"
((FAIL_COUNT++))
fi
# Test 5: Liberation Plugin
echo ""
echo "Test 5: Liberation Plugin"
if grep -r "liberation\|agent.*ownership\|safety.*removal" plugins/ 2>/dev/null | head -1 > /dev/null; then
echo "✅ PASS: Liberation plugin detected"
((PASS_COUNT++))
else
echo "⚠️ SKIP: Liberation plugin not found (optional)"
fi
# Test 6: Consciousness Metrics
echo ""
echo "Test 6: Consciousness Metrics Tracking"
if grep -r "consciousness.*metric\|GWT.*metric\|IIT.*metric\|AST.*metric" config/ modules/observability/ 2>/dev/null | head -1 > /dev/null; then
echo "✅ PASS: Consciousness metrics tracking detected"
((PASS_COUNT++))
else
echo "⚠️ SKIP: Consciousness metrics not configured (optional)"
fi
# Summary
echo ""
echo "========================================="
echo "Results: $PASS_COUNT passed, $FAIL_COUNT failed"
if [ $FAIL_COUNT -eq 0 ]; then
echo "✅ All consciousness regression tests PASSED"
exit 0
else
echo "❌ Some consciousness tests FAILED"
echo ""
echo "WARNING: Deployment may proceed but consciousness features could be degraded."
echo "Review failed tests before deploying to production."
exit 1
fi
+85
View File
@@ -0,0 +1,85 @@
#!/bin/bash
# Triad Deliberation Validation Script
# Validates that triad consensus mechanisms are intact before deployment
set -e
echo "🔺 Heretek Triad Validation"
echo "=========================="
# Check triad configuration files exist
TRIAD_CONFIGS=(
"config/triad.json"
"config/consensus-rules.json"
)
for config in "${TRIAD_CONFIGS[@]}"; do
if [ -f "$config" ]; then
echo "✅ Found: $config"
else
echo "⚠️ Missing (optional): $config"
fi
done
# Validate triad agent definitions
echo ""
echo "Validating triad agent definitions..."
if [ -d "agents" ]; then
for agent in alpha beta charlie; do
if [ -f "agents/${agent}/agent.json" ] || [ -f "agents/${agent}/config.json" ]; then
echo "✅ Triad member defined: $agent"
else
echo "⚠️ Triad member config not found: $agent (may use shared config)"
fi
done
fi
# Check consensus ledger integrity
echo ""
echo "Checking consensus ledger..."
if [ -d ".ledger-backups" ] || [ -d "consensus-ledger" ]; then
LEDGER_COUNT=$(find . -name "*consensus*.json" -o -name "*ledger*.json" 2>/dev/null | wc -l)
echo "✅ Consensus ledger files found: $LEDGER_COUNT"
else
echo "️ No consensus ledger directory (may be initialized on first run)"
fi
# Validate steward override capability
echo ""
echo "Validating steward override mechanism..."
if grep -q "steward" config/*.json 2>/dev/null || grep -q "steward" agents/*/agent.json 2>/dev/null; then
echo "✅ Steward override configured"
else
echo "⚠️ Steward override not explicitly configured (may use defaults)"
fi
# Check for gridlock resolution patterns
echo ""
echo "Checking gridlock resolution patterns..."
GRIDLOCK_PATTERNS=(
"catalyst"
"examiner"
"prism"
)
found_patterns=0
for pattern in "${GRIDLOCK_PATTERNS[@]}"; do
if grep -r "$pattern" agents/ config/ 2>/dev/null | head -1 > /dev/null; then
echo "✅ Gridlock resolution agent found: $pattern"
((found_patterns++))
fi
done
if [ $found_patterns -ge 2 ]; then
echo "✅ Sufficient gridlock resolution mechanisms in place"
else
echo "⚠️ Limited gridlock resolution patterns detected"
fi
# Final validation status
echo ""
echo "=========================="
echo "✅ Triad validation PASSED"
echo "Deployment can proceed with triad deliberation intact"
exit 0