Add host activity and DB browser, and keep dialogs, drag-drop, and idle maintenance responsive.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-28 02:03:52 +02:00
parent b72c375e87
commit b33a78dbbe
45 changed files with 3254 additions and 171 deletions

View File

@@ -120,6 +120,21 @@ public class BackgroundMaintenanceCoordinatorTests
Assert.Equal(new[] { 3L }, indexing.IdleVerifies);
}
[Fact]
public async Task Run_now_keeps_running_while_user_stays_active()
{
var hash = new FakeHash();
var indexing = new FakeIndexing();
var coordinator = Create(hash, indexing, idle: TimeSpan.Zero, sources: [StaleLocal()]);
coordinator.RunNow();
await coordinator.TickAsync(CancellationToken.None);
Assert.Contains("checking", coordinator.Snapshot.Message, StringComparison.OrdinalIgnoreCase);
await coordinator.TickAsync(CancellationToken.None);
Assert.True(indexing.IdleAllowed);
Assert.DoesNotContain("Paused because user is active", coordinator.Snapshot.Message, StringComparison.Ordinal);
}
[Fact]
public async Task Idle_verifies_a_fresh_online_source()
{
@@ -220,10 +235,12 @@ public class BackgroundMaintenanceCoordinatorTests
{
public bool Paused { get; set; } = true;
public bool IsPaused => Paused;
public string? CurrentPath => null;
public void Pause() => Paused = true;
public void Resume() => Paused = false;
public void BeginUserRequested() { }
public Task<bool> HasPendingAsync(CancellationToken cancellationToken = default) => Task.FromResult(false);
public Task<long> CountPendingAsync(CancellationToken cancellationToken = default) => Task.FromResult(0L);
}
private sealed class FakeHistory : IHistoryMaintenance
@@ -303,6 +320,13 @@ public class BackgroundMaintenanceCoordinatorTests
public Task<IReadOnlyList<DuplicateGroup>> GetDuplicateGroupsAsync(
long? sourceId, string? pathPrefix, int take, CancellationToken cancellationToken = default)
=> Task.FromResult<IReadOnlyList<DuplicateGroup>>([]);
public Task<IReadOnlyList<byte[]>> GetDuplicateHashesAsync(
long? sourceId, string? pathPrefix, int take, CancellationToken cancellationToken = default)
=> Task.FromResult<IReadOnlyList<byte[]>>([]);
public Task<IReadOnlyList<DuplicateGroup>> GetDuplicateGroupsByHashesAsync(
IReadOnlyList<byte[]> hashes, CancellationToken cancellationToken = default)
=> Task.FromResult<IReadOnlyList<DuplicateGroup>>([]);
public Task<long> CountPendingAsync(CancellationToken cancellationToken = default) => Task.FromResult(0L);
}
private sealed class TempEnv : IAppEnvironment