feat(research): run durable chronological validation and retain reports

This commit is contained in:
Boki 2026-10-24 12:03:41 -04:00
parent 67ab30cb7a
commit abd1c5b83d
42 changed files with 5345 additions and 74 deletions

View file

@ -118,10 +118,7 @@ export class ExperimentsService {
return prepareChronologicalValidation(input, source, dataset).preview;
});
}
private async lockedPreview(
client: PoolClient,
input: ExperimentInput
): Promise<ExperimentPreview> {
async lockedPreview(client: PoolClient, input: ExperimentInput): Promise<ExperimentPreview> {
const parent = (
await client.query('SELECT * FROM backtests WHERE id=$1 FOR UPDATE', [input.backtestId])
).rows[0];
@ -272,7 +269,7 @@ export class ExperimentsService {
}
const rows = await this.database.query(
`SELECT ${summaryColumns} FROM research_experiments e
${backtestId === undefined ? '' : 'WHERE e.backtest_id=$1'} ORDER BY e.created_at DESC,e.id DESC`,
WHERE e.validation_phase IS NULL ${backtestId === undefined ? '' : 'AND e.backtest_id=$1'} ORDER BY e.created_at DESC,e.id DESC`,
backtestId === undefined ? [] : [backtestId]
);
return rows.rows.map(summary);
@ -482,7 +479,7 @@ export class ExperimentsService {
return { retry: mapExperimentRetry(saved), experiment: await this.readDetail(client, id) };
});
}
private async readDetail(database: Query, id: string): Promise<ExperimentDetail> {
async readDetail(database: Query, id: string): Promise<ExperimentDetail> {
const row = (
await database.query(
`SELECT ${summaryColumns},e.preview FROM research_experiments e WHERE e.id=$1`,