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

@@ -1,4 +1,5 @@
using Febe.Core.Abstractions;
using Febe.Core.Collection.Diagnostics;
using Febe.Core.Collection.Readers;
using Febe.Core.Domain;
using Febe.Core.Engine;
@@ -40,6 +41,9 @@ public sealed record RecipeEnvironment
public ICircuitBreaker? Breaker { get; init; }
public RecipeOptions Options { get; init; } = new();
/// <summary>The recorder of the diagnostic report (issue #39). Null: nothing is recorded.</summary>
public CollectionDiagnostics? Diagnostics { get; init; }
}
/// <summary>
@@ -63,7 +67,7 @@ public sealed partial class RecipeRunner : IRecipeRunner
public RecipeRunner(RecipeEnvironment environment)
{
Env = environment ?? throw new ArgumentNullException(nameof(environment));
Writer = new CollectionWriter(environment.Storage, environment.Clock);
Writer = new CollectionWriter(environment.Storage, environment.Clock) { Diagnostics = environment.Diagnostics };
}
public RecipeEnvironment Env { get; }
@@ -134,11 +138,13 @@ public sealed partial class RecipeRunner : IRecipeRunner
await Writer.EventAsync(refusal.Code, refusal.Message + SessionComposer.NotConfiguredTail, EventSeverity.Warning, null, session.SessionId, ct).ConfigureAwait(false);
}
Env.Diagnostics?.RecipeEnded(session.SessionId, request.Kind, RecipeStatus.NotConfigured, null, 0, 0);
return new RecipeOutcome(RecipeStatus.NotConfigured, 0, 0, refusal.Message);
}
if (Env.Breaker is { } breaker && !breaker.State.AllowsSiteActions)
{
Env.Diagnostics?.RecipeEnded(session.SessionId, request.Kind, RecipeStatus.Denied, breaker.State.LastSignal?.Code, 0, 0);
return new RecipeOutcome(RecipeStatus.Denied, 0, 0, "L'interruttore è aperto: nessuna azione verso il sito.");
}
@@ -152,6 +158,7 @@ public sealed partial class RecipeRunner : IRecipeRunner
using var run = new RecipeRun(this, request, session, ct);
RecipeStatus status;
string? text = null;
string? errorType = null;
try
{
await CheckSessionCookieAsync(run).ConfigureAwait(false);
@@ -173,6 +180,7 @@ public sealed partial class RecipeRunner : IRecipeRunner
{
status = stop.Status;
text = stop.Message;
errorType = stop.ErrorType;
}
catch (OperationCanceledException) when (ct.IsCancellationRequested)
{
@@ -189,6 +197,7 @@ public sealed partial class RecipeRunner : IRecipeRunner
{
status = RecipeStatus.Failed;
text = $"Errore imprevisto in «{name}» ({ex.GetType().Name}): {ex.Message}";
errorType = ex.GetType().Name;
}
if (run.Signal is { } signal && status is not (RecipeStatus.StoppedBySignal or RecipeStatus.Cancelled))
@@ -206,6 +215,17 @@ public sealed partial class RecipeRunner : IRecipeRunner
// The timeline is a convenience: failing to write it never changes how the recipe ended.
}
// The report takes the status and the code of the signal, never the message (it may name an account). A recipe
// cancelled because the breaker stopped (a signal reported straight to it, like the session cookie lost) gets
// the breaker's code too.
var breakerState = Env.Breaker?.State;
var signalCode = run.Signal?.Code ?? status switch
{
RecipeStatus.StoppedBySignal => breakerState?.LastSignal?.Code,
RecipeStatus.Cancelled when breakerState is { AllowsSiteActions: false } => breakerState.LastSignal?.Code,
_ => null,
};
Env.Diagnostics?.RecipeEnded(session.SessionId, request.Kind, status, signalCode, run.Actions, run.NewEntries, status == RecipeStatus.Failed ? errorType : null);
_lastKind = request.Kind;
return new RecipeOutcome(status, run.Actions, run.NewEntries, text)
{