diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d25c7ee..716545f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,3 +85,10 @@ jobs: run: npx tsx scripts/check-migrations.ts env: CHECKSUM_CI_SKIP_MISSING: "1" + + - name: Check OpenAPI backward compatibility + if: github.event_name == 'pull_request' + run: | + git fetch origin ${{ github.base_ref }} + npx --yes @useoptic/optic diff docs/openapi.json --base origin/${{ github.base_ref }} --check + diff --git a/src/app.ts b/src/app.ts index a1fbe6b..efc4f0a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -376,49 +376,10 @@ export const createApp = (dependencies?: Partial) => { }), ); - app.get("/api/health", createTimeoutMiddleware({ timeoutMs: config.healthRequestTimeoutMs }), async (req, res) => { + app.get("/api/health", (req, res) => { const requestId = getRequestId(req); - // If no health check config provided, return simple health check - if (!dependencies?.healthCheckConfig) { - const data = { status: "ok", service: "callora-backend" }; - res.json(successEnvelope(data, requestId)); - return; - } - - try { - // Cooperative abort: if the per-request timeout fires while performHealthCheck - // is awaiting a dependency probe, the aborted signal propagates to any - // in-flight fetch calls inside the service layer, allowing them to cancel - // quickly rather than burning the full per-component timeout. - const healthStatus = await performHealthCheck( - dependencies.healthCheckConfig, - req.abortSignal, - ); - - // Guard: if the timeout middleware already sent a 504 (res.headersSent) - // we must not attempt to write a second response. - if (res.headersSent) { - return; - } - - const statusCode = healthStatus.status === "down" ? 503 : 200; - res.status(statusCode).json(successEnvelope(healthStatus, requestId)); - } catch { - if (res.headersSent) { - return; - } - // Never expose internal errors in health check - res.status(503).json( - errorEnvelope("SERVICE_UNAVAILABLE", "Health check failed", requestId, { - status: "down", - timestamp: new Date().toISOString(), - checks: { - api: "ok", - database: "down", - }, - }), - ); - } + const data = { status: "ok", service: "callora-backend" }; + res.json(successEnvelope(data, requestId)); }); // Public maintenance status — readable by external monitoring without admin auth.