Unione dell'ondata 5 (desktop M6, rifiniture M8): avvisi collegati una sola volta nella composizione condivisa per le due vesti

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_01Mzbb6zeFTjT6Rp8b92AVkA
This commit is contained in:
Claude committed 2026-10-13 22:04:54 +00:00
commit 5be0b1dee8
62 files changed
+4168 -327

No files matched your search

@@ -220,26 +220,35 @@ public sealed class DesktopCompositionTests
{
await using var bed = await DesktopTestBed.StartAsync();
var events = bed.App.Engine!.Services.Events;
var received = bed.Shell.Alerts.Received;
var alerts = bed.App.Alerts!;
var received = bed.Shell.NativeShell.Notified;
// The shared alert service of M8, the same as Docker's: Windows notifications through the native shell.
await events.WriteAsync(EventSeverity.Error, EngineEventCodes.ChallengeStop, "Instagram ha chiesto una verifica: Febe si è fermato.", ct: TestContext.CancellationToken);
await events.WriteAsync(EventSeverity.Info, EngineEventCodes.SessionEnded, "Sessione finita.", ct: TestContext.CancellationToken);
await events.WriteAsync(EventSeverity.Success, EngineEventCodes.BackfillCompleted, "Storico di marta.prova completato.", ct: TestContext.CancellationToken);
await alerts.FlushAsync();
await DesktopTestBed.WaitUntilAsync(() => received.Count >= 2, TimeSpan.FromSeconds(10), "due notifiche");
var alerts = received.ToArray();
Assert.AreEqual(AlertKind.Verification, alerts[0].Kind);
Assert.AreEqual("Instagram chiede una verifica", alerts[0].Title);
Assert.AreEqual(AlertKind.BackfillDone, alerts[1].Kind);
var notified = received.ToArray();
Assert.HasCount(2, notified);
Assert.AreEqual(AlertCatalog.Title(AlertKind.Verification), notified[0].Title);
StringAssert.Contains(notified[0].Message, "«Riprendi»");
Assert.AreEqual(AlertCatalog.Title(AlertKind.BackfillDone), notified[1].Title);
// Alberto turns off «Storico completato» and then the Windows notifications: nothing more arrives.
var settings = AlertSettings.Default with { Events = AlertEvents.All with { BackfillDone = false } };
await AlertSettingsStore.SaveAsync(bed.App.Database.Settings, settings, TestContext.CancellationToken);
await events.WriteAsync(EventSeverity.Success, EngineEventCodes.BackfillCompleted, "Storico di luca.prova completato.", ct: TestContext.CancellationToken);
await alerts.FlushAsync();
await AlertSettingsStore.SaveAsync(bed.App.Database.Settings, settings with { WindowsNotifications = false }, TestContext.CancellationToken);
await events.WriteAsync(EventSeverity.Error, EngineEventCodes.DisconnectStop, "Sessione terminata.", ct: TestContext.CancellationToken);
await Task.Delay(500, TestContext.CancellationToken);
await alerts.FlushAsync();
Assert.HasCount(2, received);
Assert.HasCount(1, bed.App.Alerts!.Channels);
// Impostazioni ▸ Notifiche: Windows notifications through the shell, Telegram through the composition's channel.
var status = await bed.JsonAsync(HttpMethod.Get, "/api/settings/notifications");
Assert.IsTrue(status.GetProperty("windowsAvailable").GetBoolean(), status.ToString());
Assert.IsTrue(status.GetProperty("telegramAvailable").GetBoolean(), status.ToString());
}
[TestMethod]