E5: Dashboard e finestra della cartella dicono il vero sulle copie automatiche

«Riprendi» e «Riprendi tutte» restano attivi mentre lavora una copia
automatica, che cede il passo (risposta 49): li spegne solo un lavoro di
Alberto. «Annulla» di un lavoro automatico dice che i file ripartono da
soli; la risposta a «Interrompi» dice l'ora come il resto («all'1:20»,
«domani alle 0:30»), e «dal» si elide («dall'8 dicembre»). Nella
finestra della cartella «Salva» aspetta il conto dei tipi di adesso, un
conto non riuscito si richiede e il suo errore resta, il fuoco della
tastiera non salta; una nota dice perché «Automatica» è spenta senza
cartelle scrivibili. «Riprendi ora» torna attivo se la richiesta
fallisce. Il conto dei file che aspettano si condivide fra letture e non
si fa per la scheda di un account senza cartella sua; sul telefono i
pulsanti della tabella delle cartelle vanno a capo. Prove nuove: chiusura
che ferma prima il lavoratore, percorso troppo lungo, attesa di due
minuti dall'ultimo file e tetto di un quarto d'ora.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-04 20:07:48 +01:00
1 parent 3c48582067
commit 9c7f2f1ad5
16 files changed
+334 -69

No files matched your search

@@ -617,8 +617,8 @@ public sealed class ExportServiceAutomaticTests
Assert.AreEqual(ExportRunState.Interrupted, (await bed.RunAsync(start.Runs[0].Id, ct)).State);
Assert.AreEqual(AutoExportStartOutcome.Held, (await bed.Service.TryResumeAutomaticAsync([start.Runs[0].Id], ct)).Outcome);
Assert.AreEqual(
$"Copia automatica interrotta: quello che è stato copiato resta; riprende da sola alle {Core.Engine.ItalianText.Clock(until!.Value, bed.Clock.LocalZone)}.",
ExportText.AutomaticInterrupted(until.Value, bed.Clock.LocalZone));
$"Copia automatica interrotta: quello che è stato copiato resta; riprende da sola {Core.Engine.ItalianText.AtDay(until!.Value, bed.Clock.Now, bed.Clock.LocalZone)}.",
ExportText.AutomaticInterrupted(until.Value, bed.Clock.Now, bed.Clock.LocalZone));
// A longer hold wins; the hour passes; «Riprendi ora».
Assert.AreEqual(until.Value.AddHours(1), bed.Service.HoldAutomatic(until.Value.AddHours(1)));
@@ -665,6 +665,36 @@ public sealed class ExportServiceAutomaticTests
Assert.IsEmpty(await bed.Db.Exports.ListCopiesAsync(auto.Id, ct: ct));
}
/// <summary>
/// With «Una copia sola» the backlog is each folder's own figure: the same content of two accounts, due in two
/// automatic folders, counts once in each; the job writes it once (the other is «Già copiato»), and then both
/// figures are 0 (pinned behaviour, IExportStore.CountAutomaticBacklogAsync).
/// </summary>
[TestMethod]
public async Task WithOneCopyOnlyEachFolderCountsItsOwnBacklog()
{
var ct = TestContext.CancellationToken;
await using var bed = await ExportTestBed.CreateAsync();
await bed.SetSamePostAsync(SamePostCopies.OneOnly, ct);
await bed.PostAsync(bed.Marta, "c01", 31);
await bed.PostAsync(bed.Luca, "c02", 31);
var general = await TurnOnAsync(bed, await bed.GeneralAsync(ct: ct), ct);
var own = await TurnOnAsync(bed, await bed.OwnAsync(bed.Luca, "luca-nas", ct: ct), ct);
var generalQuery = new ExportBacklogQuery(ExportScope.General, null, ContentTypes.All, general.Id, null);
var ownQuery = new ExportBacklogQuery(ExportScope.Account, bed.Luca.Id, ContentTypes.All, own.Id, null);
Assert.AreEqual(1, (await bed.Db.Exports.CountAutomaticBacklogAsync(generalQuery, ct)).Files);
Assert.AreEqual(1, (await bed.Db.Exports.CountAutomaticBacklogAsync(ownQuery, ct)).Files);
var start = await bed.Service.TryStartAutomaticAsync(new ExportSelection.Automatic([Scope(general), Scope(own)], [], Round: true), ct);
Assert.AreEqual(AutoExportStartOutcome.Started, start.Outcome);
await bed.Service.WaitAsync(ct);
var copies = (await bed.Db.Exports.ListCopiesAsync(general.Id, ct: ct)).Concat(await bed.Db.Exports.ListCopiesAsync(own.Id, ct: ct)).ToList();
Assert.HasCount(1, copies, "written once");
Assert.AreEqual(0, (await bed.Db.Exports.CountAutomaticBacklogAsync(generalQuery, ct)).Files);
Assert.AreEqual(0, (await bed.Db.Exports.CountAutomaticBacklogAsync(ownQuery, ct)).Files);
}
/// <summary>
/// «Annulla» of an automatic run keeps automatic starts away until the run is «annullato»: the worker's resume of the
/// same run in that moment is refused (Busy), so the run stays «annullato» and nothing is copied.
@@ -704,6 +734,28 @@ public sealed class ExportServiceAutomaticTests
Assert.AreEqual(AutoExportStartOutcome.NothingToDo, (await bed.Service.TryResumeAutomaticAsync([run.Id], ct)).Outcome, "after «Annulla» the gate is open again");
}
/// <summary>
/// The answer to «Interrompi» says the time as the rest of the interface: «all'1:20», and «domani alle 0:30» when the
/// hold goes past midnight (decisioni.md, 4 December 2026).
/// </summary>
[TestMethod]
public void TheInterruptAnswerSaysTheTimeAsElsewhere()
{
var zone = TestZones.Rome;
var night = new DateTimeOffset(2026, 12, 4, 0, 20, 0, TimeSpan.FromHours(1));
Assert.AreEqual(
"Copia automatica interrotta: quello che è stato copiato resta; riprende da sola all'1:20.",
ExportText.AutomaticInterrupted(night.AddHours(1), night, zone));
var evening = new DateTimeOffset(2026, 12, 4, 23, 30, 0, TimeSpan.FromHours(1));
Assert.AreEqual(
"Copia automatica interrotta: quello che è stato copiato resta; riprende da sola domani alle 0:30.",
ExportText.AutomaticInterrupted(evening.AddHours(1), evening, zone));
var afternoon = new DateTimeOffset(2026, 12, 4, 15, 10, 0, TimeSpan.FromHours(1));
Assert.AreEqual(
"Copia automatica interrotta: quello che è stato copiato resta; riprende da sola alle 16:10.",
ExportText.AutomaticInterrupted(afternoon.AddHours(1), afternoon, zone));
}
/// <summary>
/// The automatic export resumes only automatic runs: a manual «In pausa» stays Alberto's even when its folder
/// answers again (answer 48); «Riprova» resumes it.