#!/bin/bash # Error Summary Script - Complete site error analysis # Uses page-browser-tester.sh + MCP browser tools for systematic error collection # Based on actual active pages from crates/client/src/pages/mod.rs set -e BASE_URL="${BASE_URL:-http://localhost:3030}" # Function to dynamically extract active pages from mod.rs get_active_pages() { local mod_file="${PAGES_MOD_FILE:-crates/client/src/pages/mod.rs}" local -a active_pages=() local -a disabled_pages=() local -a admin_pages=() if [ ! -f "$mod_file" ]; then log_error "Cannot find $mod_file" exit 1 fi log_info "Analyzing active pages from $mod_file..." # Extract active modules (not commented out) while IFS= read -r line; do if [[ "$line" =~ ^mod[[:space:]]+([a-zA-Z_]+)\; ]]; then module="${BASH_REMATCH[1]}" case "$module" in "home") active_pages+=("/") ;; "about") active_pages+=("/about") ;; "blog") active_pages+=("/blog") ;; "contact") active_pages+=("/contact") ;; "legal") active_pages+=("/legal") ;; "not_found") active_pages+=("/404") ;; "prescriptions") active_pages+=("/prescriptions") ;; "privacy") active_pages+=("/privacy") ;; "services") active_pages+=("/services") ;; "user") active_pages+=("/user") ;; "work_request") active_pages+=("/work_request") ;; "daisy_ui") active_pages+=("/daisy_ui") ;; "features_demo") active_pages+=("/features_demo") ;; "admin") ;; # Handle admin separately *) active_pages+=("/$module") ;; esac elif [[ "$line" =~ ^//[[:space:]]*mod[[:space:]]+([a-zA-Z_]+)\; ]]; then # Commented out modules module="${BASH_REMATCH[1]}" case "$module" in "daisy_ui") disabled_pages+=("/daisy_ui") ;; "features_demo") disabled_pages+=("/features_demo") ;; *) disabled_pages+=("/$module") ;; esac elif [[ "$line" =~ ^pub[[:space:]]+mod[[:space:]]+admin\; ]]; then # Admin module - check admin subpages admin_pages+=("/admin") # Check admin submodules if admin/mod.rs exists local admin_mod="crates/client/src/pages/admin/mod.rs" if [ -f "$admin_mod" ]; then while IFS= read -r admin_line; do if [[ "$admin_line" =~ ^pub[[:space:]]+mod[[:space:]]+([a-zA-Z_]+)\; ]]; then admin_module="${BASH_REMATCH[1]}" admin_pages+=("/admin/$admin_module") fi done < "$admin_mod" fi fi done < "$mod_file" # Export arrays globally ACTIVE_PAGES=("${active_pages[@]}") DISABLED_PAGES=("${disabled_pages[@]}") ADMIN_PAGES=("${admin_pages[@]}") log_success "Found ${#ACTIVE_PAGES[@]} active pages, ${#DISABLED_PAGES[@]} disabled, ${#ADMIN_PAGES[@]} admin" } TIMESTAMP=$(date +"%Y%m%d_%H%M%S") EXACT_TIME=$(date +"%Y-%m-%d %H:%M:%S %Z") REPORT_DIR="" REPORT_FILE="" # Colors RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' PURPLE='\033[0;35m' CYAN='\033[0;36m' NC='\033[0m' log_info() { echo -e "${BLUE}ℹ️ $1${NC}"; } log_success() { echo -e "${GREEN}✅ $1${NC}"; } log_warning() { echo -e "${YELLOW}⚠️ $1${NC}"; } log_error() { echo -e "${RED}❌ $1${NC}"; } log_title() { echo -e "${PURPLE}🔍 $1${NC}"; } # Initialize comprehensive report init_report() { cat > "$REPORT_FILE" << EOF # 🔍 All Pages Browser Analysis Report **Generated**: $EXACT_TIME **Server**: $BASE_URL **Tool Chain**: \`page-browser-tester.sh\` + MCP browser tools ## 🎯 Executive Summary This report provides **comprehensive browser analysis** across all active pages, including: - Console errors and warnings - Network issues and performance - Hydration and rendering problems - Cross-page error patterns **Page Detection**: Dynamically analyzed from \`crates/client/src/pages/mod.rs\` --- ## 📊 Pages Tested & Results ### Active Pages Analyzed (${#ACTIVE_PAGES[@]} total) | Page | Status | Primary Issues | Notes | |------|--------|----------------|-------| EOF for page in "${ACTIVE_PAGES[@]}"; do echo "| **$page** | 🔄 PENDING | To be analyzed | Ready for error collection |" >> "$REPORT_FILE" done cat >> "$REPORT_FILE" << EOF ### Disabled Pages (Not Tested) EOF for page in "${DISABLED_PAGES[@]}"; do echo "- \`$page\` (commented out in mod.rs)" >> "$REPORT_FILE" done cat >> "$REPORT_FILE" << EOF ### Admin Pages (Separate Analysis) EOF for page in "${ADMIN_PAGES[@]}"; do echo "- \`$page\` (may require authentication)" >> "$REPORT_FILE" done cat >> "$REPORT_FILE" << EOF --- ## 🔬 Error Pattern Analysis ### Expected Common Patterns Based on previous analysis, expect to find: 1. **SubscriptionForm Hydration Error** - Primary site-wide issue - Location: \`subscription_form.rs:189:8\` - Symptom: "framework expected a marker node, but found #text" - Impact: All pages with SubscriptionForm component 2. **Option::unwrap() Panic** - Secondary cascade error - Location: \`tachys html/mod.rs:201:14\` - Cause: Hydration failure leads to None unwrap - Impact: Complete page breakdown 3. **WASM Runtime Errors** - Tertiary failures - Symptom: "RuntimeError: unreachable" - Cause: Panic propagation in WASM context - Impact: Browser resource consumption ### Error Cascading Pattern \`\`\` Page Load → SubscriptionForm Hydration Error ↓ Framework Panic (Unrecoverable) ↓ Option::unwrap() Panic ↓ WASM Runtime Failure ↓ Complete Page Breakdown \`\`\` --- ## 🔍 Detailed Error Analysis *This section will be populated with actual error data collected from each page* ### Console Errors - **Primary Errors**: [To be filled with actual error data] - **Secondary Errors**: [To be filled with cascade failures] - **Runtime Errors**: [To be filled with WASM failures] ### Network Issues - **Failed Requests**: [To be analyzed] - **Performance Issues**: [To be measured] - **Resource Loading**: [To be checked] --- ## 📈 Impact Assessment ### Severity Analysis - **Critical Issues**: Pages completely non-functional - **Major Issues**: Significant functionality impaired - **Minor Issues**: Cosmetic or performance degradation - **Warnings**: Potential future problems ### User Experience Impact - **Hydration Failures**: Pages may appear broken after initial load - **Performance Issues**: Slow rendering or interaction - **Accessibility Problems**: Screen readers or keyboard navigation affected --- ## 🎯 Recommended Actions ### Immediate Priority (Critical) 1. **Fix SubscriptionForm Component** - Remove conditional rendering causing DOM mismatches - Ensure identical DOM structure between SSR and client - Replace dynamic class generation with static classes ### Technical Implementation \`\`\`rust // CURRENT (PROBLEMATIC) view! {