fix: surface empty OHLCV fetch as a warning, not success
Deploy / lint (push) Successful in 8s
Deploy / test (push) Successful in 1m25s
Deploy / deploy (push) Successful in 46s

Fetching a symbol the provider doesn't cover (e.g. RHM/Rheinmetall — Alpaca
serves US listings only) returned 0 bars but reported "complete · Successfully
ingested 0 records", which the UI showed as green success.

fetch_and_ingest now returns a distinct `no_data` status when the provider
returns nothing AND the ticker has no history (vs. "already up to date" when bars
exist). The fetch endpoint maps it to a `warning` source status, and the fetch
toast renders it as ⚠ with the provider message instead of success.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-28 19:27:41 +02:00
parent 6c2e45377c
commit 20a1c143f3
5 changed files with 97 additions and 4 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
import apiClient from './client';
export interface IngestionSourceResult {
status: 'ok' | 'error' | 'skipped';
status: 'ok' | 'error' | 'skipped' | 'warning';
message?: string | null;
records?: number;
classification?: string;
+6 -1
View File
@@ -25,6 +25,9 @@ export function summarizeIngestionResult(
if (info.status === 'ok') {
return `${label}`;
}
if (info.status === 'warning') {
return `${label}${info.message ? `: ${info.message}` : ': no data'}`;
}
if (info.status === 'skipped') {
return `${label}: skipped${info.message ? ` (${info.message})` : ''}`;
}
@@ -32,8 +35,10 @@ export function summarizeIngestionResult(
});
const hasError = entries.some(([, source]) => source.status === 'error');
const hasWarning = entries.some(([, source]) => source.status === 'warning');
const hasSkip = entries.some(([, source]) => source.status === 'skipped');
const toastType: IngestionToastType = hasError ? 'error' : hasSkip ? 'info' : 'success';
// A warning (e.g. 0 bars returned) must not read as success.
const toastType: IngestionToastType = hasError ? 'error' : hasWarning || hasSkip ? 'info' : 'success';
return {
toastType,