fix(monitoring): report observed research and paper readiness (O02)

This commit is contained in:
Boki 2026-10-28 12:58:38 -04:00
parent 70d173a908
commit 8c858b9d5c
23 changed files with 1340 additions and 319 deletions

View file

@ -437,7 +437,21 @@ export async function fixture(browser: Browser, native = false) {
return (async () => {
if (pathname.startsWith('/api/')) {
if (
(!pathname.startsWith('/api/v2/backtests') &&
(!(
request.method === 'GET' &&
[
'/api/system/monitoring',
'/api/system/monitoring/',
'/api/system/monitoring/readiness',
'/api/system/monitoring/cache',
'/api/system/monitoring/queues',
'/api/system/monitoring/databases',
'/api/system/monitoring/services',
'/api/system/monitoring/proxies',
'/api/system/monitoring/overview',
].includes(pathname)
) &&
!pathname.startsWith('/api/v2/backtests') &&
!pathname.startsWith('/api/v2/runs') &&
!pathname.startsWith('/api/v2/datasets') &&
!pathname.startsWith('/api/v2/strategies') &&

View file

@ -1924,11 +1924,17 @@ test('browser_cancel_failure', async () => {
f.controlled.mode = 'fail';
await f.page.getByRole('button', { name: 'Back to backtests', exact: true }).click();
await createCanonicalInBrowser(f, 'Failed browser run', true);
await visible(f.page, 'Run failed: Injected fixture worker failure');
await visible(
f.page,
'Run failed: Backtest failed during executing: Injected fixture worker failure'
);
const failedId = f.page.url().split('/').at(-1)!;
expect(
(await f.pool.query('SELECT status,error FROM runs WHERE id=$1', [failedId])).rows[0]
).toEqual({ status: 'failed', error: 'Injected fixture worker failure' });
).toEqual({
status: 'failed',
error: 'Backtest failed during executing: Injected fixture worker failure',
});
expect(
(await f.pool.query('SELECT * FROM backtest_results WHERE run_id=$1', [failedId])).rowCount
).toBe(0);
@ -4874,3 +4880,34 @@ test('isolated_candidate_publication_research_validation_and_reviewed_paper_hist
await f.close();
}
}, 180000);
test('monitoring shows unavailable research evidence and retries without retaining stale readiness', async () => {
const f = await fixture();
try {
await f.login();
await f.page.goto(`${f.origin}/system/monitoring`);
await visible(f.page, 'Research and paper diagnostics');
await visible(f.page, /Workers: Unknown/);
await visible(f.page, /Native execution: unverified until run start/);
await visible(f.page, 'Live trading: disabled.');
await visible(f.page, /Open deployment-specific paper readiness and recovery/);
expect(await f.page.getByText('Observed:', { exact: false }).count()).toBe(1);
await f.page.route('**/api/system/monitoring/readiness', route =>
route.fulfill({
status: 503,
contentType: 'application/json',
body: '{"error":"fixture unavailable"}',
})
);
await f.page.getByRole('button', { name: 'Refresh readiness', exact: true }).click();
await visible(f.page, 'Readiness diagnostics unavailable. Retry to obtain a new snapshot.');
expect(await f.page.getByText('Observed:', { exact: false }).count()).toBe(0);
await f.page.unroute('**/api/system/monitoring/readiness');
await f.page.getByRole('button', { name: 'Refresh readiness', exact: true }).click();
await visible(f.page, /Workers: Unknown/);
expect(await f.page.getByText('Observed:', { exact: false }).count()).toBe(1);
expect(f.unexpectedNetwork).toEqual([]);
} finally {
await f.close();
}
}, 60000);