fix: stabilize cron scheduling and run history

This commit is contained in:
Winnie
2026-08-17 18:55:31 +08:00
parent 23823325e6
commit ff700d8db4
16 changed files with 320 additions and 55 deletions
+4 -4
View File
@@ -35,10 +35,10 @@ from common.db.models import (
from common.eventing import add_outbox_event, schedule_event_type, utcnow
from common.ids import new_ulid
# A stable user_id used for cron-triggered runs. The corresponding
# ``Users`` row is seeded by the auth-bootstrap migration so any audit
# query joining on ``ScheduleRuns.triggered_by`` still resolves.
SYSTEM_CRON_USER_ID = "01HZZZZZZZZZZZZZZZZZZZZZZCR"
# Cron 运行需要一个可审计的 ``triggered_by``。这里使用基线迁移已经创建的
# 管理员用户;该值必须是 26 个字符,才能写入 ``ScheduleRuns.triggered_by``
# 的 ``CHAR(26)`` 字段。
SYSTEM_CRON_USER_ID = "00000000000000000000000001"
TriggerType = Literal["manual", "cron", "api"]