From c27e8194d3494723dc7fe1c58c2096038f6f8442 Mon Sep 17 00:00:00 2001 From: Alberto Balbo Date: Thu, 3 Dec 2026 17:45:27 +0100 Subject: [PATCH] Say in the diary where the server runs, as Settings does Outside a container the diary said "in Docker": it now says "fuori dal container (sviluppo)", from the same options as Settings (ADR 0022). Found by the second independent review. refs #114 Co-Authored-By: Claude Opus 5.5 --- src/Anubis.Server/AnubisHost.cs | 3 +++ src/Anubis.Server/SystemView.cs | 2 +- tests/Anubis.Tests/DiagnosticsTests.cs | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Anubis.Server/AnubisHost.cs b/src/Anubis.Server/AnubisHost.cs index 9f524d4..f911145 100644 --- a/src/Anubis.Server/AnubisHost.cs +++ b/src/Anubis.Server/AnubisHost.cs @@ -86,6 +86,9 @@ internal sealed partial class AnubisHost( /// Where this server answers from, in plain Italian: the container, the demo or a development run (ADR 0022). public string Where => options.Where; + /// True inside the container; outside it the server runs only for development and tests (ADR 0022). + public bool InContainer => options.InContainer; + public HostStatus Status => _status; public IClock Clock => clock; diff --git a/src/Anubis.Server/SystemView.cs b/src/Anubis.Server/SystemView.cs index ee17bf1..02702dd 100644 --- a/src/Anubis.Server/SystemView.cs +++ b/src/Anubis.Server/SystemView.cs @@ -192,7 +192,7 @@ internal sealed record SystemView( .Select(u => new PlannedJob(JobTime(u.DueUtc, now, zone), u.Description)).ToList(); var since = host.Status.Since; - var platform = host.IsDemo ? "in modalità dimostrativa" : "in Docker"; + var platform = host.IsDemo ? "in modalità dimostrativa" : host.InContainer ? "in Docker" : "fuori dal container (sviluppo)"; var localSince = TimeZoneInfo.ConvertTime(since, zone); var days = (int)Math.Floor((now - since).TotalDays); var running = days >= 1 diff --git a/tests/Anubis.Tests/DiagnosticsTests.cs b/tests/Anubis.Tests/DiagnosticsTests.cs index 496e885..428b442 100644 --- a/tests/Anubis.Tests/DiagnosticsTests.cs +++ b/tests/Anubis.Tests/DiagnosticsTests.cs @@ -181,7 +181,9 @@ public sealed class DiagnosticsTests Assert.Contains("# Anubis · dati per l'analisi", text); Assert.Contains("- Dove gira: fuori dal container, per sviluppo e prove", text); Assert.Contains("| " + AnubisInfo.Version + " |", text, "The start sample of the running process is in the report."); - Assert.Contains("Scarica i dati per l'analisi", await server.TextAsync("/diario")); + var diary = await server.TextAsync("/diario"); + Assert.Contains("Scarica i dati per l'analisi", diary); + Assert.Contains(" fuori dal container (sviluppo), acceso ", diary, "The diary says where it runs, as Settings does."); } private static ProcessSample Sample(DateTimeOffset at, DateTimeOffset process, double megabytes, int i) => new()