A01: Per-source health affects community_scheduler overall status

Bug: community_scheduler always had status='ready' even when individual
sources were failed or stale. Success of one source masked failure of another.

Fix:
- Overall status is 'degraded' if any enabled source has failed
- Overall status is 'stale' if all sources are stale but none failed
- Overall status is 'ready' only when at least one source is healthy
- Overall status is 'not_started' when no sources are enabled
- Readiness (ready flag) still NOT blocked by import health (A01 requirement)

Verification:
- 7/7 readiness tests pass
- 121/121 Python tests pass (1 skipped)
- Failed/stale sources are now visible in JSON without blocking scheduler
This commit is contained in:
ik
2026-09-10 18:08:31 +07:00
parent 7386e7bea8
commit f2ad5ecfa3
2 changed files with 19 additions and 5 deletions
+4 -4
View File
@@ -122,8 +122,8 @@ def test_community_scheduler_stale_does_not_block_readiness() -> None:
session, AvailableStorage(), import_required=False,
import_interval_seconds=3600, community_import_interval_seconds=1800, now=now,
)
assert ready is True # A01: stale does NOT block
assert components["community_scheduler"]["status"] == "ready"
assert ready is True # A01: stale does NOT block readiness
assert components["community_scheduler"]["status"] == "stale" # Overall reflects stale source
assert components["community_scheduler"]["sources"]["rf4db"]["status"] == "stale"
assert components["community_scheduler"]["sources"]["rf4db"]["blocking"] is False
@@ -148,8 +148,8 @@ def test_community_scheduler_failed_does_not_block_readiness() -> None:
session, AvailableStorage(), import_required=False,
import_interval_seconds=3600, community_import_interval_seconds=1800, now=now,
)
assert ready is True # A01: failed does NOT block
assert components["community_scheduler"]["status"] == "ready"
assert ready is True # A01: failed does NOT block readiness
assert components["community_scheduler"]["status"] == "degraded" # Overall reflects failed source
assert components["community_scheduler"]["sources"]["rf4db"]["status"] == "failed"
assert components["community_scheduler"]["sources"]["rf4db"]["blocking"] is False