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,42 @@
-- 20260421_app2_prewarm_cron_reschedule.sql
-- App2 财务洞察 cron 预热时间从 08:30 调整为 10:00 + 扩展为 72 组合覆盖
--
-- 背景:用户需求 2026-04-21
-- 1) 每日 10:00 为所有门店生成 board-finance 所有筛选组合下的 AI 洞察
-- 2) 筛选组合 = 8 时间维度 × 9 区域 = 72 组合/门店
-- 3) 前端根据当前筛选条件读缓存target_id=time__area
--
-- 变更:
-- 1. job_name rename: ai_dws_prewarm_0830 → ai_dws_prewarm_1000
-- 2. cron_expression: "30 8 * * *" → "0 10 * * *"
-- 3. description 更新为"72 组合"说明
--
-- 注dispatcher._handle_dws_completed 已改为遍历 72 组合,无需额外的 handler 注册。
--
-- 验证 SQL执行后
-- 1. SELECT job_name FROM biz.trigger_jobs
-- WHERE job_type = 'ai_dws_prewarm';
-- 应为 'ai_dws_prewarm_1000'
-- 2. SELECT trigger_config->>'cron_expression' FROM biz.trigger_jobs
-- WHERE job_type = 'ai_dws_prewarm';
-- 应为 '0 10 * * *'
-- 3. SELECT count(*) FROM biz.trigger_jobs WHERE job_type LIKE 'ai_%';
-- 应为 5不变
--
-- 回滚:
-- UPDATE biz.trigger_jobs
-- SET job_name = 'ai_dws_prewarm_0830',
-- trigger_config = '{"cron_expression": "30 8 * * *"}'::jsonb,
-- description = 'App2 财务洞察每日预热08:30 对所有门店触发 ai_dws_completed × 8 维度'
-- WHERE job_type = 'ai_dws_prewarm';
BEGIN;
UPDATE biz.trigger_jobs
SET
job_name = 'ai_dws_prewarm_1000',
trigger_config = '{"cron_expression": "0 10 * * *"}'::jsonb,
description = 'App2 财务洞察每日预热10:00 对所有门店触发 ai_dws_completed × 72 组合8 时间 × 9 区域)'
WHERE job_type = 'ai_dws_prewarm';
COMMIT;