fix(SEC-ORCH-16): Implement real health and readiness checks

- Add ping() method to ValkeyClient and ValkeyService for health checks
- Update HealthService to check Valkey connectivity before reporting ready
- /health/ready now returns 503 if dependencies are unhealthy
- Add detailed checks object showing individual dependency status
- Update tests with ValkeyService mock

Refs #339

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jason Woltje
2026-02-05 19:20:07 -06:00
parent 22446acd8a
commit 89bb24493a
6 changed files with 121 additions and 14 deletions

View File

@@ -1,6 +1,6 @@
import { Controller, Get, UseGuards } from "@nestjs/common";
import { Controller, Get, UseGuards, HttpStatus, HttpException } from "@nestjs/common";
import { Throttle } from "@nestjs/throttler";
import { HealthService } from "./health.service";
import { HealthService, ReadinessResult } from "./health.service";
import { OrchestratorThrottlerGuard } from "../../common/guards/throttler.guard";
/**
@@ -26,8 +26,13 @@ export class HealthController {
@Get("ready")
@Throttle({ status: { limit: 200, ttl: 60000 } })
ready(): { ready: boolean } {
// NOTE: Check Valkey connection, Docker daemon (see issue #TBD)
return { ready: true };
async ready(): Promise<ReadinessResult> {
const result = await this.healthService.isReady();
if (!result.ready) {
throw new HttpException(result, HttpStatus.SERVICE_UNAVAILABLE);
}
return result;
}
}