feat: 2026-04-15~05-02 累积变更基线 — AI 重构 + Runtime Context + DWS 修复

涵盖(每条对应已存的审计记录):
- AI 模块拆分:apps/backend/app/ai/apps -> prompts/(8 个 APP + app2a 派生)
  audit: 2026-04-20__ai-module-complete.md
- admin-web AI 管理套件:AIDashboard / AIOperations / AIRunLogs / AITriggers / TriggerManager
  audit: 2026-04-21__admin-web-ai-management-suite.md
- App2 财务洞察 prompt v3 -> v5.1 + 小程序 AI 接入(chat / board-finance)
  audit: 2026-04-22__app2_prompt_v5_1_and_miniprogram_ai_insight.md
- App2 prewarm 全过滤器 + AI 触发器 cron reschedule
  audit: 2026-04-21__app2-finance-prewarm-all-filters.md
  migration: 20260420_ai_trigger_jobs_and_app2_prewarm.sql / 20260421_app2_prewarm_cron_reschedule.sql
- AppType 联合类型对齐 + adminAiAppTypes.test.ts
  audit: 2026-04-30__admin_web_ai_app_type_alignment.md
- DashScope tokens_used 提取修复
  audit: 2026-04-30__backend_dashscope_tokens_used_extraction.md
- App3 线索完整详情 prompt
  audit: 2026-05-01__backend_app3_full_detail_prompt.md
- Runtime Context 沙箱(5-1~5-2 主线):
  - 后端 schema/service + admin_runtime_context / xcx_runtime_clock 两个 router
  - admin-web RuntimeContext.tsx + miniprogram runtime-clock.ts
  - migration: 20260501__runtime_context_sandbox.sql
  - tools/db/verify_admin_web_sandbox.py + verify_sandbox_end_to_end.py
  - database/changes: 7 份 sandbox_* 验证报告
- 飞球 DWS 修复:finance_area_daily 区域汇总 + task_engine 调整
  + RLS 视图业务日上界(migration 20260502 + scripts/ops/gen_rls_business_date_migration.py)

合规:
- .gitignore 启用 tmp/ 排除
- 不入仓:apps/etl/connectors/feiqiu/.env(API_TOKEN secret,本地修改保留)

待验证清单:
- docs/audit/changes/2026-05-04__cumulative_baseline_pending_verification.md
  每个主题的功能完整性 / 上线验证几乎都未收口,按优先级 P0~P3 逐一处理
This commit is contained in:
Neo
2026-05-04 02:30:19 +08:00
parent 2010034840
commit caf179a5da
130 changed files with 14543 additions and 2717 deletions

View File

@@ -0,0 +1,78 @@
# 沙箱端到端验证报告
- site_id: `2790685415443269`
- sandbox_date: `2025-09-01`
- 生成时间: `2026-05-02T12:56:36`
## 1. 视图层C 方案)
sandbox 模式下max(各日期列) 必须 <= sandbox_date。
| 视图.列 | 取值 | 结果 |
|---|---|---|
| `app.v_dws_finance_area_daily.stat_date` | 2025-09-01 | PASS |
| `app.v_dws_finance_daily_summary.stat_date` | 2025-09-01 | PASS |
| `app.v_dws_member_visit_detail.visit_date` | 2025-09-01 | PASS |
| `app.v_dws_member_consumption_summary.stat_date` | None | OK (None) |
| `app.v_dws_assistant_daily_detail.stat_date` | 2025-09-01 | PASS |
| `app.v_dws_assistant_monthly_summary.stat_month` | 2025-09-01 | PASS |
| `app.v_dws_assistant_salary_calc.salary_month` | 2025-09-01 | PASS |
| `app.v_dwd_settlement_head.create_time` | 2025-09-01 | PASS |
| `app.v_dwd_assistant_service_log.create_time` | 2025-09-01 | PASS |
| `app.v_dwd_recharge_order.pay_time` | 2025-09-01 | PASS |
| `app.v_dws_member_winback_index.last_visit_time` | 2025-09-01 | PASS |
| `app.v_dws_assistant_customer_stats.stat_date` | None | OK (None) |
| `app.v_dws_member_assistant_intimacy.calc_time` | None | OK (None) |
| `app.v_dws_member_newconv_index.stat_date` | 2025-09-01 | PASS |
| `app.v_dws_finance_board_cache.computed_at` | None | OK (None) |
| `app.v_finance_daily.stat_date` | 2025-09-01 | PASS |
### live 模式 baseline同样 site_id无 GUC
| 视图.列 | 取值 | 备注 |
|---|---|---|
| `app.v_dws_finance_area_daily.stat_date` | 2026-04-27 | live (CURRENT_DATE 行为) |
| `app.v_dws_finance_daily_summary.stat_date` | 2026-04-27 | live (CURRENT_DATE 行为) |
| `app.v_dws_member_visit_detail.visit_date` | 2026-04-27 | live (CURRENT_DATE 行为) |
| `app.v_dws_member_consumption_summary.stat_date` | 2026-05-01 | live (CURRENT_DATE 行为) |
| `app.v_dws_assistant_daily_detail.stat_date` | 2026-04-26 | live (CURRENT_DATE 行为) |
| `app.v_dws_assistant_monthly_summary.stat_month` | 2026-04-01 | live (CURRENT_DATE 行为) |
| `app.v_dws_assistant_salary_calc.salary_month` | 2026-04-01 | live (CURRENT_DATE 行为) |
| `app.v_dwd_settlement_head.create_time` | 2026-04-28 | live (CURRENT_DATE 行为) |
| `app.v_dwd_assistant_service_log.create_time` | 2026-04-26 | live (CURRENT_DATE 行为) |
| `app.v_dwd_recharge_order.pay_time` | 2026-04-21 | live (CURRENT_DATE 行为) |
| `app.v_dws_member_winback_index.last_visit_time` | 2026-04-27 | live (CURRENT_DATE 行为) |
| `app.v_dws_assistant_customer_stats.stat_date` | 2026-05-01 | live (CURRENT_DATE 行为) |
| `app.v_dws_member_assistant_intimacy.calc_time` | 2026-02-08 | live (CURRENT_DATE 行为) |
| `app.v_dws_member_newconv_index.stat_date` | 2026-05-01 | live (CURRENT_DATE 行为) |
| `app.v_dws_finance_board_cache.computed_at` | 2026-03-29 | live (CURRENT_DATE 行为) |
| `app.v_finance_daily.stat_date` | 2026-04-27 | live (CURRENT_DATE 行为) |
## 2. 应用层B 方案 / RuntimeContext / fdw_queries / AI prompt
| 调用 | 取值 | 结果 |
|---|---|---|
| `ctx.is_sandbox` | True | PASS |
| `ctx.business_date` | 2025-09-01 | PASS / =bd |
| `ctx.business_now` | 2025-09-01 | PASS |
| `as_runtime_today_param` | 2025-09-01 | PASS |
| `as_runtime_year_month_param` | 2025-09 | PASS |
| `as_runtime_business_now_str` | 2025-09-01 12:56:29 | OK |
| `board.month range end` | 2025-09-01 | PASS / =bd |
| `board.quarter range end` | 2025-09-01 | PASS |
| `board.week range end` | 2025-09-01 | PASS |
| `pick member_ids` | [2854141942400709, 2799207305578245, 2848686922632133, 2848686922632133, 2799207290996485] | OK |
| `fdw.get_customer_board_recent(items=10)` | 2025-09-01 | PASS |
| `fdw.get_customer_board_recharge(items=10)` | 2025-09-01 | PASS |
| `fdw.get_customer_board_freq60(items=0)` | None | OK (no date in items) |
| `fdw.get_customer_board_recall(items=10)` | None | OK (no date in items) |
| `AI prompt current_time(date)` | 2025-09-01 | PASS |
## 3. 汇总
- 总检查项: 31
- PASS / OK: 31
- FAIL / ERROR: 0
- 其他: 0
**结论PASS — sandbox 模式下,所有关键读取路径都被截到 sandbox_date 之前。**