fix: address the owner review 5 review
Setup: a kept 1.0 Uploader no longer fixes the scope and folder, the Remove tooltip promises kept files only with a hashed log, and a single-program setup preselects it. The Uploader always downloads the setup. Sync links move to the server id at every sign-in while folders wait for jobs and open editors; jobs of a pending homes sort still find their projects. A shared library exposes only the shared archive's client-visible jobs and events, render nodes take only client renders, and the share counts as its own while starting. Progress: a new step waits a quarter interval and a trailing timer publishes the last state; the job bar tooltip carries the whole line; Recent maintenance and the Server jobs list pick up jobs that start while they are shown. Refs #64 #65 #66 #67 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
817956e719
commit
f30eb2904a
51 files changed
+895
-122
No files matched your search
@@ -90,6 +90,23 @@ public sealed class ProgressEventTests(TestContext context)
|
||||
Assert.Equal(TimeSpan.FromMilliseconds(500), ProgressGate.Interval);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AJobThatAlternatesStepsStillGoesOutAFewTimesASecond()
|
||||
{
|
||||
var clock = new TimestampClock();
|
||||
var gate = new ProgressGate(clock);
|
||||
var job = Guid.CreateVersion7();
|
||||
// An incremental scan: every other folder changed, checked and indexed in turn, 200 reports in a second.
|
||||
var passed = 0;
|
||||
for (var i = 0; i < 200; i++)
|
||||
{
|
||||
if (gate.Passes(job, i, 10_000, i % 2 == 0 ? JobStep.Check : JobStep.Index)) passed++;
|
||||
clock.Advance(TimeSpan.FromMilliseconds(5));
|
||||
}
|
||||
Assert.True(passed <= 14, $"{passed} passed");
|
||||
Assert.True(passed >= 4, $"{passed} passed: a new step still goes out early");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task TheServerSendsAndSavesWhatItsJobsDo()
|
||||
{
|
||||
|
||||
@@ -117,6 +117,60 @@ public sealed class HostedServerTests(TestContext context)
|
||||
using (var get = await admin.GetAsync($"/api/v1/jobs/{workspace.Id}")) Assert.Equal(HttpStatusCode.NotFound, get.StatusCode);
|
||||
using (var cancel = await admin.PostAsync($"/api/v1/jobs/{workspace.Id}/cancel", null)) Assert.Equal(HttpStatusCode.NotFound, cancel.StatusCode);
|
||||
Assert.Equal(JobState.Queued, (await desktop.Database.Jobs.GetAsync(workspace.Id))!.State);
|
||||
|
||||
// The events say nothing of the desktop's own jobs, nor of its work on its other archive; the shared archive's go out.
|
||||
using var events = shared.Events.Subscribe();
|
||||
await desktop.Engine.CancelAsync(workspace.Id);
|
||||
var elsewhere = await desktop.Engine.EnqueueAsync(JobKind.Thumbs, [theirs.Id], "theirs");
|
||||
await desktop.WaitAsync(elsewhere.Id);
|
||||
var served = await desktop.Engine.EnqueueAsync(JobKind.Thumbs, [mine.Id], "mine");
|
||||
var finished = JobWire.State((await desktop.WaitAsync(served.Id)).State);
|
||||
var seen = new List<ServerEvent>();
|
||||
using (var wait = CancellationTokenSource.CreateLinkedTokenSource(context.Cancellation))
|
||||
{
|
||||
wait.CancelAfter(TimeSpan.FromSeconds(30));
|
||||
while (await events.Reader.ReadAsync(wait.Token) is var e)
|
||||
{
|
||||
seen.Add(e);
|
||||
if (e is JobStateEvent { State: var state } done && done.JobId == served.Id && state == finished) break;
|
||||
}
|
||||
}
|
||||
Assert.Contains(seen, e => e is JobStateEvent s && s.JobId == served.Id);
|
||||
Assert.False(seen.Any(e => e is JobStateEvent s && (s.JobId == workspace.Id || s.JobId == elsewhere.Id)), "a private job's state went out");
|
||||
Assert.False(seen.Any(e => e is JobProgressEvent p && (p.JobId == workspace.Id || p.JobId == elsewhere.Id)), "a private job's progress went out");
|
||||
Assert.False(seen.Any(e => e is SequenceChangedEvent c && c.SequenceId == theirs.Id), "another archive's sequence went out");
|
||||
var all = Assert.NotNull(await admin.GetFromJsonAsync("/api/v1/jobs", ProtocolJson.Default.PageJobDto));
|
||||
Assert.False(all.Items.Any(j => j.Id == elsewhere.Id), "a job on the desktop's other archive is listed");
|
||||
Assert.True(all.Items.Any(j => j.Id == served.Id), "the shared archive's job is listed");
|
||||
using (var get = await admin.GetAsync($"/api/v1/jobs/{elsewhere.Id}")) Assert.Equal(HttpStatusCode.NotFound, get.StatusCode);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task RenderNodesTakeOnlyTheRendersClientsQueuedOnTheSharedArchive()
|
||||
{
|
||||
await using var desktop = await DesktopFixture.StartAsync(context);
|
||||
var mine = await desktop.SequenceAsync(desktop.Archive);
|
||||
var other = await desktop.Archives.CreateAsync(context.CreateTempDirectory("other"), "Another archive", cancellationToken: context.Cancellation);
|
||||
var theirs = await desktop.SequenceAsync(other);
|
||||
await using var shared = await desktop.ShareAsync();
|
||||
using var admin = await desktop.AdminAsync(shared);
|
||||
var hevc = Jobs.RenderNodeTests.HevcJob;
|
||||
// Older and as urgent as the client's: the desktop's own render (its export goes where its user chose), and one of
|
||||
// a sequence of the desktop's other archive.
|
||||
await desktop.Engine.EnqueueAsync(JobKind.Render, [mine.Id], "desktop", hevc, JobPriority.User);
|
||||
await desktop.Engine.EnqueueAsync(JobKind.Render, [theirs.Id], "elsewhere", hevc, JobPriority.User, Guid.CreateVersion7());
|
||||
using var created = await admin.PostAsJsonAsync("/api/v1/jobs", new CreateJobRequest("render", [mine.Id], hevc), ProtocolJson.Default.CreateJobRequest);
|
||||
Assert.Equal(HttpStatusCode.Accepted, created.StatusCode);
|
||||
var client = Assert.NotNull(await created.Content.ReadFromJsonAsync(ProtocolJson.Default.JobDto));
|
||||
|
||||
var node = await Jobs.RenderNodeTests.RegisterAsync(admin, "studio-node", "hevc", 8192);
|
||||
using (var claim = await admin.PostAsync($"/api/v1/nodes/{node.Id}/claim", null))
|
||||
{
|
||||
Assert.Equal(HttpStatusCode.OK, claim.StatusCode);
|
||||
var claimed = Assert.NotNull(await claim.Content.ReadFromJsonAsync(ProtocolJson.Default.ClaimedJob));
|
||||
Assert.Equal(client.Id, claimed.Job.Id);
|
||||
}
|
||||
using (var none = await admin.PostAsync($"/api/v1/nodes/{node.Id}/claim", null)) Assert.Equal(HttpStatusCode.NoContent, none.StatusCode);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in new issue
Block a user