fix: retain stock identities in research and AI task lists

This commit is contained in:
2026-10-09 23:08:47 +08:00
parent 9d56f6169a
commit c8c61d29bf
9 changed files with 29 additions and 7 deletions
@@ -129,6 +129,11 @@ func testCandidateAI(t *testing.T, ctx context.Context, pool *pgxpool.Pool, admi
if err != nil || len(results) != 4 {
t.Fatal("durable results missing", err, len(results))
}
for _, result := range results {
if result.Name != "Fixture" || result.Symbol != "000042" || result.Exchange != "SZSE" {
t.Fatal("analysis task lost candidate identity")
}
}
}
type rejectModel struct{ calls int }
@@ -95,6 +95,10 @@ func testStrategyBacktest(t *testing.T, ctx context.Context, pool *pgxpool.Pool,
if e != nil || done.Status != "COMPLETED" || done.FinishedAt == nil || len(done.Result) == 0 {
t.Fatalf("completed job: %v", e)
}
listed, e := repo.List(ctx)
if e != nil || len(listed) != 1 || listed[0].Symbol != bi.Symbol || listed[0].Input != nil || listed[0].Result != nil {
t.Fatal("backtest list must retain the symbol without returning large inputs")
}
if _, e := pool.Exec(ctx, `UPDATE veyra_backtest_run SET result='{}'::jsonb WHERE id=$1`, job.ID); e == nil {
t.Fatal("completed result can be overwritten")
}