From dc1ba4e7016ee6d6db7d18d92cc66a5a81bcc83e Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Wed, 11 Nov 2026 17:01:25 +0100 Subject: [PATCH] Load the backtest outcomes before the host is ready (refs #44 #45) The trading service loaded the outcomes in the background after the host reported "ready", so for a moment Strategie showed every strategy as without a backtest. CI run 219 caught it on SQLite. The host now loads them before it is ready; the call is idempotent, so the one at trading start changes nothing. Co-Authored-By: Claude Opus 5.5 --- src/Anubis.Server/AnubisHost.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Anubis.Server/AnubisHost.cs b/src/Anubis.Server/AnubisHost.cs index f6aa86a..af69e07 100644 --- a/src/Anubis.Server/AnubisHost.cs +++ b/src/Anubis.Server/AnubisHost.cs @@ -295,6 +295,12 @@ internal sealed partial class AnubisHost( overrides?.MarketHttp, overrides?.MarketSockets, logger, settings, (password, code, ct) => access.ReauthenticateAsync(password, code, ct), Path.Combine(Config.Data.Root, "STOP")) : null; + if (_trading is not null) + { + // Before "ready": the Strategie page must never show a strategy without its backtest outcome (SPEC 12.3). + await _trading.LoadOutcomesAsync(cancellationToken).ConfigureAwait(false); + } + // The laboratory computes on its own thread and reads only local data; the demo shows appendix F and runs none. _lab = options.Demo ? null : new Laboratory(_db, clock, Config.Data.Research, logger); _services = new AppServices(_db, settings, secrets, access, backups, scheduler, _market, _trading, _lab);