DC-130 rev2: fail-fast bridge bindings (host), /status gateway-error mapping (401/403/unreachable -> 502, probe-failure stays ok:false) + 3 new tests (13 total)
CI / Test & Lint (push) Waiting to run
CI / Security audit (push) Waiting to run

This commit is contained in:
DashCaddy Polish Loop
2026-09-14 04:11:30 -07:00
parent 0ab1dfe6e5
commit 121caef488
2 changed files with 60 additions and 3 deletions
+21 -3
View File
@@ -117,9 +117,27 @@ module.exports = function ({ asyncHandler, log, auditLogger, fetchT }) {
if (!SERVICE_RE.test(service)) {
return errorResponse(res, 400, 'invalid service name');
}
const { status, body } = await bridge('GET', `/api/status?service=${encodeURIComponent(service)}`);
// shipdeck status exits non-zero when checks fail — surface that as ok:false
// with the probe output so the UI can render the failing checks.
let status, body;
try {
({ status, body } = await bridge('GET', `/api/status?service=${encodeURIComponent(service)}`));
} catch (e) {
log.error('deploys', 'status probe: bridge unreachable', { service, error: e.message });
return errorResponse(res, 502, 'shipdeck bridge unreachable: ' + e.message);
}
if (status === 401 || status === 403) {
// bridge auth/protocol failure = infrastructure problem, NOT a probe result
log.error('deploys', 'status probe: bridge auth failed', { service, status });
return errorResponse(res, 502, 'shipdeck bridge rejected the request (auth/config error)');
}
if (status >= 500 && body && body.ok === false && body.output) {
// shipdeck status exits non-zero when checks fail — that's an EXPECTED
// probe result (failing checks), surface as ok:false with the output.
return ok(res, { ok: false, output: body.output || '' });
}
if (status !== 200) {
// malformed upstream route or other unexpected bridge failure
return errorResponse(res, 502, body && body.error ? body.error : 'unexpected bridge response');
}
return ok(res, { ok: body.ok === true, output: body.output || '' });
}));