Rapporto di diagnostica della raccolta (#39)
verifica / controlli (push) Successful in 18s
verifica / prove (push) Successful in 13m5s
verifica / installatore (push) Successful in 4m11s
verifica / immagine (push) Successful in 14m4s

Dopo una prova dal vivo andata male, Alberto deve poter mandare un solo file che
spieghi perché, senza che nessuno veda dati di altre persone. Attività ha ora il
pulsante «Diagnostica», che scarica il rapporto delle sessioni degli ultimi 14 giorni:
pagine aperte e forma degli indirizzi, risposte per tipo, stato e dimensione con ciò
che i lettori ne hanno fatto, struttura stretta delle forme sconosciute, ricette,
segnali, permessi negati, file in coda e scaricati, e il motivo di ogni arresto.

Nel rapporto entrano solo valori da elenchi chiusi, numeri, orari e forme: mai nomi,
indirizzi completi, codici, cursori, cookie o pezzi di risposte. Le forme degli
indirizzi e la regola delle chiavi-dato passano dalla sonda a Core, e la sonda le
richiama. Il registratore non lancia mai eccezioni verso la raccolta e tiene i file in
Dati/diagnostica per 14 giorni.

Prova che il rapporto non contiene valori, con controlli di mutazione; tre giri di
revisione avversaria (25 difetti confermati, tutti corretti).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-13 14:41:34 +01:00
1 parent bf03cb45a5
commit badd1681a0
55 files changed
+5395 -134

No files matched your search

+56
View File
@@ -1,7 +1,12 @@
using System.Net;
using System.Text.Json;
using Febe.Core.Collection;
using Febe.Core.Engine;
using Febe.Sonda;
using Febe.Tests.Collection;
using Febe.Tests.Support;
using Febe.Tests.Web.Support;
using Febe.Web.Api;
using Febe.Web.Demo;
namespace Febe.Tests.Web;
@@ -129,6 +134,57 @@ public sealed class DemoPart2Tests
Assert.IsTrue(normal.All(i => !i.Bool("open")));
}
[TestMethod]
public async Task TheDiagnosticReportFollowsTheSceneAndNamesNobody()
{
var finished = s_demo!.World.Today.Count;
Assert.IsGreaterThan(0, finished, "the demo day has sessions");
var names = (await s_demo.Storage.Accounts.ListAsync()).Select(a => a.Username).ToList();
names.AddRange(["marta.demo", "giulia.corre.demo", "tuo.profilo"]);
var vocabulary = ReportLeaks.Vocabulary(SiteMap.LoadInstagram());
var sensitive = names.SelectMany(SensitiveTokens.Tokenize).Where(t => !vocabulary.Contains(t)).ToHashSet(StringComparer.Ordinal);
Assert.IsGreaterThan(20, sensitive.Count);
async Task<JsonElement> ReportAsync(string scene)
{
using var response = await Client.GetAsync($"{ActivityApi.DiagnosticsPath}?scena={scene}");
var text = await response.Content.ReadAsStringAsync();
Assert.AreEqual(HttpStatusCode.OK, response.StatusCode, $"{scene}: {text}");
Assert.AreEqual("attachment", response.Content.Headers.ContentDisposition?.DispositionType);
Assert.AreEqual("no-store", response.Headers.CacheControl?.ToString());
ReportLeaks.AssertClean(text, names, sensitive, ReportLeaks.FieldKeys([]));
return JsonDocument.Parse(text).RootElement.Clone();
}
var normal = await ReportAsync("normale");
Assert.AreEqual("windows", normal.Str("edizione"), "the demo looks like the desktop by default");
var sessions = normal.Items("sessioni").ToList();
Assert.HasCount(finished, sessions);
Assert.IsTrue(sessions.All(s => s.Str("outcome") == nameof(Febe.Core.Domain.SessionOutcome.Completed) && !s.Bool("inProgress")));
Assert.IsTrue(sessions.All(s => s.Items("responses").Any() && s.Items("recipes").Any()));
Assert.AreEqual(0, sessions.Sum(s => s.Items("signals").Count()));
Assert.HasCount(1, normal.Items("fuoriSessione").ToList());
var running = (await ReportAsync("sessione")).Items("sessioni").ToList();
Assert.HasCount(finished + 1, running);
Assert.IsTrue(running[^1].Bool("inProgress"), "the session in progress comes last");
var stopped = (await ReportAsync("fermo")).Items("sessioni").ToList();
Assert.HasCount(finished, stopped);
Assert.AreEqual(nameof(SessionStopCause.BreakerOpen), stopped[^1].Str("stopCause"));
Assert.AreEqual(DemoDiagnosticSource.ChallengeCode, stopped[^1].Items("signals").Single().Str("code"));
Assert.IsTrue(stopped.Take(stopped.Count - 1).All(s => s.Str("stopCause") != nameof(SessionStopCause.BreakerOpen)));
foreach (var scene in new[] { "scollegato", "errore" })
{
var empty = await ReportAsync(scene);
Assert.AreEqual(0, empty.GetProperty("sessioni").GetArrayLength(), scene);
Assert.AreEqual(0, empty.GetProperty("fuoriSessione").GetArrayLength(), scene);
}
Assert.AreEqual("docker", (await ReportAsync("normale&veste=docker")).Str("edizione"));
}
[TestMethod]
public async Task EverySettingsPageHasItsData()
{