fix(copies): close the fifth verification round of owner review 6
The metered hold now records the jobs it paused in the index and forgets any job the user pauses, resumes, retries or cancels, so it never resumes a pause of the user's and still resumes its own after a restart. Drop... reports why its dry run is blocked instead of asking first, and dropping the version Main uses lets Main use the version that stays, with its hero and keyframes. That version reads "In Main". Merges: - A re-plan no longer hashes the other's photos again. - A resumed merge verifies photos flagged damaged while it waited. - A merge is blocked while the other's folder holds photos the index has not read; this is checked again under the lease before the trash. - Choose each offers Keep both, Kept and Other, and blocks until every differing photo is chosen. - Classes are named by role. The Compare dialog: - Its headings stay over their columns. - The Projects part scrolls. - Every confirmation line carries its own prefix, and a merge's facts carry none. - A server card in a match offers Compare... alone. The Italian strings follow the glossary. Finding 9 (a local drop counting 0 photos) is not reproduced; a test now keeps the count at 2. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2c06e7ac2b
commit
bf7701d279
159 files changed
+1759
-126
No files matched your search
@@ -75,32 +75,16 @@ public sealed class UploadHoldTests
|
||||
Assert.True(UploadHold.HeldNow(Of(JobKind.UploadCommit, $$"""{"server":"{{Server}}","automatic":true}"""), metered: true, optionOn: false));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AnAutomaticTransferPausedBeforeARestartResumesOnceTheConnectionIsNotMetered()
|
||||
/// <summary>A fresh index in a temporary folder and its job engine (not started).</summary>
|
||||
private static async Task HoldScenarioAsync(Func<Chronos.Data.ChronosDatabase, Chronos.Data.Jobs.JobEngine, Task> body)
|
||||
{
|
||||
var folder = Path.Combine(Path.GetTempPath(), "chronos-hold-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(folder);
|
||||
try
|
||||
{
|
||||
await using var db = await Chronos.Data.ChronosDatabase.OpenAsync(Chronos.Data.DatabaseOptions.Sqlite(Path.Combine(folder, "index.db")));
|
||||
var automatic = Of(JobKind.Download, $$"""{"server":"{{Server}}","mode":"Originals","automatic":true}""");
|
||||
var manual = Of(JobKind.Download, $$"""{"server":"{{Server}}","mode":"Originals"}""");
|
||||
foreach (var job in new[] { automatic, manual })
|
||||
{
|
||||
await db.Jobs.EnqueueAsync(job);
|
||||
await db.Jobs.SetStateAsync(job.Id, JobState.Paused, null);
|
||||
}
|
||||
await using var engine = new Chronos.Data.Jobs.JobEngine(db, [], new Chronos.Data.Jobs.JobEngineOptions { Workers = 1, WorkerId = "test" });
|
||||
// A new hold after a restart: it paused the automatic one before, and its record of that is gone.
|
||||
using var hold = new UploadHold(() => db, () => false, () => false);
|
||||
hold.Attach(engine);
|
||||
await hold.ApplyAsync();
|
||||
|
||||
Assert.Equal(JobState.Queued, (await db.Jobs.GetAsync(automatic.Id))!.State);
|
||||
// A transfer the user started and paused stays paused: its pause may be the user's.
|
||||
Assert.Equal(JobState.Paused, (await db.Jobs.GetAsync(manual.Id))!.State);
|
||||
Assert.True(UploadHold.Adopts(automatic with { State = JobState.Paused }));
|
||||
Assert.False(UploadHold.Adopts(manual with { State = JobState.Paused }));
|
||||
await body(db, engine);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -114,6 +98,53 @@ public sealed class UploadHoldTests
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public Task ATransferTheHoldPausedBeforeARestartResumesOnceTheConnectionIsNotMetered() => HoldScenarioAsync(async (db, engine) =>
|
||||
{
|
||||
var automatic = Of(JobKind.Download, $$"""{"server":"{{Server}}","mode":"Originals","automatic":true}""");
|
||||
var userPaused = Of(JobKind.Download, $$"""{"server":"{{Server}}","mode":"Originals","automatic":true}""");
|
||||
await db.Jobs.EnqueueAsync(automatic);
|
||||
await db.Jobs.EnqueueAsync(userPaused);
|
||||
// The user paused this one before the connection became metered: the hold never paused it.
|
||||
await db.Jobs.SetStateAsync(userPaused.Id, JobState.Paused, null);
|
||||
using (var before = new UploadHold(() => db, () => false, () => true))
|
||||
{
|
||||
before.Attach(engine);
|
||||
await before.ApplyAsync();
|
||||
Assert.Equal(JobState.Paused, (await db.Jobs.GetAsync(automatic.Id))!.State);
|
||||
}
|
||||
|
||||
// A new hold after a restart reads the record the first one kept in the index.
|
||||
using var hold = new UploadHold(() => db, () => false, () => false);
|
||||
hold.Attach(engine);
|
||||
await hold.ApplyAsync();
|
||||
|
||||
Assert.Equal(JobState.Queued, (await db.Jobs.GetAsync(automatic.Id))!.State);
|
||||
// An automatic transfer the user paused stays paused: the hold resumes only what it paused.
|
||||
Assert.Equal(JobState.Paused, (await db.Jobs.GetAsync(userPaused.Id))!.State);
|
||||
Assert.Equal("[]", await db.Settings.GetJsonAsync(Chronos.Data.Repositories.SettingScope.App, null, UploadHold.RecordKey));
|
||||
});
|
||||
|
||||
[Test]
|
||||
public Task AJobTheUserPausesWhileHeldIsNeverResumedByTheHold() => HoldScenarioAsync(async (db, engine) =>
|
||||
{
|
||||
var automatic = Of(JobKind.UploadCommit, $$"""{"server":"{{Server}}","automatic":true}""");
|
||||
await db.Jobs.EnqueueAsync(automatic);
|
||||
var metered = true;
|
||||
using var hold = new UploadHold(() => db, () => false, () => metered);
|
||||
hold.Attach(engine);
|
||||
await hold.ApplyAsync();
|
||||
Assert.Equal(JobState.Paused, (await db.Jobs.GetAsync(automatic.Id))!.State);
|
||||
|
||||
// The user pauses it from Jobs (the queue tells the hold), then the connection is no longer metered.
|
||||
using var queue = new Chronos.App.Jobs.EngineJobQueue(db, engine, started: false, acted: id => hold.ForgetAsync(id).GetAwaiter().GetResult());
|
||||
await queue.PauseAsync(automatic.Id);
|
||||
metered = false;
|
||||
await hold.ApplyAsync();
|
||||
|
||||
Assert.Equal(JobState.Paused, (await db.Jobs.GetAsync(automatic.Id))!.State);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TransfersWithThisPcsLibraryAndOtherJobsAreNot()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user