Files
llm-intelligence/scripts/verify_phase3.sh
2026-05-13 20:13:02 +08:00

36 lines
2.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
. "$SCRIPT_DIR/verify_common.sh"
. "$SCRIPT_DIR/report_utils.sh"
TODAY="$(report_date_value)"
TODAY_MARKDOWN_PATH="$(report_markdown_path "$TODAY")"
TODAY_HTML_PATH="$(report_html_path "$TODAY")"
TODAY_ARCHIVE_MARKDOWN_PATH="$(report_archive_markdown_path "$TODAY")"
TODAY_ARCHIVE_HTML_PATH="$(report_archive_html_path "$TODAY")"
echo "=== Phase 3 验收检查 ==="
check_executable "scripts/run_daily.sh" "日报流水线脚本可执行"
check_executable "scripts/feishu_alert.sh" "飞书告警脚本可执行"
check_shell "日报生成器可独立构建" "go build -o /dev/null ./scripts/generate_daily_report.go"
check_shell "日报脚本包含降级逻辑" "grep -q 'fallback_report' scripts/run_daily.sh"
check_shell "日报脚本包含飞书告警逻辑" "grep -q 'send_alert' scripts/run_daily.sh"
check_shell "今日日报 Markdown 主产物存在且包含数据质量摘要" "test -f ${TODAY_MARKDOWN_PATH} && grep -q '数据质量摘要' ${TODAY_MARKDOWN_PATH}"
check_shell "今日日报 HTML 主产物存在" "test -f ${TODAY_HTML_PATH}"
check_shell "今日日报归档副本存在Markdown + HTML" "test -f ${TODAY_ARCHIVE_MARKDOWN_PATH} && test -f ${TODAY_ARCHIVE_HTML_PATH}"
check_shell "日报归档约定已统一收敛到公共工具" "grep -q 'report_utils.sh' scripts/run_daily.sh && grep -q 'report_utils.sh' scripts/run_real_pipeline.sh && grep -q 'report_utils.sh' scripts/verify_phase3.sh"
check_sql_int_ge "daily_report 已写入至少 1 条 generated 记录" \
"select count(*) from daily_report where status='generated';" \
1
check_sql_int_ge "report_runs 已写入至少 1 条 generated 记录" \
"select count(*) from report_runs where status='generated';" \
1
check_shell "crontab 已配置每日调度" "crontab -l 2>/dev/null | grep -q 'scripts/run_daily.sh'"
check_shell "真实采集 API Key 已配置" "([ -n \"${OPENROUTER_API_KEY:-}\" ] || ([ -f .env.local ] && grep -Eq '^OPENROUTER_API_KEY=.+' .env.local) || ([ -f .env ] && grep -Eq '^OPENROUTER_API_KEY=.+' .env))"
finish_phase