e3efbd4552
Cron matching, audit/alert date filters, and schedule UI align on Asia/Shanghai while JWT/TOTP/heartbeat stay UTC; follow-ups add WS alert timestamps, fixed install timezone copy, and 422 on invalid date filters. Co-authored-by: Cursor <cursoragent@cursor.com>
1.8 KiB
1.8 KiB
2026-06-09 — 运维时区全局北京(存储 UTC + 语义北京)
变更摘要
调度 cron/单次执行、审计日期筛选统一按 Asia/Shanghai 解释;DB/API 仍存 UTC naive。修复 cron 按 UTC 跑而界面按北京展示、单次编辑回显错误、审计「选今天」漏北京 0–8 点。
动机
运维按北京时间填时:分,runner 却在 UTC 匹配;next_run 列与表单不一致。
涉及文件
server/utils/display_time.py—operator_wall、beijing_day_range_utcserver/background/schedule_runner.py— 北京墙钟 cron 匹配server/infrastructure/database/audit_log_repo.py— 北京日界server/api/settings.py— 告警 date 筛选、utcnow修复frontend/src/utils/datetime.ts—beijingWallPartsfrontend/src/utils/scheduleCycle.ts— 与 runner 对齐frontend/src/components/schedules/ScheduleCyclePicker.vue— 时区提示tests/test_operator_tz.py、tests/test_schedule_next_run.pyfrontend/e2e/pages/schedules-timezone.spec.mjsdocs/design/specs/2026-06-09-operator-timezone-beijing-design.mddocs/design/plans/2026-06-09-operator-timezone-beijing.md
迁移 / 重启
- 无 DB 迁移;
cron_expr字符串不变,仅执行语义改为北京 - 若曾有按 UTC 时刻校准的启用调度,部署后请在调度列表核对
next_run - 需重启 API;前端需
vite build
验证方式
.venv/bin/python -m pytest tests/test_operator_tz.py tests/test_schedule_next_run.py tests/test_display_time.py -q
cd frontend && npm run type-check
NEXUS_E2E_BASE=http://127.0.0.1:8600 npx playwright test e2e/pages/schedules-timezone.spec.mjs
手工:新建「每天 02:00」循环调度 → next_run 应显示 02:00(北京),非 10:00。