fix(cron): dual-case keys when loading jobs.json

jobs.json hand-edits and asdict-style snake_case for schedule intervals and
runHistory crashed or silently disabled cron. Deserialize via Cron* from_store_dict
and shared get_camel_snake (also used by local triggers).
This commit is contained in:
santhreal authored and Xubin Ren committed 2026-07-18 17:39:06 +08:00
1 parent 8c68c6fe1e
commit afed32b013
5 files changed
+135 -62

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
"""Dict key helpers for persisted JSON that mixes camelCase and snake_case."""
from __future__ import annotations
from typing import Any
def get_camel_snake(
data: dict[str, Any],
camel: str,
snake: str,
default: Any = None,
) -> Any:
"""Prefer camelCase store keys, fall back to snake_case (asdict / hand-edits)."""
if camel in data:
return data[camel]
return data.get(snake, default)