Fix what the review of Phase 9 found in accounts, access, capital, health and publication
A position left out together with its stop kept the account prudent for good: the stop was still asked for shares that no longer exist. The cover required now stops at what the account holds, the stops are compared again after the choice, and where one is still missing Align takes the excluded position up again. After the choice the account waits for the stop with its own reason, so it returns to normal by itself also past the 15 minutes; a new difference still gets its own 15 minutes. A right password alone no longer clears the wrong second-factor codes: it takes back only its own attempt. Capital and shares are planned and written in one transaction, so overlapping changes cannot apply twice and an interruption leaves nothing halfway; sending the same figures again completes what an old one left. The cash that purchases under way still hold is no longer given away, counted as the risk engine counts it. /health said healthy when the trading engine had failed to start. It now says so at once, or after ten minutes of a stalled start, and the host tries the start again every minute; the guard still sees a start that does not move. The image of the manual publication says its version and its commit, marked when the tree is dirty, and publish.sh refuses before any login an image that does not come from the commit of the tag. refs #75 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
24e20584d4
commit
81d6c5f667
20 files changed
+814
-174
No files matched your search
@@ -23,4 +23,49 @@ public sealed class HealthEndpointTests
|
||||
Assert.AreEqual(AnubisInfo.Name, body.Name);
|
||||
Assert.AreEqual(AnubisInfo.Version, body.Version);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Integration)]
|
||||
public async Task AnEngineThatCouldNotStartIsNotHealthyAndIsTriedAgain()
|
||||
{
|
||||
var (env, postgres) = await ServerHarness.DockerOnEngineAsync();
|
||||
await using var engine = postgres;
|
||||
await using var server = await ServerHarness.StartAsync("docker", env, trading: true);
|
||||
async Task<HealthResponse> HealthAsync()
|
||||
{
|
||||
using var response = await server.GetAsync("/health");
|
||||
return (await response.Content.ReadFromJsonAsync<HealthResponse>())!;
|
||||
}
|
||||
|
||||
async Task UntilAsync(string status, string loop)
|
||||
{
|
||||
HealthResponse? last = null;
|
||||
for (var i = 0; i < 100; i++)
|
||||
{
|
||||
last = await HealthAsync();
|
||||
if (last.Status == status && last.Checks!.GetValueOrDefault("motore") == loop)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await Task.Delay(100);
|
||||
}
|
||||
|
||||
Assert.Fail($"{last!.Status}, {string.Join(", ", last.Checks!)}");
|
||||
}
|
||||
|
||||
await UntilAsync("ok", "ok");
|
||||
|
||||
// The services start again and the engine's startup fails at its first steps: ready, but nothing watches the stops.
|
||||
var db = server.Host.Services!.Db;
|
||||
await db.WriteAsync(s => s.ExecuteAsync("ALTER TABLE instruments RENAME TO instruments_away"));
|
||||
await server.Host.RestartServicesAsync(CancellationToken.None);
|
||||
await server.WaitForAsync(HostMode.Ready);
|
||||
await UntilAsync("unavailable", "non avviato");
|
||||
|
||||
// The cause goes away: the start is tried again by itself.
|
||||
await server.Host.Services!.Db.WriteAsync(s => s.ExecuteAsync("ALTER TABLE instruments_away RENAME TO instruments"));
|
||||
await UntilAsync("ok", "ok");
|
||||
Assert.IsTrue(server.Host.Services!.Trading!.IsStarted);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user