Set up phase 0: .NET 10 solution, toolchain, minimal app, Docker and CI
Empty but complete solution so every later phase starts from a working toolchain: analyzers as errors, locked restore, format check, policy tests that keep packages within ADR 0004 and keep live trading switched off, a /health endpoint served from Docker, and a Gitea workflow with only run steps. API facts of SPEC section 4 re-checked in docs/API-NOTES.md; ADR 0006 records what changed (MSTest base packages, Ubuntu images, OKX WebSocket on 443, Alpaca margin-only accounts). refs #1 refs #2 refs #3 refs #4 refs #5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f4cd411ab6
commit
b4bf864f74
46 files changed
+1368
-16
No files matched your search
@@ -0,0 +1,47 @@
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Anubis.Tests;
|
||||
|
||||
/// <summary>SPEC 2.2: real money must never be enabled during development.</summary>
|
||||
[TestClass]
|
||||
public sealed partial class LiveSafetyTests
|
||||
{
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void AllowLiveIsNotSetInTheEnvironment()
|
||||
{
|
||||
var value = Environment.GetEnvironmentVariable("ANUBIS_ALLOW_LIVE");
|
||||
Assert.IsFalse(value?.Trim() == "1", "ANUBIS_ALLOW_LIVE=1 è attivo: durante lo sviluppo non si attiva mai (SPEC 2.2).");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void NoConfigurationFileEnablesRealMoney()
|
||||
{
|
||||
// Configuration-like files only: the documentation quotes the switches to forbid them.
|
||||
string[] extensions = [".toml", ".env", ".yml", ".yaml", ".json", ".xml", ".ps1", ".sh", ".props"];
|
||||
var offenders = Repo.Files()
|
||||
.Where(f => extensions.Contains(f.Extension, StringComparer.OrdinalIgnoreCase)
|
||||
|| f.Name.StartsWith(".env", StringComparison.OrdinalIgnoreCase)
|
||||
|| f.Name.Equals("Dockerfile", StringComparison.OrdinalIgnoreCase))
|
||||
.Where(f => LiveSwitch().IsMatch(File.ReadAllText(f.FullName)))
|
||||
.Select(Repo.Relative)
|
||||
.ToList();
|
||||
|
||||
Assert.IsEmpty(offenders, "Soldi veri attivi in: " + string.Join(", ", offenders));
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory(Category.Unit)]
|
||||
public void PatternRecognisesBothSwitches()
|
||||
{
|
||||
Assert.IsTrue(LiveSwitch().IsMatch("ANUBIS_ALLOW_LIVE=1"));
|
||||
Assert.IsTrue(LiveSwitch().IsMatch(" ANUBIS_ALLOW_LIVE: \"1\""));
|
||||
Assert.IsTrue(LiveSwitch().IsMatch("allow_live = true"));
|
||||
Assert.IsFalse(LiveSwitch().IsMatch("ANUBIS_ALLOW_LIVE=0"));
|
||||
Assert.IsFalse(LiveSwitch().IsMatch("allow_live = false"));
|
||||
}
|
||||
|
||||
[GeneratedRegex("""ANUBIS_ALLOW_LIVE\s*[:=]\s*["']?1\b|allow_live\s*=\s*true\b""", RegexOptions.IgnoreCase)]
|
||||
private static partial Regex LiveSwitch();
|
||||
}
|
||||
Reference in new issue
Block a user