Files
Nexus/docs/changelog/2026-06-09-operator-timezone-beijing.md
T
Nexus Agent e3efbd4552 feat(timezone): operator schedules and filters use Beijing wall clock.
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>
2026-06-09 05:50:32 +08:00

1.8 KiB
Raw Blame History

2026-06-09 — 运维时区全局北京(存储 UTC + 语义北京)

变更摘要

调度 cron/单次执行、审计日期筛选统一按 Asia/Shanghai 解释;DB/API 仍存 UTC naive。修复 cron 按 UTC 跑而界面按北京展示、单次编辑回显错误、审计「选今天」漏北京 0–8 点。

动机

运维按北京时间填时:分,runner 却在 UTC 匹配;next_run 列与表单不一致。

涉及文件

  • server/utils/display_time.pyoperator_wallbeijing_day_range_utc
  • server/background/schedule_runner.py — 北京墙钟 cron 匹配
  • server/infrastructure/database/audit_log_repo.py — 北京日界
  • server/api/settings.py — 告警 date 筛选、utcnow 修复
  • frontend/src/utils/datetime.tsbeijingWallParts
  • frontend/src/utils/scheduleCycle.ts — 与 runner 对齐
  • frontend/src/components/schedules/ScheduleCyclePicker.vue — 时区提示
  • tests/test_operator_tz.pytests/test_schedule_next_run.py
  • frontend/e2e/pages/schedules-timezone.spec.mjs
  • docs/design/specs/2026-06-09-operator-timezone-beijing-design.md
  • docs/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。