Phase 10: new course and Docker only
Record the course the user chose on 2 December 2026 and make the container the only form of Anubis. - ADR 0021-0026: new roadmap (phases 10-24, readings per phase, the spec-to-ADR table, merge and tag only after the user's yes), Docker only, maths-only decisions, bans turned into limits on margin accounts, eToro Demo as currency venue and forward tests, strategy championship. ROADMAP rewritten from phase 10; STATE, CLAUDE.md, SVILUPPO, README, API-NOTES and the manuals without the desktop. - Remove the desktop: Anubis.Desktop, Anubis.Setup, deploy/windows, release-win and desktop-win, config.toml, PlatformKind, ANUBIS_PLATFORM, DPAPI with the ProtectedData package and the first-run wizard. Outside a container the server needs --data-dir, listens on 127.0.0.1 only and refuses foreign hosts; server and guard refuse --platform desktop with an Italian message and exit code 2. The demo keeps its key in a file and its error-page choices need no startup password. The diagnostics report says where the server runs from its own environment. - Lighter image: restore and publish for linux-x64 only, and leave out the Windows libraries ONNX Runtime copies anyway (829 MB to 410 MB on disk, /app from 282 MB to 42 MB). Rotating Docker logs in the Unraid template, the manual and the compose; backtest and learning run as one-shot commands. tasks dev uses artifacts/dev-data. refs #113 #114 #115 #78 #80 #81 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3c57b3e84c
commit
e9ac6dccc9
95 files changed
+1426
-1604
No files matched your search
@@ -1,8 +1,9 @@
|
||||
using Anubis.Demo;
|
||||
using Anubis.Platform;
|
||||
|
||||
namespace Anubis.Tests;
|
||||
|
||||
/// <summary>Startup configuration in Docker and on desktop (issue #7, SPEC 15.1, 15.6).</summary>
|
||||
/// <summary>Startup configuration of the container, and what is left outside it (issue #7, SPEC 15.1, ADR 0022).</summary>
|
||||
[TestClass]
|
||||
public sealed class PlatformTests
|
||||
{
|
||||
@@ -94,60 +95,39 @@ public sealed class PlatformTests
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void TomlSubsetParsesAndRejectsWithLineNumbers()
|
||||
public void TheContainerFindsItsDataAndOutsideItTheFolderIsGivenByHand()
|
||||
{
|
||||
var values = Toml.Parse("""
|
||||
# comment
|
||||
allow_live = false
|
||||
port = 8_787 # trailing comment
|
||||
name = "a \"quoted\" # not a comment"
|
||||
// The rule of the server and of the guard alike (ADR 0022): no ANUBIS_PLATFORM, no user folder.
|
||||
var container = new Dictionary<string, string?> { ["DOTNET_RUNNING_IN_CONTAINER"] = "true" };
|
||||
Assert.AreEqual("/data", DataDirectory.Locate(null, container));
|
||||
Assert.AreEqual(Path.GetFullPath("dati-di-prova"), DataDirectory.Locate("dati-di-prova", container));
|
||||
Assert.AreEqual(Path.GetFullPath("dati-di-prova"), DataDirectory.Locate("dati-di-prova", new Dictionary<string, string?>()));
|
||||
|
||||
[database]
|
||||
engine = "postgres"
|
||||
""");
|
||||
Assert.IsFalse((bool)values["allow_live"]);
|
||||
Assert.AreEqual(8787L, values["port"]);
|
||||
Assert.AreEqual("a \"quoted\" # not a comment", values["name"]);
|
||||
Assert.AreEqual("postgres", values["database.engine"]);
|
||||
|
||||
var error = Assert.Throws<FormatException>(() => Toml.Parse("a = 1\nb = [1, 2]\n"));
|
||||
Assert.Contains("Riga 2", error.Message);
|
||||
Assert.Throws<FormatException>(() => Toml.Parse("a = 1\na = 2"));
|
||||
Assert.Throws<FormatException>(() => Toml.Parse("a = \"open"));
|
||||
var outside = new Dictionary<string, string?> { ["ANUBIS_PLATFORM"] = "docker" };
|
||||
var refused = Assert.Throws<StartupRefusedException>(() => DataDirectory.Locate(null, outside));
|
||||
Assert.Contains("--data-dir", refused.Message);
|
||||
Assert.Contains("Fuori da un container", refused.Message);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Integration)]
|
||||
public void DesktopStartsFromAnEmptyFolderAndKeepsSecretsOutOfConfigToml()
|
||||
public void TheDemoStartsFromAnEmptyFolderAndCreatesItsOwnKey()
|
||||
{
|
||||
var folder = TempFolder.Create("desktop");
|
||||
var folder = TempFolder.Create("demo-key");
|
||||
try
|
||||
{
|
||||
var data = new DataDirectory(folder);
|
||||
var store = ProtectedSecretKey.DefaultStore(data);
|
||||
var first = DesktopPlatform.Load(data, store);
|
||||
Assert.IsTrue(first.NeedsFirstRun);
|
||||
Assert.IsFalse(first.IsComplete);
|
||||
var first = DemoMode.Config(data);
|
||||
Assert.IsTrue(first.IsComplete, string.Join("; ", first.Problems.Select(p => p.What)));
|
||||
Assert.AreEqual(data.SqliteFile, first.Db!.SqlitePath);
|
||||
Assert.IsFalse(first.AllowLive);
|
||||
Assert.IsFalse(first.SecretKey.HasKey, "An empty folder has no key yet.");
|
||||
|
||||
var key = first.SecretKey.GetOrCreateKey();
|
||||
DesktopPlatform.WriteConfig(data, store, new DbSettings { Engine = DbEngine.Postgres, Host = "localhost", Password = "fake-pg-pass-1" });
|
||||
|
||||
var text = File.ReadAllText(data.ConfigFile);
|
||||
Assert.Contains("allow_live = false", text);
|
||||
Assert.IsFalse(text.Contains("fake-pg-pass-1", StringComparison.Ordinal), "la password del database non va in config.toml");
|
||||
Assert.IsFalse(text.Contains(Convert.ToBase64String(key), StringComparison.Ordinal), "la chiave dei segreti non va in config.toml");
|
||||
Assert.IsFalse(text.Contains("secret", StringComparison.OrdinalIgnoreCase) && text.Contains("key =", StringComparison.Ordinal));
|
||||
|
||||
var second = DesktopPlatform.Load(data, store);
|
||||
Assert.IsTrue(second.IsComplete, string.Join("; ", second.Problems.Select(p => p.What)));
|
||||
Assert.AreEqual("fake-pg-pass-1", second.Db!.Password);
|
||||
CollectionAssert.AreEqual(key, second.SecretKey.GetOrCreateKey(), "la chiave resta la stessa tra un avvio e l'altro");
|
||||
Assert.IsFalse(second.AllowLive);
|
||||
Assert.IsFalse(second.AllowNetwork);
|
||||
|
||||
DesktopPlatform.WriteConfig(data, store, new DbSettings { Engine = DbEngine.Sqlite });
|
||||
var sqlite = DesktopPlatform.Load(data, store);
|
||||
Assert.AreEqual(data.SqliteFile, sqlite.Db!.SqlitePath);
|
||||
Assert.HasCount(32, key);
|
||||
Assert.IsNotEmpty(Directory.EnumerateFiles(Path.Combine(folder, "keys")).ToList(), "The key lives in a file of the demo folder.");
|
||||
CollectionAssert.AreEqual(key, DemoMode.Config(data).SecretKey.GetOrCreateKey(), "The same key at the next start.");
|
||||
Assert.DoesNotContain("Windows", first.SecretKey.Description);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -157,22 +137,34 @@ public sealed class PlatformTests
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void BrokenConfigTomlIsAProblemNotAGuess()
|
||||
public void NothingOfTheDesktopIsLeftInTheProduct()
|
||||
{
|
||||
var folder = TempFolder.Create("desktop-bad");
|
||||
try
|
||||
// ADR 0022: the desktop application, its configuration file and its guided first run are gone.
|
||||
string[] words = ["config.toml", "primo-avvio", "PlatformKind", "ANUBIS_PLATFORM", "DesktopPlatform", "ProtectedData"];
|
||||
var found = Repo.Files()
|
||||
.Where(file => Repo.Relative(file) is var path && (path.StartsWith("src/", StringComparison.Ordinal) ||
|
||||
path.StartsWith("tools/", StringComparison.Ordinal) || path.StartsWith("deploy/", StringComparison.Ordinal)))
|
||||
.Where(file => file.Extension is not (".png" or ".ico" or ".ttf" or ".onnx"))
|
||||
.SelectMany(file => words.Where(word => File.ReadAllText(file.FullName).Contains(word, StringComparison.Ordinal))
|
||||
.Select(word => Repo.Relative(file) + ": " + word))
|
||||
.ToList();
|
||||
Assert.IsEmpty(found, string.Join("; ", found));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void TheSolutionHasFiveProjects()
|
||||
{
|
||||
var solution = System.Xml.Linq.XDocument.Load(Path.Combine(Repo.Root.FullName, "Anubis.slnx"));
|
||||
var projects = solution.Descendants("Project").Select(p => (string)p.Attribute("Path")!).Order(StringComparer.Ordinal).ToList();
|
||||
CollectionAssert.AreEqual(new[]
|
||||
{
|
||||
var data = new DataDirectory(folder);
|
||||
File.WriteAllText(data.ConfigFile, "[database]\nengine = sqlite\n");
|
||||
var config = DesktopPlatform.Load(data, ProtectedSecretKey.DefaultStore(data));
|
||||
Assert.IsNull(config.Db);
|
||||
Assert.IsFalse(config.IsComplete);
|
||||
Assert.Contains("Riga 2", config.Problems[0].What);
|
||||
}
|
||||
finally
|
||||
{
|
||||
TempFolder.Delete(folder);
|
||||
}
|
||||
"src/Anubis.Guard/Anubis.Guard.csproj",
|
||||
"src/Anubis.Server/Anubis.Server.csproj",
|
||||
"src/Anubis/Anubis.csproj",
|
||||
"tests/Anubis.Tests/Anubis.Tests.csproj",
|
||||
"tools/Anubis.Tasks/Anubis.Tasks.csproj",
|
||||
}, projects);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
||||
Reference in new issue
Block a user