Adds GET /api/health so the ChicoryTV SPA shell footer and Dashboard (#109) can show server health. Wraps the existing health-check subsystem (IHealthCheckService.PerformHealthChecks) — same source, filtering and cancellation semantics as the Blazor dashboard on /.
Endpoint
GET /api/health (route name GetHealthChecks, group general) → 200 [{title, status, detail, link?}], status ∈ pass|fail|warn|info; NotApplicable checks are filtered out; link is nullable (OpenAPI 3.1 ["null","string"]).
Notes
Started from the salvaged WIP commit; rebased onto main (post-#113). Fixed a real bug in the WIP: Option.Match returning null throws LanguageExt ResultIsNullException for every check without a link → MatchUnsafe.
HealthCheckResponseModel introduces file-scoped #nullable enable in ErsatzTV.Core/Api for the genuinely-nullable Link — first DTO there to need it.
Each request re-runs all ~14 checks (identical to Blazor per page load; only the warn/error summary is cached) — the SPA should not poll aggressively; noted on #108/#109.
OpenAPI regenerated via scripts/update-openapi.sh.
Review
Adversarial review verdict: APPROVE, no blockers/majors. Applied the one minor (unreachable NotApplicable→\"info\" mapper arm now throws instead of silently masking a missing filter). Tests: 278/278 pass (TZ=UTC).
## Summary
Adds `GET /api/health` so the ChicoryTV SPA shell footer and Dashboard (#109) can show server health. Wraps the existing health-check subsystem (`IHealthCheckService.PerformHealthChecks`) — same source, filtering and cancellation semantics as the Blazor dashboard on `/`.
## Endpoint
- `GET /api/health` (route name `GetHealthChecks`, group `general`) → `200 [{title, status, detail, link?}]`, `status` ∈ `pass|fail|warn|info`; `NotApplicable` checks are filtered out; `link` is nullable (OpenAPI 3.1 `["null","string"]`).
## Notes
- Started from the salvaged WIP commit; rebased onto main (post-#113). Fixed a real bug in the WIP: `Option.Match` returning `null` throws LanguageExt `ResultIsNullException` for every check without a link → `MatchUnsafe`.
- Controller matches the #97/#105 parameterless-GET pattern (typed return, `Name`, `[Tags]`, `[EndpointSummary]`, `[EndpointGroupName]`).
- `HealthCheckResponseModel` introduces file-scoped `#nullable enable` in `ErsatzTV.Core/Api` for the genuinely-nullable `Link` — first DTO there to need it.
- Each request re-runs all ~14 checks (identical to Blazor per page load; only the warn/error summary is cached) — the SPA should not poll aggressively; noted on #108/#109.
- OpenAPI regenerated via `scripts/update-openapi.sh`.
## Review
Adversarial review verdict: **APPROVE**, no blockers/majors. Applied the one minor (unreachable `NotApplicable→\"info\"` mapper arm now throws instead of silently masking a missing filter). Tests: 278/278 pass (`TZ=UTC`).
fixes #108
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Fix the WIP health-check API slice to match established patterns:
- HealthController: add Name="GetHealthChecks" route name and move
[EndpointGroupName("general")] to method level, matching
FillerPresetController/FFmpegProfileController exactly (the
precedent for parameterless 200-only GET actions).
- HealthCheckResponseModel: enable #nullable for the file and mark
Link as string? since the mapper can emit null when
HealthCheckResult.Link is None.
- Mapper: fix a real bug - LanguageExt's Option.Match throws
ResultIsNullException.ResultIsNull if either branch returns null
(by design, to catch accidental nulls). The WIP's
`Link.Match(l => l.Link, () => null)` crashed on every health
check without a Link. Switch to MatchUnsafe, the LanguageExt-
sanctioned way to intentionally produce a nullable result from
Option<T>.
- HealthControllerTests: add the idiomatic-route-assertion test
(route template + Name) and empty-list case, matching
FillerPresetControllerTests.
Verified: GetAllHealthCheckResultsForApiHandler already matches the
existing GetAllHealthCheckResultsHandler's cancellation handling
(both swallow TaskCanceledException/OperationCanceledException), so
no change was needed there. Confirmed no OpenApi contract test
enumerates all endpoints for error-response metadata (it's an
explicit TestCase allowlist), so the new GET needed no new entries.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review finding: NotApplicable is filtered by the handler before mapping,
so a silent ->"info" arm would only mask a missing filter if the mapper
is ever reused unfiltered.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
timothy
merged commit 335a8b8a77 into main2026-07-03 21:28:13 +02:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Summary
Adds
GET /api/healthso the ChicoryTV SPA shell footer and Dashboard (#109) can show server health. Wraps the existing health-check subsystem (IHealthCheckService.PerformHealthChecks) — same source, filtering and cancellation semantics as the Blazor dashboard on/.Endpoint
GET /api/health(route nameGetHealthChecks, groupgeneral) →200 [{title, status, detail, link?}],status∈pass|fail|warn|info;NotApplicablechecks are filtered out;linkis nullable (OpenAPI 3.1["null","string"]).Notes
Option.Matchreturningnullthrows LanguageExtResultIsNullExceptionfor every check without a link →MatchUnsafe.Name,[Tags],[EndpointSummary],[EndpointGroupName]).HealthCheckResponseModelintroduces file-scoped#nullable enableinErsatzTV.Core/Apifor the genuinely-nullableLink— first DTO there to need it.scripts/update-openapi.sh.Review
Adversarial review verdict: APPROVE, no blockers/majors. Applied the one minor (unreachable
NotApplicable→\"info\"mapper arm now throws instead of silently masking a missing filter). Tests: 278/278 pass (TZ=UTC).fixes #108
🤖 Generated with Claude Code
Fix the WIP health-check API slice to match established patterns: - HealthController: add Name="GetHealthChecks" route name and move [EndpointGroupName("general")] to method level, matching FillerPresetController/FFmpegProfileController exactly (the precedent for parameterless 200-only GET actions). - HealthCheckResponseModel: enable #nullable for the file and mark Link as string? since the mapper can emit null when HealthCheckResult.Link is None. - Mapper: fix a real bug - LanguageExt's Option.Match throws ResultIsNullException.ResultIsNull if either branch returns null (by design, to catch accidental nulls). The WIP's `Link.Match(l => l.Link, () => null)` crashed on every health check without a Link. Switch to MatchUnsafe, the LanguageExt- sanctioned way to intentionally produce a nullable result from Option<T>. - HealthControllerTests: add the idiomatic-route-assertion test (route template + Name) and empty-list case, matching FillerPresetControllerTests. Verified: GetAllHealthCheckResultsForApiHandler already matches the existing GetAllHealthCheckResultsHandler's cancellation handling (both swallow TaskCanceledException/OperationCanceledException), so no change was needed there. Confirmed no OpenApi contract test enumerates all endpoints for error-response metadata (it's an explicit TestCase allowlist), so the new GET needed no new entries. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>