feat(backtests): separate saving from retry-safe run submission

This commit is contained in:
Boki 2026-10-22 17:01:46 -04:00
parent 5eb0985057
commit 9b9403e36b
18 changed files with 1200 additions and 226 deletions

View file

@ -64,7 +64,8 @@ export const backtestApiV2 = {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(request),
// Web saves are deliberately separate from durable run submission.
body: JSON.stringify({ ...request, autoStart: false }),
});
if (!response.ok) {
@ -123,11 +124,16 @@ export const backtestApiV2 = {
},
// Run operations
async createRun(backtestId: string, request?: CreateRunRequest): Promise<Run> {
async createRun(
backtestId: string,
request?: CreateRunRequest,
submissionKey?: string
): Promise<Run> {
const response = await fetch(`${API_BASE_URL}/api/v2/backtests/${backtestId}/runs`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
...(submissionKey ? { 'Idempotency-Key': submissionKey } : {}),
},
body: JSON.stringify(request || {}),
});