{
  "name": "debug-tool",
  "version": "1.0",
  "date": "2026-07-14",
  "commit": "6ccadb7",
  "deliverable": {
    "backend": "src/routes/debug.ts (4 endpoints)",
    "frontend": "public/debug.html (7 sections, 33KB)",
    "nginx": "added /debug and /debug.html location blocks"
  },
  "endpoints": {
    "GET /admin/debug-stats": "DB tables, endpoint registry, cache, chat consistency, recent activity",
    "POST /admin/debug-query": "Read-only SQL browser (SELECT/SHOW/DESCRIBE/EXPLAIN only)",
    "GET /admin/debug-logs?lines=N": "PM2 log filter (errors + warnings)",
    "GET /admin/debug-crons": "PM2 process list"
  },
  "ui_sections": [
    "System Health — 6 KPIs + 38 tables + chat consistency card",
    "Data Consistency — 10 cross-source tests, 1-click run, all PASS",
    "Endpoints — 65 endpoints in 3 groups (Public/Live/Admin) with inline test buttons",
    "DB Browser — SQL textarea with 4 sample queries, paginated result table",
    "API Tester — any endpoint + GET/POST + JSON body, raw response with timing",
    "Logs — error + warning tabs filtered from PM2 logs",
    "Crons — PM2 process list output"
  },
  "verified": {
    "playwright_screenshots": 7,
    "page_errors": 0,
    "consistency_tests": "10/10 PASS",
    "db_query_response_ms": 1,
    "api_test_endpoint": "/public/chat-stats?days=7",
    "api_response_status": 200,
    "api_response_time_ms": 267,
    "log_lines_scanned": 99,
    "log_errors": 0,
    "log_warnings": 0,
    "pm2_processes": 2
  },
  "live_url": "https://adsfb.namnan.co.th/debug",
  "key_files": [
    "src/routes/debug.ts (8.9KB)",
    "public/debug.html (33KB)",
    "/etc/nginx/sites-enabled/adsfb.namnan.co.th (added 2 location blocks)"
  ]
}
