fix: keep pre-rule templates through web settings saves; retry render filing after another index moved the folder
The web panel's archive settings save checked both request templates against every template rule before the engine ran, so an archive.json saved before the rules made every save fail, even of the name or proxy size. Only a template that differs from the stored one is now held to the rules, as ArchiveService already does, and a TemplateRuleException from the engine (archive.json changed since the form was read) answers invalid_template with its rule instead of archive_policy. Exports follow a moved folder correctly in two more cases. Image-sequence exports are folders, so the rebase now tests Path.Exists instead of File.Exists. An export left at the old path no longer pins a sequence's row when that path now belongs to another sequence (its sidecar holds the old folder, or its render row names the path); the row follows to the new path, so it never names another sequence's file. RenderStore throws FolderMovedException when the sequence is not in the folder the index has. That is transient until this index's next scan, so client render uploads and render-node results now answer 503 folder_moved, keep the part file and the node's job, instead of failing them for good with a wrong reason. Save both and Take server refused because the folder moved now say Errors.Archive.FolderMoved (try again after the next scan) instead of the "changed again, choose again" sentence, which repeated until a scan. Doc wording: the ReorganizeDialogViewModel summary covers a sequence kept whole, and RenamePlanner.Plan's existsExactly says the own folder is found under at most one of the two names. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit d898798657197d48f4e19b7f776003eb2fc441b5)
This commit is contained in:
1 parent
d0da224de5
commit
964b996af2
21 files changed
+239
-46
No files matched your search
@@ -1,3 +1,4 @@
|
||||
using Chronos.Core.Localization;
|
||||
using Chronos.Core.Model;
|
||||
using Chronos.Core.Project;
|
||||
using Chronos.Data.Archiving;
|
||||
@@ -485,7 +486,8 @@ public sealed class SyncServiceTests(TestContext context)
|
||||
moved = plan.Steps.Single().ToFolder;
|
||||
};
|
||||
f.Remote.OnceBeforeFrames = () => f.Archive.ScanAsync();
|
||||
await Assert.ThrowsAsync<SyncConflictChangedException>(() => f.Sync.ResolveAsync(f.Remote, remote.Id, SyncResolution.SaveBoth, f.Ct));
|
||||
var refused = await Assert.ThrowsAsync<SyncConflictChangedException>(() => f.Sync.ResolveAsync(f.Remote, remote.Id, SyncResolution.SaveBoth, f.Ct));
|
||||
Assert.Equal(Loc.L("Errors.Archive.FolderMoved"), refused.Message, "the user hears to try again after the next scan");
|
||||
// The server's frames were not read for a version that is not taken: the scan comes now.
|
||||
f.Remote.OnceBeforeFrames = null;
|
||||
await f.Archive.ScanAsync();
|
||||
@@ -518,8 +520,9 @@ public sealed class SyncServiceTests(TestContext context)
|
||||
var plan = await other.PlanRenameAsync(archive.Id, [local.Id], "moved/{title}", null, f.Ct);
|
||||
await other.ApplyRenameAsync(plan, null, f.Ct);
|
||||
};
|
||||
await Assert.ThrowsAsync<SyncConflictChangedException>(() => f.Sync.ResolveAsync(f.Remote, remote.Id, SyncResolution.TakeServer, f.Ct));
|
||||
var refused = await Assert.ThrowsAsync<SyncConflictChangedException>(() => f.Sync.ResolveAsync(f.Remote, remote.Id, SyncResolution.TakeServer, f.Ct));
|
||||
Assert.Null(f.Remote.OnceBeforeManifest, "the folder moved during the resolution");
|
||||
Assert.Equal(Loc.L("Errors.Archive.FolderMoved"), refused.Message, "the user hears to try again after the next scan");
|
||||
|
||||
Assert.True(SyncRules.SameSettings(SyncFixture.Window41, (await f.Db.Sequences.GetAsync(local.Id, f.Ct))!.SettingsJson), "nothing applied");
|
||||
Assert.False(Directory.Exists(left), "the folder it left is not created again");
|
||||
@@ -565,7 +568,8 @@ public sealed class SyncServiceTests(TestContext context)
|
||||
var later = SyncFixture.Window41.Replace("41", "45", StringComparison.Ordinal);
|
||||
await f.EditLocalSettingsAsync(local.Id, later);
|
||||
|
||||
await Assert.ThrowsAsync<SyncConflictChangedException>(() => f.Sync.ResolveAsync(f.Remote, remote.Id, SyncResolution.TakeServer, f.Ct));
|
||||
var refused = await Assert.ThrowsAsync<SyncConflictChangedException>(() => f.Sync.ResolveAsync(f.Remote, remote.Id, SyncResolution.TakeServer, f.Ct));
|
||||
Assert.Equal(Loc.L("Errors.Sync.ChangedAgain"), refused.Message);
|
||||
|
||||
Assert.True(SyncRules.SameSettings(later, (await f.Db.Sequences.GetAsync(local.Id, f.Ct))!.SettingsJson), "this PC's later edit is kept");
|
||||
Assert.True(SyncRules.SameSettings(SyncFixture.Window33, remote.SettingsJson));
|
||||
|
||||
Reference in new issue
Block a user