Rebuild the state from the brokers after a restore and refuse an older copy

A restore, an import or an adopted database restarts protected: the engine
stays stopped, reads from the broker what the archive does not know (orders,
stops, executions, also from the OKX history up to 89 days), cancels orders
left working, protects what it finds and waits for the user. Strategies with
real money stay exit only until confirmed again. The database of before the
restore, put back by mistake, is refused by its fingerprint.

A failed migration leaves the engine off with one backup and a way to try
again; an archive is checked whole before the database is touched; a changed
secret key no longer crashes anything, and "anubis access reset" gives the
access back to whoever holds the computer. The image runs the db and access
commands without the guard.

refs #69

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 18:52:08 +01:00
1 parent 3da9b00f44
commit 4897594b87
40 files changed
+1871 -90

No files matched your search

+7 -1
View File
@@ -40,6 +40,9 @@ internal sealed record PanoramaView(
LearningSummary Learning,
DateTimeOffset? FractionStops)
{
/// <summary>After a restore the bot waits for the user (SPEC 15.1).</summary>
public bool ProtectedRestart { get; init; }
private static readonly CultureInfo _it = CultureInfo.InvariantCulture;
/// <summary>"Notizie che contano" (SPEC 13.6): first those with an effect in force, then the latest on the positions or their markets.</summary>
@@ -97,7 +100,10 @@ internal sealed record PanoramaView(
{
var board = await new Anubis.News.NewsBoard(services.Db, clock, services.Settings).LoadAsync(cancellationToken).ConfigureAwait(false);
return new PanoramaView(accounts, trends, limits, kept, cards, anyLive, system, null, null, Decision(overview.NextDecision, shell.Now, shell.Zone),
services.MarketData is null && board.Rows.Count == 0 ? null : Matters(board, shell), learning, fractions);
services.MarketData is null && board.Rows.Count == 0 ? null : Matters(board, shell), learning, fractions)
{
ProtectedRestart = risk.ProtectedRestart is not null,
};
}
var root = aggregates.RootElement;