T-57: M1.3b — trial_ledger + vault_evaluations append-only PostgreSQL migration (research track)

This commit is contained in:
Studio 2026-11-27 17:00:13 -05:00 • committed by Boki
parent 0c7a2c14a5
commit ed56ec1bbf

View file

@ -3,6 +3,7 @@ import { getLogger, setLoggerConfig } from '@stock-bot/logger';
import type { MongoDBClient, QuestDBClient } from '@stock-bot/services';
import { fetchIntraday } from '../../apps/stock/data-ingestion/src/handlers/eod/actions/intraday';
import type { EodHandler } from '../../apps/stock/data-ingestion/src/handlers/eod/eod.handler';
import { EOD_CONFIG } from '../../apps/stock/data-ingestion/src/handlers/eod/shared/config';
import { RustBacktestAdapter } from '../../apps/stock/orchestrator/src/backtest/RustBacktestAdapter';
import {
loadDataset,
@ -88,6 +89,8 @@ async function ingest(mongodb: MongoDBClient, bars = intradayResponse()) {
expect(url.searchParams.get('to')).toBe(String(end.getTime() / 1000));
return Response.json(bars);
};
const previousToken = EOD_CONFIG.API_TOKEN;
EOD_CONFIG.API_TOKEN = 'test-fixture-token';
const request = spyOn(globalThis, 'fetch').mockImplementation(
Object.assign(fakeFetch, { preconnect: globalThis.fetch.preconnect })
);
@ -99,6 +102,7 @@ async function ingest(mongodb: MongoDBClient, bars = intradayResponse()) {
toDate: end,
});
} finally {
EOD_CONFIG.API_TOKEN = previousToken;
request.mockRestore();
}
}