fix(import): staging failures of a server import name this PC, failed jobs show catalog sentences

A server import stages its copies in this PC's cache folder, yet a full disk
there read 'The destination is full.' beside every photo, and a refused
write 'Titano may not write to the destination.', which sent the user to
the server. IImportSink.StagesOnThisPc (true for ServerImportSink) selects
Import.Failed.CacheFull and Import.Failed.CacheAccess instead.

A failed archive import job showed the job engine's raw text (SQLite, file
system or framework English) as the Import screen's line. ImportFailures.Job
keeps the archive engine's own localized sentences and shows 'The import
stopped before the end.' for anything else; the raw text stays in the
tooltip and the logs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-12 19:00:51 +00:00
1 parent 59d49f16af
commit e97b0e4f84
9 files changed
+100 -9

No files matched your search

@@ -174,6 +174,13 @@ public sealed class ImportExecutorTests(TestContext context)
Assert.Equal(Loc.L("Import.Failed.PhotoAccess"), ImportExecutor.FailureText(new UnauthorizedAccessException(@"Access to the path 'E:\DCIM\IMG_0001.CR3' is denied.")));
Assert.Equal(Loc.L("Import.Failed.Photo"), ImportExecutor.FailureText(new IOException("The semaphore timeout period has expired.")));
Assert.Equal(Loc.L("Import.Failed.Photo"), ImportExecutor.FailureText(new FileNotFoundException(@"Could not find file 'E:\DCIM\IMG_0001.CR3'.")));
// A sink that stages its copies on this PC (a server import, in the cache folder): a full disk there is this PC's.
Assert.Equal(Loc.L("Import.Failed.CacheFull"),
ImportExecutor.FailureText(new IOException("There is not enough space on the disk.", unchecked((int)0x80070070)), stagesOnThisPc: true));
Assert.Equal(Loc.L("Import.Failed.CacheFull"), ImportExecutor.FailureText(new IOException("The disk is full.", unchecked((int)0x80070027)), stagesOnThisPc: true));
Assert.Equal(Loc.L("Import.Failed.PhotoAccess"), ImportExecutor.FailureText(new UnauthorizedAccessException("Access denied."), stagesOnThisPc: true));
Assert.Equal(Loc.L("Import.Failed.Photo"), ImportExecutor.FailureText(new IOException("The semaphore timeout period has expired."), stagesOnThisPc: true));
Assert.False(((IImportSink)new FolderImportSink(Path.GetTempPath())).StagesOnThisPc, "a folder import stages inside the destination");
// The executor's own checks are one sentence each already.
Assert.Equal(Loc.L("Archive.Error.CopyMismatch", "IMG_0001.CR3"), ImportExecutor.FailureText(new CopyVerificationException("/staging/IMG_0001.CR3")));
Assert.Equal(Loc.L("Archive.Error.SourceChanged", "DCIM/IMG_0001.CR3"), ImportExecutor.FailureText(new ImportSourceChangedException("DCIM/IMG_0001.CR3")));