feat(research): cut over canonical runtime and enforce agent budgets

This commit is contained in:
Boki 2026-10-24 16:47:19 -04:00
parent ab08db82fd
commit bbf0dd4453
103 changed files with 6138 additions and 3112 deletions

View file

@ -118,7 +118,7 @@ const config = () =>
});
describe('EOD intraday ingestion → research storage', () => {
test('ingest_5m_freeze_replay: real writer/admission, v2 freeze and legacy native replay', async () => {
test('ingest_5m_freeze: real writer, v2 freeze and historical v1 compatibility', async () => {
const store = memoryStore();
const response = intradayResponse();
expect(await ingest(store.mongodb, response)).toEqual({
@ -166,7 +166,7 @@ describe('EOD intraday ingestion → research storage', () => {
).toBe(true);
expect(validateDatasetV2(JSON.parse(JSON.stringify(dataset)))).toEqual(dataset);
// V1 runtime stays V1. This checks storage compatibility, not future F06 replay correctness.
// Historical V1 payloads remain readable; production execution requires V2 admission.
const legacy = await loadDataset(storage, config());
expect(
legacy.bars.map(({ timestamp, open, high, low, close, volume }) => ({
@ -182,19 +182,10 @@ describe('EOD intraday ingestion → research storage', () => {
legacy.manifest.hash
);
const engine = new RustBacktestAdapter({ logger, storage });
try {
const first = await engine.runBacktest(config(), async () => legacy);
const second = await engine.runBacktest(config(), async () => legacy);
expect(first.status).toBe('completed');
expect(first.ohlcData[identity.eodSearchCode]).toHaveLength(78);
expect(first.ohlcData[identity.eodSearchCode]?.[0]?.timestamp).toBe(start.getTime());
expect(first.trades.length).toBeGreaterThan(0);
expect(first.trades).toEqual(second.trades);
expect(first.equity).toEqual(second.equity);
expect(first.metrics).toEqual(second.metrics);
} finally {
await engine.shutdown();
}
await expect(engine.runBacktest(config(), async () => legacy)).rejects.toThrow(
'Legacy backtest execution is retired'
);
await engine.shutdown();
});
test('supported collections, UTC seconds and half-open fractional boundaries', async () => {
@ -210,7 +201,7 @@ describe('EOD intraday ingestion → research storage', () => {
['1m', 'eodIntraday1M'],
['5m', 'eodIntraday5M'],
['1h', 'eodIntraday1H'],
]) {
] as const) {
const bars = await storage.getHistoricalBars(
identity.eodSearchCode,
new Date(start.getTime() + 1),