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)
Changelog: docs/changelog/2026-06-09-operator-timezone-beijing.md
报告: docs/reports/2026-06-09-operator-timezone-beijing-audit.md
变更文件清单
| 文件 | 说明 |
|---|---|
server/utils/display_time.py |
operator_wall、beijing_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.ts |
beijingWallParts |
frontend/src/utils/scheduleCycle.ts |
与 runner 对齐 |
ScheduleCyclePicker.vue |
北京时间提示 |
tests/test_operator_tz.py |
运维时区单测 |
tests/test_schedule_next_run.py |
更新北京语义断言 |
Step 3 规则扫描
| 规则 | 结论 |
|---|---|
| PY-11 naive/aware | PASS — to_naive_utc / ensure_utc |
| 调度双触发 | PASS — 60s 冷却保留 |
| SQL 注入 | PASS — 日期 fromisoformat,无拼接 |
| 静默吞错 | RISK-P3 — 非法 date 仍 pass(沿用旧模式) |
| 存量 cron 语义 | RISK-P2 — 无迁移;部署后人工核对调度列表 |
Closure
| 项 | 结果 |
|---|---|
test_operator_tz.py |
passed |
test_schedule_next_run.py |
passed |
scripts/local_verify.sh |
All local checks passed |
npm run type-check |
passed |
| ruff F | 0 violations |
DoD
- cron 按北京时间匹配,
next_run与表单时:分一致 cycleFromSchedule用parseApiDateTime+ 北京时:分- 审计
date_from覆盖北京当日 00:00–23:59 - design spec + plan + changelog
- 生产部署后人工核对启用中的调度(用户确认几乎无)