Merge remote-tracking branch 'origin/main' into correzione/prova-da-capo-a-fondo
verifica / controlli (push) Successful in 22s
verifica / prove (push) Successful in 23m56s
verifica / installatore (push) Successful in 2m6s
verifica / immagine (push) Successful in 19m0s

Revisione: la causa è l'orologio che somma le attese, e «Controlla ora» si chiede
di nuovo prima di aspettare la verifica, perché a sessione finita la pausa può
arrivare a 90 minuti.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-01 17:54:28 +01:00
commit 4dc3a83a51
9 files changed
+125 -18

No files matched your search

+17 -11
View File
@@ -86,12 +86,7 @@ public sealed partial class ServerEndToEndTests
Assert.AreEqual(ConnectionState.Connected, (await connection.GetStatusAsync(ct)).State);
// «Controlla ora».
var check = await bed.JsonAsync(HttpMethod.Post, $"/api/accounts/{marta.Id}/check-now");
if (check.GetProperty("status").GetString() == "needsConfirmation")
{
check = await bed.JsonAsync(HttpMethod.Post, $"/api/accounts/{marta.Id}/check-now", $$"""{"token":"{{check.GetProperty("token").GetString()}}"}""");
}
var check = await CheckNowAsync(bed, marta.Id);
Assert.AreEqual("queued", check.GetProperty("status").GetString(), check.GetProperty("message").GetString());
// The engine runs a session: every action toward the site has its Governor's permit in action_log.
@@ -103,9 +98,8 @@ public sealed partial class ServerEndToEndTests
Assert.IsTrue(actions.All(a => a.SessionId is not null), "every counted action belongs to a session");
Assert.IsNotNull(await server.Database.Sessions.GetLastAsync(ct));
// The session is the one Alberto asked for, and starts from his account. Another account first (a session of the
// engine's own that began at «Ho finito») leaves little of these few minutes to marta.prova, and once they end the
// files have to wait for the next session: say it here, not after a wait that cannot succeed.
// The session is the one Alberto asked for, and starts from the account he chose: not a session of the engine's
// own that began at «Ho finito», before his request.
if (actions.First(a => a.AccountId is not null).AccountId != marta.Id)
{
Assert.Fail($"La prima azione della sessione non è su marta.prova, chiesta con «Controlla ora».\n{await bed.DescribeAsync()}");
@@ -141,8 +135,9 @@ public sealed partial class ServerEndToEndTests
TestContext.WriteLine($"Ricette: {string.Join(", ", recipes.Select(r => r.Code).Distinct())}; file di marta.prova: {stored.Count}.");
// The site asks for a verification: at its next action toward the site the engine stops and the banner appears
// in /api/engine. Usually still in the first session (two accounts to read in full); if that session already
// ended, in the next one, after the minimum pause (20 minutes at 5×: four real minutes).
// in /api/engine. Usually still in the first session (two accounts to read in full). Were that session over, or
// ending right now, the next one would come 20 to 90 minutes later (4 to 18 real ones at 5×): «Controlla ora» again
// brings it to the minimum pause, four real minutes.
// Alerts on Telegram (M8): token and chat set from Impostazioni ▸ Notifiche; the composition sends through the fake.
const string token = "4839574812:AAF-gettoneDelServerDiProva_123";
var events = """{"verification":true,"disconnection":true,"throttle":true,"backfillDone":true,"diskLow":true,"unknownFormat":true}""";
@@ -150,6 +145,7 @@ public sealed partial class ServerEndToEndTests
var servedBefore = bed.Site.Control.CdnFilesServed;
bed.Site.Control.Set(StopMode.Challenge);
await CheckNowAsync(bed, marta.Id);
await bed.WaitUntilAsync(
async () =>
{
@@ -385,6 +381,16 @@ public sealed partial class ServerEndToEndTests
return false;
}
/// <summary>«Controlla ora», confirmed when Febe asks for it.</summary>
private static async Task<JsonElement> CheckNowAsync(ServerTestBed bed, long accountId)
{
var path = $"/api/accounts/{accountId}/check-now";
var check = await bed.JsonAsync(HttpMethod.Post, path);
return check.GetProperty("status").GetString() == "needsConfirmation"
? await bed.JsonAsync(HttpMethod.Post, path, $$"""{"token":"{{check.GetProperty("token").GetString()}}"}""")
: check;
}
private static async Task<List<(Entry Entry, Media Media)>> StoredAsync(Febe.Server.FebeServer server, long accountId, CancellationToken ct)
{
var list = new List<(Entry, Media)>();