fix(cron): report reconciled startup job count

This commit is contained in:
chengyongru
2026-08-22 02:38:47 +08:00
committed by chengyongru
parent 20488a585d
commit dbc1801d3c
4 changed files with 10 additions and 27 deletions
-7
View File
@@ -786,8 +786,6 @@ def test_remove_job_refuses_system_jobs(tmp_path) -> None:
def test_remove_system_job_retires_persisted_system_job(tmp_path) -> None:
"""Disabling a system job (e.g. gateway.heartbeat.enabled=false) must
actually retire the previously persisted job, not just skip registration."""
store_path = tmp_path / "cron" / "jobs.json"
service = CronService(store_path)
service.register_system_job(CronJob(
@@ -802,12 +800,8 @@ def test_remove_system_job_retires_persisted_system_job(tmp_path) -> None:
assert removed is True
assert service.get_job("heartbeat") is None
# Removal must persist: a fresh instance (next gateway start) must not
# resurrect the job from the on-disk store.
assert CronService(store_path).get_job("heartbeat") is None
# Idempotent: removing a missing system job reports False without raising.
assert service.remove_system_job("heartbeat") is False
# User-facing removal still protects remaining system jobs.
other = CronService(store_path)
other.register_system_job(CronJob(
id="dream",
@@ -819,7 +813,6 @@ def test_remove_system_job_retires_persisted_system_job(tmp_path) -> None:
def test_remove_system_job_without_store_file(tmp_path) -> None:
"""Fresh install with the system job disabled: no jobs.json exists yet."""
store_path = tmp_path / "cron" / "jobs.json"
service = CronService(store_path)