Repository navigation
fix(exports): replace stub health probes with real dependency checks … - #1665
Merged
greatest0fallt1me merged 1 commit intoNov 26, 2026
Merged
Conversation
|
@Thadd102 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
|
Thanks @Thadd102! Merged. 🎉 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1574
Replaces the four stub health probes in
GET /api/exports/health(src/routes/exports/health.ts) with real database, object-storage, worker-queue, and notification API checks with timeouts, secret sanitization, and failure-path tests.Changes
probeDatabase): ExecutesSELECT 1againstpoolfromsrc/db.tswith a timeout guard; reportsdegradedwhen latency exceedsDB_DEGRADED_THRESHOLD_MS(1000 ms) anddownon error or timeout.probeStorage): Returnsokwithdetail: 'exports disabled'whenconfig.exports.enabledis false. When enabled, validatesconfig.exports.endpointviavalidateStorageEndpoint, issues aHEADrequest to the configured bucket with anAbortControllertimeout, reportsdegradedon non-auth 4xx, anddownon 401/403, 5xx, validation failure, network error, or timeout.probeQueue): ExposesgetWorkerStatus()onReportExporterWorkerandScheduledExportsWorker(state,intervalMs,lastTickAt,lastTickAgeMs,lastError). Returnsok(exports disabled) when exports are disabled; when enabled, reportsdownif no workers are registered, a worker is stopped, or its last tick is stale, anddegradedif a running worker has recorded an error.probeNotificationApi): Performs an HTTPGETto the new optionalEXPORTS_NOTIFICATION_HEALTH_URLenv var using anAbortControllertimeout; skipped asokwith detail when unset.sanitizeDetail()to redact URL credentials, bearer/basic tokens, sensitive query parameters, andconfig.exports.signingSecretfromdetailstrings. HardenedwithTimeout()to catch synchronous throws without leaking timers.EXPORTS_NOTIFICATION_HEALTH_URLtosrc/config/execution-env.ts,src/config/core-settings.ts, and.env.example.src/routes/exports/health.test.tswith success and failure-path tests for all four probes (rejections, timeouts withjest.useFakeTimers(), non-2xx responses, slow-but-ok DB, invalid endpoint config, synchronous throws, live worker status integration, and secret redaction).Acceptance Criteria Checklist
TODOremains insrc/routes/exports/health.tsdownwith sanitizeddetailwithin the timeout, and overall status is derived viaderiveOverallStatusoverall,dependencies,checkedAt,correlationId) is unchangedProbeRegistryTesting
npm test -- src/routes/exports/health.test.ts(71/71 passing)npm test -- src/services/reportExporter.test.ts src/services/scheduledExports.test.ts(20/20 passing)npx eslint src/routes/exports/health.ts src/routes/exports/health.test.ts src/services/reportExporter.ts src/services/scheduledExports.ts src/config/execution-env.ts src/config/core-settings.ts(0 errors)npm run typecheck(0 errors in touched files)