feat(research): archive backtests and protect retained evidence
This commit is contained in:
parent
4a2e5ad362
commit
8cca0ee588
25 changed files with 1550 additions and 79 deletions
|
|
@ -19,6 +19,7 @@ const migrations = [
|
|||
'14-backtest-submission.sql',
|
||||
'15-canonical-paper-intents.sql',
|
||||
'16-strategy-catalog.sql',
|
||||
'17-research-retention.sql',
|
||||
];
|
||||
const cleanup: (() => Promise<void>)[] = [];
|
||||
afterEach(async () => {
|
||||
|
|
@ -134,7 +135,7 @@ async function fixture() {
|
|||
describe.skipIf(!url)('startup migrations on real PostgreSQL', () => {
|
||||
test('submission migration preserves legacy NULL-key runs and enforces complete key records', async () => {
|
||||
const f = await fixture();
|
||||
for (const filename of migrations.filter(name => name !== '14-backtest-submission.sql')) {
|
||||
for (const filename of migrations.filter(name => name < '14-backtest-submission.sql')) {
|
||||
await f.pool.query(
|
||||
readFileSync(new URL(`../../database/postgres/init/${filename}`, import.meta.url), 'utf8')
|
||||
);
|
||||
|
|
@ -160,7 +161,10 @@ describe.skipIf(!url)('startup migrations on real PostgreSQL', () => {
|
|||
null,
|
||||
]);
|
||||
await expect(
|
||||
f.pool.query("UPDATE runs SET submission_key = 'incomplete' WHERE id = $1", [runId])
|
||||
f.pool.query(
|
||||
"INSERT INTO runs(id,backtest_id,run_number,submission_key) VALUES ($1,$2,2,'incomplete')",
|
||||
[randomUUID(), backtestId]
|
||||
)
|
||||
).rejects.toThrow('runs_submission_complete');
|
||||
await f.startup().run();
|
||||
expect((await f.pool.query('SELECT * FROM runs')).rows).toHaveLength(1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue