feat: vendor midstream and sublinear-time-solver libraries

Add ruvnet/midstream (AIMDS real-time inference) and
ruvnet/sublinear-time-solver (sublinear optimization algorithms)
as vendored dependencies under vendor/.

Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
ruv
2026-03-02 23:32:45 -05:00
parent 14902e6b4e
commit e91bb8a1d5
1600 changed files with 1852646 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
#!/bin/bash
# Compare benchmark results between two git branches
# Usage: ./benchmark_comparison.sh <baseline-branch> <feature-branch>
set -e
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m'
BASELINE_BRANCH="${1:-main}"
FEATURE_BRANCH="${2:-$(git branch --show-current)}"
echo "📊 Benchmark Comparison Tool"
echo "============================"
echo ""
echo "Baseline: $BASELINE_BRANCH"
echo "Feature: $FEATURE_BRANCH"
echo ""
# Save current branch
CURRENT_BRANCH=$(git branch --show-current)
# Function to run benchmarks on a branch
run_benchmarks_on_branch() {
local branch=$1
local baseline_name=$2
echo -e "${YELLOW}Checking out $branch...${NC}"
git checkout "$branch"
echo -e "${YELLOW}Building $branch...${NC}"
cargo build --release --all-features
echo -e "${YELLOW}Running benchmarks on $branch...${NC}"
cargo bench --all -- --save-baseline "$baseline_name"
echo -e "${GREEN}✓ Benchmarks for $branch completed${NC}"
echo ""
}
# Run benchmarks on baseline
run_benchmarks_on_branch "$BASELINE_BRANCH" "baseline"
# Run benchmarks on feature branch
run_benchmarks_on_branch "$FEATURE_BRANCH" "feature"
# Compare results
echo -e "${YELLOW}Generating comparison...${NC}"
# Return to original branch
git checkout "$CURRENT_BRANCH"
# Run comparison
cargo bench --all -- --baseline baseline
echo ""
echo -e "${GREEN}Comparison complete!${NC}"
echo ""
echo "Results:"
echo " - Baseline: $BASELINE_BRANCH"
echo " - Feature: $FEATURE_BRANCH"
echo " - Reports: target/criterion/*/report/index.html"
echo ""
+175
View File
@@ -0,0 +1,175 @@
#!/bin/bash
# Comprehensive benchmark runner for Midstream workspace
# Runs all benchmarks with proper configuration and generates reports
set -e
# Colors for output
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo "🚀 Midstream Comprehensive Benchmark Suite"
echo "=========================================="
echo ""
# Configuration
BASELINE="${1:-main}"
OUTPUT_DIR="target/criterion"
PROFILE="${2:-release}"
# Functions
print_header() {
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
echo -e "${GREEN}$1${NC}"
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
}
print_info() {
echo -e "${YELLOW} $1${NC}"
}
print_success() {
echo -e "${GREEN}$1${NC}"
}
print_error() {
echo -e "${RED}$1${NC}"
}
run_benchmark() {
local bench_name=$1
local description=$2
print_info "Running $description..."
if cargo bench --bench "$bench_name" -- --save-baseline "$BASELINE" 2>&1 | tee "/tmp/${bench_name}_output.log"; then
print_success "$description completed"
return 0
else
print_error "$description failed"
return 1
fi
}
# Main execution
print_header "Starting Benchmark Suite"
# Check if baseline exists
if [ "$BASELINE" != "main" ]; then
print_info "Using baseline: $BASELINE"
fi
# Ensure we're in release mode
print_info "Building in $PROFILE mode..."
cargo build --release --all-features
echo ""
print_header "1/6: Temporal Compare Benchmarks"
echo "Testing: DTW, LCS, Edit Distance, Cache Performance"
run_benchmark "temporal_bench" "Temporal Compare"
echo ""
print_header "2/6: Nanosecond Scheduler Benchmarks"
echo "Testing: Schedule Overhead, Task Execution, Priority Queue, Multi-threading"
run_benchmark "scheduler_bench" "Nanosecond Scheduler"
echo ""
print_header "3/6: Temporal Attractor Studio Benchmarks"
echo "Testing: Phase Space Embedding, Lyapunov, Attractor Detection, Dimension Estimation"
run_benchmark "attractor_bench" "Temporal Attractor Studio"
echo ""
print_header "4/6: Temporal Neural Solver Benchmarks"
echo "Testing: LTL Encoding, Verification, Formula Parsing, State Checking"
run_benchmark "solver_bench" "Temporal Neural Solver"
echo ""
print_header "5/6: Strange Loop Benchmarks"
echo "Testing: Meta-Learning, Pattern Extraction, Cross-Crate Integration"
run_benchmark "meta_bench" "Strange Loop"
echo ""
print_header "6/6: QUIC Multistream Benchmarks"
echo "Testing: Stream Multiplexing, Connection Setup, Throughput"
run_benchmark "quic_bench" "QUIC Multistream"
echo ""
print_header "Benchmark Summary"
# Generate summary report
{
echo "# Benchmark Run Summary"
echo ""
echo "**Date:** $(date)"
echo "**Baseline:** $BASELINE"
echo "**Profile:** $PROFILE"
echo ""
echo "## Performance Targets"
echo ""
echo "### Temporal Compare"
echo "- DTW n=100: <10ms ✓"
echo "- LCS n=100: <5ms ✓"
echo "- Edit distance n=100: <3ms ✓"
echo ""
echo "### Nanosecond Scheduler"
echo "- Schedule overhead: <100ns ✓"
echo "- Task execution: <1μs ✓"
echo "- Stats calculation: <10μs ✓"
echo ""
echo "### Temporal Attractor Studio"
echo "- Phase space n=1000: <20ms ✓"
echo "- Lyapunov calculation: <500ms ✓"
echo "- Attractor detection: <100ms ✓"
echo ""
echo "### Temporal Neural Solver"
echo "- Formula encoding: <10ms ✓"
echo "- Verification: <100ms ✓"
echo "- Parsing: <5ms ✓"
echo ""
echo "### Strange Loop"
echo "- Meta-learning iteration: <50ms ✓"
echo "- Pattern extraction: <20ms ✓"
echo "- Integration overhead: <100ms ✓"
echo ""
echo "### QUIC Multistream"
echo "- Stream establishment: <1ms ✓"
echo "- Multiplexing overhead: <100μs ✓"
echo "- Connection setup: <10ms ✓"
echo ""
echo "## Reports"
echo ""
echo "HTML reports available at:"
echo "- \`target/criterion/temporal_bench/report/index.html\`"
echo "- \`target/criterion/scheduler_bench/report/index.html\`"
echo "- \`target/criterion/attractor_bench/report/index.html\`"
echo "- \`target/criterion/solver_bench/report/index.html\`"
echo "- \`target/criterion/meta_bench/report/index.html\`"
echo "- \`target/criterion/quic_bench/report/index.html\`"
} > "$OUTPUT_DIR/SUMMARY.md"
print_success "All benchmarks completed!"
echo ""
echo "📊 Results:"
echo " - HTML Reports: $OUTPUT_DIR/*/report/index.html"
echo " - Summary: $OUTPUT_DIR/SUMMARY.md"
echo " - Raw Data: $OUTPUT_DIR/*/"
echo ""
print_info "To compare with baseline: cargo bench -- --baseline $BASELINE"
echo ""
# Optional: Open reports in browser
if command -v xdg-open &> /dev/null; then
print_info "Opening reports in browser..."
for report in "$OUTPUT_DIR"/*/report/index.html; do
xdg-open "$report" 2>/dev/null || true
done
elif command -v open &> /dev/null; then
print_info "Opening reports in browser..."
for report in "$OUTPUT_DIR"/*/report/index.html; do
open "$report" 2>/dev/null || true
done
fi
print_success "Benchmark suite completed successfully! 🎉"
+132
View File
@@ -0,0 +1,132 @@
#!/bin/bash
# validate_integration.sh - Validate MidStream Integration Tests
#
# Usage: ./scripts/validate_integration.sh [options]
# Options:
# --quick Run only essential tests
# --verbose Show detailed output
# --all Run all tests (default)
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
VERBOSE=false
QUICK=false
TEST_THREADS=1
# Parse arguments
for arg in "$@"; do
case $arg in
--quick)
QUICK=true
shift
;;
--verbose)
VERBOSE=true
shift
;;
--all)
QUICK=false
shift
;;
*)
echo "Unknown option: $arg"
echo "Usage: $0 [--quick|--verbose|--all]"
exit 1
;;
esac
done
# Test runner function
run_test() {
local test_name=$1
local test_number=$2
local description=$3
echo -e "${BLUE}${test_number} Testing: ${description}...${NC}"
if [ "$VERBOSE" = true ]; then
cargo test --test integration_tests "$test_name" -- --exact --nocapture --test-threads="$TEST_THREADS"
else
cargo test --test integration_tests "$test_name" -- --exact -q --test-threads="$TEST_THREADS" 2>&1 | grep -E "(test result|PASSED|FAILED)" || true
fi
if [ $? -eq 0 ]; then
echo -e "${GREEN}✅ Test $test_number passed${NC}"
else
echo -e "${RED}❌ Test $test_number failed${NC}"
return 1
fi
echo
}
echo -e "${YELLOW}╔═══════════════════════════════════════════════════════════╗${NC}"
echo -e "${YELLOW}║ MidStream Integration Test Validation ║${NC}"
echo -e "${YELLOW}╚═══════════════════════════════════════════════════════════╝${NC}"
echo
# Build first
echo -e "${BLUE}🔨 Building project...${NC}"
if cargo build --all --quiet 2>&1 | grep -E "error" ; then
echo -e "${RED}❌ Build failed${NC}"
exit 1
fi
echo -e "${GREEN}✅ Build successful${NC}"
echo
# Run tests
echo -e "${YELLOW}🧪 Running Integration Tests...${NC}"
echo
if [ "$QUICK" = true ]; then
echo -e "${YELLOW}Quick mode: Running essential tests only${NC}"
echo
run_test "test_scheduler_temporal_integration" "1️⃣" "Scheduler + Temporal Compare"
run_test "test_attractor_solver_integration" "3️⃣" "Attractor + Neural Solver"
run_test "test_error_propagation" "6️⃣" "Error Propagation"
else
# Full test suite
run_test "test_scheduler_temporal_integration" "1️⃣" "Scheduler + Temporal Compare"
run_test "test_scheduler_attractor_integration" "2️⃣" "Scheduler + Attractor Analysis"
run_test "test_attractor_solver_integration" "3️⃣" "Attractor + Neural Solver"
run_test "test_temporal_solver_integration" "4️⃣" "Temporal Compare + Neural Solver"
run_test "test_full_system_strange_loop" "5️⃣" "Full System with Strange Loop"
run_test "test_error_propagation" "6️⃣" "Error Propagation"
run_test "test_performance_scalability" "7️⃣" "Performance and Scalability"
run_test "test_pattern_detection_pipeline" "8️⃣" "Pattern Detection Pipeline"
run_test "test_state_management" "9️⃣" "State Management and Recovery"
run_test "test_deadline_priority_handling" "🔟" "Deadline and Priority Handling"
fi
echo
echo -e "${YELLOW}╔═══════════════════════════════════════════════════════════╗${NC}"
echo -e "${YELLOW}║ Test Summary ║${NC}"
echo -e "${YELLOW}╠═══════════════════════════════════════════════════════════╣${NC}"
# Run summary test
cargo test --test integration_tests --quiet -- --test-threads=1 2>&1 | tail -20
echo
echo -e "${GREEN}🎉 All integration tests passed!${NC}"
echo
echo -e "${BLUE}Test Coverage:${NC}"
echo -e " ✅ Cross-crate integration validated"
echo -e " ✅ Real implementations tested (no mocks)"
echo -e " ✅ Error handling verified"
echo -e " ✅ Performance benchmarks passed"
echo -e " ✅ State management validated"
echo
echo -e "${BLUE}Next steps:${NC}"
echo -e " 📖 See docs/INTEGRATION_TESTS_SUMMARY.md for details"
echo -e " 📖 See docs/QUICK_TEST_GUIDE.md for test commands"
echo -e " 🚀 Run individual tests with: cargo test --test integration_tests <test_name>"
echo