Skip to content

feat(v3.3.2): Automatic Dream Scheduling & Cross-Domain Learning (#210) #19

feat(v3.3.2): Automatic Dream Scheduling & Cross-Domain Learning (#210)

feat(v3.3.2): Automatic Dream Scheduling & Cross-Domain Learning (#210) #19

Workflow file for this run

# Coherence-Gated Quality Engineering CI
# ADR-052: Mathematical verification of belief coherence
#
# This workflow verifies that all QE operations maintain mathematical coherence
# using Prime Radiant WASM engines (with JS fallback for CI environments).
name: Coherence Verification
on:
push:
branches: [main]
paths:
- 'v3/src/**'
- 'v3/tests/**'
- '.github/workflows/coherence.yml'
pull_request:
branches: [main]
paths:
- 'v3/src/**'
- 'v3/tests/**'
# Minimal permissions following principle of least privilege
permissions:
contents: read
actions: read
jobs:
coherence-check:
name: Coherence Verification
runs-on: ubuntu-latest
permissions:
contents: read
# Export outputs for dependent jobs
outputs:
is_coherent: ${{ steps.coherence.outputs.is_coherent }}
energy: ${{ steps.coherence.outputs.energy }}
used_fallback: ${{ steps.coherence.outputs.used_fallback }}
badge: ${{ steps.coherence.outputs.badge }}
badge_color: ${{ steps.coherence.outputs.badge_color }}
defaults:
run:
working-directory: v3
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: v3/package-lock.json
- name: Install dependencies
run: npm ci
- name: Build project
run: npm run build
- name: Run coherence check
id: coherence
run: |
node scripts/coherence-check.js > coherence-result.json 2>&1 || true
# Extract results
IS_COHERENT=$(jq -r '.isCoherent // false' coherence-result.json 2>/dev/null || echo "false")
ENERGY=$(jq -r '.energy // "N/A"' coherence-result.json 2>/dev/null || echo "N/A")
USED_FALLBACK=$(jq -r '.usedFallback // false' coherence-result.json 2>/dev/null || echo "true")
echo "is_coherent=$IS_COHERENT" >> $GITHUB_OUTPUT
echo "energy=$ENERGY" >> $GITHUB_OUTPUT
echo "used_fallback=$USED_FALLBACK" >> $GITHUB_OUTPUT
# Determine badge
if [ "$IS_COHERENT" = "true" ]; then
if [ "$USED_FALLBACK" = "true" ]; then
echo "badge=fallback" >> $GITHUB_OUTPUT
echo "badge_color=yellow" >> $GITHUB_OUTPUT
else
echo "badge=verified" >> $GITHUB_OUTPUT
echo "badge_color=brightgreen" >> $GITHUB_OUTPUT
fi
else
echo "badge=violation" >> $GITHUB_OUTPUT
echo "badge_color=red" >> $GITHUB_OUTPUT
fi
- name: Run coherence tests
run: npm run test:safe -- tests/integrations/coherence/ tests/learning/coherence-integration.test.ts --reporter=verbose
continue-on-error: true
coherence-status:
name: Coherence Status
runs-on: ubuntu-latest
needs: coherence-check
permissions:
contents: read
steps:
- name: Check coherence result
run: |
echo "Coherence Check Results:"
echo "========================"
echo "Is Coherent: ${{ needs.coherence-check.outputs.is_coherent }}"
echo "Energy: ${{ needs.coherence-check.outputs.energy }}"
echo "Used Fallback: ${{ needs.coherence-check.outputs.used_fallback }}"
echo "Badge: ${{ needs.coherence-check.outputs.badge }} (${{ needs.coherence-check.outputs.badge_color }})"
# Determine overall status
if [ "${{ needs.coherence-check.outputs.is_coherent }}" = "true" ]; then
echo ""
echo "Coherence verification PASSED"
exit 0
elif [ "${{ needs.coherence-check.outputs.used_fallback }}" = "true" ]; then
echo ""
echo "Coherence check used fallback mode (WASM unavailable)"
echo "This is acceptable for CI but full WASM verification is recommended"
exit 0
else
echo ""
echo "::error::Coherence verification FAILED"
exit 1
fi