E5: il giro non si ripete a vuoto e le copie automatiche cedono davvero

Il passaggio che segue la ripresa di un giro non rifà il lavoro di
recupero (prova delle cartelle in pausa, ripresa dei lavori fermati da
un errore): un lavoro che si ferma di nuovo aspetta il giro dopo invece
di essere ripreso all'infinito senza dormire. Il giro misura lo spazio
per il lavoro automatico che riprenderebbe, non per una pausa di Alberto,
così una pausa per spazio non va e viene con un evento nuovo ogni volta.
«Annulla» tiene lontane le partenze automatiche finché il lavoro è
annullato; «Esporta questo account» spento ferma subito la copia
automatica; «Cerca i video fermi» chiede di fermarsi a una copia
automatica partita dopo di lei; un file che manca sul disco non crea
più un lavoro automatico a ogni passaggio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-12-04 19:42:27 +01:00
1 parent 93f7978d9e
commit 309f4d0402
12 files changed
+436 -32

No files matched your search

@@ -323,6 +323,37 @@ public sealed class StillVideoServiceTests
Assert.AreEqual(VideoAnalysisOutcome.Still, (await library.Db.VideoAnalyses.GetAsync(video.Sha256!, ct))!.Outcome);
}
/// <summary>
/// An automatic copy that takes the gate after the search started (in the moment between the worker's look and its
/// start) is asked to stop at the search's next look, not waited for to the end (§16 answer 49).
/// </summary>
[TestMethod]
public async Task AnAutomaticCopyThatStartsAfterTheSearchIsAskedToStop()
{
var ct = TestContext.CancellationToken;
using var temp = new TempFolder();
await using var library = await TestLibrary.CreateAsync(temp);
var (account, video) = await SaveVideoAsync(library, "1", StillVideo(13));
var session = new FakeSessionState { InSession = true };
var gate = new LongWorkGate();
var calls = new ConcurrentQueue<string>();
using var service = new StillVideoService(Environment(library, gate) with { Session = session, Analyser = Counting(calls) });
await service.StartAsync(new ExportSelection.Account(account.Id), ct);
await UntilAsync(() => service.Progress.Waiting == StillVideoText.InSession, ct);
Assert.IsTrue(gate.TryEnterYielding(LongWorkKind.Export, out var automatic, out var yield, out _));
Assert.IsFalse(yield.IsCancellationRequested);
session.InSession = false;
await UntilAsync(() => yield.IsCancellationRequested, ct);
Assert.IsEmpty(calls);
automatic.Dispose();
await service.Job.WaitAsync(Patience, ct);
Assert.HasCount(1, calls);
Assert.AreEqual(VideoAnalysisOutcome.Still, (await library.Db.VideoAnalyses.GetAsync(video.Sha256!, ct))!.Outcome);
}
[TestMethod]
public async Task ASessionThatStartsDuringAnAnalysisMakesTheJobGiveWay()
{