Uh oh!
There was an error while loading. Please reload this page.
feat: add DEGRADED health state - #470
Conversation
Claude finished @olivermeyer's task in 4m 24s —— View job 🎯 PR Review Complete: feat/health-degradedReviewer: Claude Code ✅ APPROVAL: EXCELLENT IMPLEMENTATIONThis PR successfully adds the 📊 Review Summary
🌟 Highlights1. Correct Semantic Implementation ⭐⭐⭐The PR correctly distinguishes between three health states:
Key implementation ( def__bool__(self) ->bool:
"""Convert health status to a boolean value. Returns: bool: True if the status is UP or DEGRADED, False otherwise. """returnself.statusin {HealthStatus.UP, HealthStatus.DEGRADED}This allows ifnothealth: # Only False for DOWN, True for UP/DEGRADED# Block operation2. Comprehensive Test Coverage ⭐⭐⭐New tests added (all properly marked with Utils module (
Platform module (
Application module (
3. Health Propagation Logic ⭐⭐Hierarchical health computation correctly implements precedence:
Implemented in 4. Specification Updates ⭐
5. Test Refactoring ⭐Excellent improvement: Extracted @contextmanagerdefsubmitted_run(runner: CliRunner, tmp_path: Path, csv_content: str) ->Iterator[str]:
"""Submit a run and cancel it during cleanup."""# ... submission logic ...try:
yieldrun_idfinally:
# Always cancel run in cleanupcancel_result=runner.invoke(cli, ["application", "run", "cancel", run_id])This prevents test pollution and ensures runs are always canceled. 🔍 Detailed Code Review✅ src/aignostics/utils/_health.pyLines 9-20: ✅ EXCELLENT - Clean enum definition
Lines 27-29: ✅ EXCELLENT - Updated docstring
Lines 82-89: ✅ EXCELLENT - DEGRADED component propagation
Lines 115-118: ✅ EXCELLENT - Validation ensures consistency
Lines 128-130: ✅ EXCELLENT - String representation includes DEGRADED
Lines 132-138: ✅ EXCELLENT - Boolean semantics (CRITICAL)
✅ src/aignostics/platform/_service.pyLines 195-229: ✅ EXCELLENT - API response parsing
Lines 231-253, 254-279: ✅ EXCELLENT - Dual health checks
✅ tests/aignostics/utils/health_test.pyLines 190-198: ✅ EXCELLENT - DEGRADED validation test
Lines 210-245: ✅ EXCELLENT - DEGRADED propagation tests
✅ tests/aignostics/platform/service_test.pyLines 143-173: ✅ EXCELLENT - DEGRADED API response tests
✅ tests/aignostics/application/cli_test.pyLines 87-119: ✅ EXCELLENT - Context manager refactoring
Lines 314-323: ✅ EXCELLENT - E2E DEGRADED behavior test
Line 326-354: ✅ GOOD - Contrasting DOWN behavior test
✅ src/aignostics/system/CLAUDE.mdLines 276-277: platform_health=health.components.get("platform")
ifnotplatform_health: # False only when DOWN (DEGRADED and UP are both truthy)print(f"Platform issue: {platform_health.reason}")Issue: If Should be: platform_health=health.components.get("platform")
ifplatform_healthisnotNoneandnotplatform_health: # Explicitly check for DOWNprint(f"Platform issue: {platform_health.reason}")Or better: platform_health=health.components.get("platform")
ifplatform_healthandplatform_health.status==Health.Code.DOWN:
print(f"Platform is DOWN: {platform_health.reason}")
elifplatform_healthandplatform_health.status==Health.Code.DEGRADED:
print(f"Platform is DEGRADED: {platform_health.reason}")✅ specifications/SPEC-UTILS-SERVICE.mdLine 154: ✅ EXCELLENT - Updated enum enum: [UP, DEGRADED, DOWN]Line 159: ✅ EXCELLENT - Clarified reason requirement description: Required reason for DOWN or DEGRADED status; must be null for UP✅ specifications/SPEC_SYSTEM_SERVICE.mdLines removed: ✅ EXCELLENT - DRY principle
🔴 Sentry Bot Comments - AddressedComment 1: |
There was a problem hiding this comment.
Pull request overview
Adds support for a DEGRADED health state across the SDK so services can report partial availability (between UP and DOWN), including platform health parsing and updated specs/tests.
Changes:
- Extend
Healthto includeDEGRADED, with aggregation logic and validation rules. - Update platform service health checks to parse
/healthJSON and returnUP/DEGRADED/DOWN. - Update specs and expand unit tests to cover
DEGRADEDbehavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/aignostics/utils/_health.py | Adds DEGRADED status, component aggregation priority, and validation/__str__ updates. |
src/aignostics/platform/_service.py | Introduces response-to-Health mapping and uses it for public/authenticated health checks. |
tests/aignostics/utils/health_test.py | Adds unit tests for DEGRADED validation, string formatting, and aggregation. |
tests/aignostics/platform/service_test.py | Adds/adjusts tests to validate JSON-body-driven health mapping including DEGRADED. |
specifications/SPEC-UTILS-SERVICE.md | Updates schema to include DEGRADED and clarifies reason requirements. |
specifications/SPEC_SYSTEM_SERVICE.md | Removes duplicated Health schema documentation. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
7076607 to
78e4b46CompareUh oh!
There was an error while loading. Please reload this page.
Codecov Report❌ Patch coverage is
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
8846014 to
e55accdCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
🎯 PR Review: feat/health-degradedReviewer: Claude Code ✅ APPROVAL: EXCELLENT IMPLEMENTATIONThis PR successfully ports the 📊 Review Summary
🌟 Highlights1. Semantic Correctness ⭐⭐⭐The implementation correctly distinguishes between three health states:
This is implemented in:
2. Comprehensive Test Coverage ⭐⭐⭐New tests added:
All tests properly marked with 3. Health Propagation Logic ⭐⭐The hierarchical health computation correctly implements:
This is recursively applied through 4. Specification Updates ⭐
🔍 Detailed Findings✅ NO BLOCKING ISSUES FOUNDAll critical checks passed:
📝 Code Review Notessrc/aignostics/utils/_health.pyLines 9-20: ✅ EXCELLENT - Clean enum definition
Lines 81-88: ✅ EXCELLENT - Degraded component propagation
Lines 114-117: ✅ EXCELLENT - Validation ensures consistency
Line 137: ✅ EXCELLENT - Boolean semantics (see inline comment)
src/aignostics/platform/_service.pyLines 195-229: ✅ EXCELLENT - API response parsing
Lines 231-253, 254-279: ✅ GOOD - Dual health checks
tests/aignostics/utils/health_test.pyLines 190-199: ✅ EXCELLENT - DEGRADED validation test
Lines 210-245: ✅ EXCELLENT - DEGRADED propagation tests
tests/aignostics/platform/service_test.pyLines 142-157: ✅ EXCELLENT - DEGRADED API response tests
tests/aignostics/application/cli_test.pyLines 217-252: ✅ EXCELLENT - E2E behavior validation
🎓 Lessons & Best Practices Demonstrated
🚀 Recommendations for Merge✅ Ready to MergeThis PR is approved for merge with no blocking issues. All quality gates passed. Optional Future Enhancements (Not Blocking)
🏆 Excellent Work!This PR demonstrates:
No changes required. Ready to merge! 🎉 Review conducted according to: CLAUDE.md standards for medical device software SDK |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
d55bd8f to
92c82d0Compare92c82d0 to
6517298CompareUh oh!
There was an error while loading. Please reload this page.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6517298 to
5650425Comparearne-aignx
commented
Mar 13, 2026
LGTM |
Uh oh!
There was an error while loading. Please reload this page.



DEGRADEDhealth state from Bridge; updating platform service to reflect this new state; updating specssubmitted_runcontext manager and always cancel run after submission