Bound backtest dataset preparation and preserve replay identity

This commit is contained in:
Boki 2026-10-21 23:18:23 -04:00
parent cca5d71e6e
commit 6bd671d92a
20 changed files with 1420 additions and 155 deletions

View file

@ -70,6 +70,12 @@ async function fixture(
impure: true,
implementation: () => new Date(),
});
db.public.registerFunction({
name: 'octet_length',
args: [DataType.text],
returns: DataType.integer,
implementation: (value: string) => Buffer.byteLength(value),
});
db.public
.none(`CREATE TYPE run_status AS ENUM ('pending','running','completed','failed','cancelled','paused');
CREATE TABLE backtests (id uuid PRIMARY KEY, name text, strategy text, symbols jsonb,
@ -742,6 +748,7 @@ describe('isolated native backtest workers', () => {
await entered;
await f.runner.stopBacktest(f.runner.getStatus().runId);
expect(await cancelled).toBeInstanceOf(BacktestCancelledError);
expect((await f.postgres.query('SELECT * FROM backtest_datasets')).rows).toHaveLength(0);
release();
await gate;
f.storage.getHistoricalBars = read;