unrip/test/operator-dashboard-app-static.test.mjs
philipp 4d9347d55f
All checks were successful
deploy / deploy (push) Successful in 34s
Keep dashboard control failures contained
Proof: Live dashboard preflight returned an empty client response because an upstream control timeout rejected outside the server catch path and restarted operator-dashboard. The server now awaits API handlers, wraps control proxy failures, and returns structured JSON errors instead of crashing.

Assumptions: A timed-out control proxy should be observable as a dashboard control failure, not as process death. Returning 504/502 JSON is safer than treating the action as successful or hiding the upstream state.

Still fake: This does not make unanswered solver quote requests fill; it only makes the dashboard control surface truthful and non-crashing for failed or timed-out controls.
2026-04-12 19:11:40 +02:00

16 lines
785 B
JavaScript

import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
const source = readFileSync(new URL('../src/apps/operator-dashboard.mjs', import.meta.url), 'utf8');
test('operator dashboard awaits API handler promises so request errors reach the top-level catch', () => {
assert.equal(source.includes('return await handleApiRequest({ req, res, url, auth });'), true);
assert.equal(source.includes('return handleApiRequest({ req, res, url, auth });'), false);
});
test('operator dashboard control proxy catches upstream failures before sending JSON response', () => {
assert.match(source, /dashboard_control_failed/);
assert.match(source, /buildDashboardControlErrorResponse/);
assert.match(source, /failure.statusCode/);
});