Skip to content

Commit f337047

Browse files
committed
fix(status): treat customHealthCheck 'unconfigured' results consistently
Two paths produced status: 'unconfigured' on the system status dashboard but they wrote the human-readable reason to different fields: - Manifest requiredConfigKeys (MBTA, TfL, OTP, TransitLand, DB RIS, …) → wrapper writes the reason to `url` (rendered muted gray). - Custom ctx.registerHealthCheck (only Swiss currently) → wrapper forwards `error` straight through, and the dashboard renders any `error` in red regardless of status. So 'Swiss API key not configured' was the only red 'not configured' line on the page while every other one was gray. Normalize at the wrapper: when a custom check returns 'unconfigured' with an error message, hoist the message into `url` and clear `error`. Now custom checks behave like manifest checks for missing config — red is reserved for actual failures (status: 'down').
1 parent 12c5196 commit f337047

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

apps/api/src/services/integration-health.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,14 +98,20 @@ async function executeSingleHealthCheck(
9898
const start = Date.now();
9999
try {
100100
const result = await integration.customHealthCheck();
101+
// Normalize the unconfigured-with-message shape to match the
102+
// manifest `requiredConfigKeys` path: surface the reason in `url`
103+
// (rendered muted gray) rather than `error` (rendered red), so the
104+
// status dashboard treats missing config consistently regardless of
105+
// which path produced it.
106+
const isUnconfigured = result.status === "unconfigured";
101107
return {
102108
id,
103109
name,
104110
category,
105-
url: hc.url ?? "",
111+
url: isUnconfigured && result.error ? result.error : (hc.url ?? ""),
106112
status: result.status,
107113
responseTime: result.responseTime ?? Date.now() - start,
108-
error: result.error,
114+
error: isUnconfigured ? undefined : result.error,
109115
};
110116
} catch (err) {
111117
return {

0 commit comments

Comments
 (0)