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

@ -15,6 +15,7 @@ import { retainResearchDataset } from '../../scripts/import-research-dataset';
import { packageBuiltinStrategies } from '../../scripts/package-builtin-strategies';
import { canonicalSettings } from '../fixtures/canonical-research';
import { canonicalSmaFixture } from '../fixtures/canonical-sma';
import { seedHistoricalRun } from '../fixtures/historical-run';
setLoggerConfig({ logLevel: 'fatal', logConsole: false });
const logger = getLogger('research-workspace');
@ -96,7 +97,7 @@ async function fixture(applyWorkspace = true, maxConnections = 10) {
},
{ autoStart: false }
);
const run = await backtests.createRun({ backtestId: definition.id });
const run = await seedHistoricalRun(pool, backtests, { backtestId: definition.id });
// Fixed old-display fixtures exercise custody/conversion, not financial simulation.
await pool.query(
`INSERT INTO backtest_results(run_id,metrics,equity_curve,ohlc_data,trades,positions,analytics,execution_time,engine)
@ -326,7 +327,7 @@ describe.skipIf(!url)('research workspace retained narratives and evidence', ()
expect(revised.updatedBy).toBe('operator');
await expect(
f.service.createHypothesis(p.id, { ...hypothesisInput, contentOrigin: 'human' }, 'service')
).rejects.toThrow('cannot declare human');
).rejects.toThrow('Only operator credentials can declare human authorship');
await expect(
f.service.reviseHypothesis(
h.id,
@ -535,7 +536,9 @@ describe.skipIf(!url)('research workspace retained narratives and evidence', ()
).rejects.toThrow();
}
const { run, definition } = await f.legacy();
const missingResult = await f.backtests.createRun({ backtestId: definition.id });
const missingResult = await seedHistoricalRun(f.pool, f.backtests, {
backtestId: definition.id,
});
await f.pool.query("UPDATE runs SET status='completed' WHERE id=$1", [missingResult.id]);
for (const bad of [
reference(randomUUID()),