Rapporto di diagnostica della raccolta (#39)
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:
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;
|
||||
@@ -9,6 +10,9 @@ namespace Febe.Core.Collection.Recipes;
|
||||
internal sealed class RecipeStopException(RecipeStatus status, string message) : Exception(message)
|
||||
{
|
||||
public RecipeStatus Status { get; } = status;
|
||||
|
||||
/// <summary>For a failure on an unexpected error: the type name of that exception (diagnostic report, never the message).</summary>
|
||||
public string? ErrorType { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -96,7 +100,19 @@ internal sealed class RecipeRun : IDisposable
|
||||
public async Task<PageLoad> OpenAsync(string page, IReadOnlyDictionary<string, string>? values = null)
|
||||
{
|
||||
var path = Env.SiteMap.BuildPath(page, values);
|
||||
var load = await Env.Driver.OpenAsync(path, Ct).ConfigureAwait(false);
|
||||
PageLoad load;
|
||||
try
|
||||
{
|
||||
load = await Env.Driver.OpenAsync(path, Ct).ConfigureAwait(false);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Env.Diagnostics?.PageOpened(Session.SessionId, page, ok: false);
|
||||
throw;
|
||||
}
|
||||
|
||||
// The page NAME of the site map, never the path: it holds the user name or the code.
|
||||
Env.Diagnostics?.PageOpened(Session.SessionId, page, load.Succeeded);
|
||||
ThrowIfSignal();
|
||||
if (!load.Succeeded)
|
||||
{
|
||||
@@ -114,6 +130,7 @@ internal sealed class RecipeRun : IDisposable
|
||||
{
|
||||
ThrowIfSignal();
|
||||
var result = await Env.Driver.ClickAsync(target, parameters, Ct).ConfigureAwait(false);
|
||||
Env.Diagnostics?.TargetClicked(Session.SessionId, target, result.Status);
|
||||
if (!result.Found)
|
||||
{
|
||||
ThrowIfSignal();
|
||||
@@ -167,6 +184,7 @@ internal sealed class RecipeRun : IDisposable
|
||||
{
|
||||
if (reads.Any(r => r.Result.Shape == ReadShape.Recognized && expected(r.Result)))
|
||||
{
|
||||
Env.Diagnostics?.StepJudged(Session.SessionId, CollectionDiagnostics.VerdictRecognized);
|
||||
_signals.ObserveNonEmptyPage();
|
||||
return true;
|
||||
}
|
||||
@@ -174,10 +192,12 @@ internal sealed class RecipeRun : IDisposable
|
||||
var unknown = reads.Where(r => r.Result.Shape == ReadShape.Unrecognized && r.Result.KeyStructure is not null).Select(r => r.Result.KeyStructure!).Distinct().ToList();
|
||||
if (unknown.Count > 0)
|
||||
{
|
||||
Env.Diagnostics?.StepJudged(Session.SessionId, CollectionDiagnostics.VerdictUnknown);
|
||||
UnknownShapes.AddRange(unknown);
|
||||
throw Stop(RecipeStatus.UnrecognizedFormat, "La risposta del sito ha una forma che i lettori non riconoscono.");
|
||||
}
|
||||
|
||||
Env.Diagnostics?.StepJudged(Session.SessionId, CollectionDiagnostics.VerdictEmpty);
|
||||
_signals.ObserveEmptyPage(where);
|
||||
ThrowIfSignal();
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user