Repository navigation
test(daemon): per-tier health check failure and recovery (#1146) - #1151
Conversation
Adds tests/unit/daemon/test_health_check_paths.py covering all 13 registered checks in polylogue/daemon/health.py: OK path on a healthy synthetic fixture plus at least one representative degraded path per check. Three checks (one per tier) also pin the recovery transition with consecutive_failures reset: daemon_liveness (FAST), raw_failures (MEDIUM), db_integrity (EXPENSIVE). Every test records daemon.health.<check_name> evidence via record_contract_evidence with severity_before, severity_after, and consecutive_failures. EXPENSIVE-tier tests are marked @pytest.mark.slow so default devtools verify selection stays fast. Synthetic-only: monkeypatches polylogue.daemon.status helpers and stubs PRAGMA integrity_check + BlobStore.verify_all; DB-backed checks (FTS, schema_version, repeated_stage_failures) use minimal in-tmp SQLite files. No private archive paths or real user data. Closes #1146. Ref #999. Co-Authored-By: Claude <[email protected]>
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR adds a comprehensive unit test module that validates health-check behavior across all FAST, MEDIUM, and EXPENSIVE tiers in ChangesDaemon health check comprehensive path coverage
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related issues
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Adds
tests/unit/daemon/test_health_check_paths.pycovering each of the13 registered health checks in
polylogue/daemon/health.pywith an OKpath and a representative degraded path. Three checks (one per tier)
also pin the recovery transition with
consecutive_failuresreset.Problem
#999 (resurrected from #830) shipped tiered health checks (FAST /
MEDIUM / EXPENSIVE) across ~10 individual checks, but the existing
suite only covered the aggregation surface (
test_health_contracts.py)plus a handful of HTTP envelope tests. Individual checks could silently
report
HealthSeverity.OKfor every input and the aggregation testswould still pass. #1146 — first Scope item on #999 — calls for per-tier
failure-and-recovery evidence so regressions in tier severity,
escalation counters (
consecutive_failuresvia_record_failure),and recovery transitions become visible before they hit production.
Solution
tests/unit/daemon/test_health_check_paths.pyexercises all 13registered checks:
daemon_liveness(with recovery),disk_space,wal_size,source_availability,schema_version.fts_readiness,raw_failures(with recovery),stale_ingest_attempts,insight_freshness,repeated_stage_failures.db_integrity(with recovery),blob_integrity,embedding_coverage.daemon_liveness,raw_failures,db_integrity)force the degraded path, confirm
consecutive_failuresincrements,then force the OK path and confirm the counter resets to zero —
exercising the three distinct
_record_failureinvocation patternsused across
health.py._reset_failure_counts) clears the module-level_failure_countsmap so escalation counts never leak between tests.daemon.health.<check_name>evidence artifactvia
record_contract_evidence(tests/infra/contract_evidence.py,test(contracts): emit pytest evidence artifacts for surface contracts #1060) with bounded fields:
severity_before,severity_after,consecutive_failures,tier.@pytest.mark.slowso the defaultdevtools verifypytest selection stays fast._raw_failure_info,_live_ingest_attempt_summary_info,_insight_freshness_info,_embedding_readiness_info,_check_daemon_liveness) andBlobStore.verify_allare monkey-patched; DB-backed checks (FTS gap,schema version, repeated stage failures, integrity recovery) write
small SQLite files under
workspace_env's tmp archive root. Noprivate archive paths or real user data are referenced.
the seams needed for synthetic coverage.
Verification
Closes #1146. Ref #999.
Summary by CodeRabbit