fix(app): captures show no machine paths, Server row actions stay on one line

The capture's data folder lives in the machine's temporary folder, so 8
baselines showed %TEMP% and the user name and differed on any other machine.
AppEnvironment.Shown now shows a capture's folders as a sample user's
(C:\Users\Studio\AppData\Local\Chronos, the sample archive as D:\ChronosArchive)
in Settings > Storage, Workspace and Advanced, the Rebuild index dialog and the
cache's Clear confirmation; AppEnvironment.Actual maps a typed path back, so the
capture still writes only to its temporary folder. Two captures with different
TEMP folders are identical.

On the Server screen the row actions column is at least 400 px wide, so a
remote row's three actions (an older server's disabled Open in workspace after
Open with proxies and Download originals, as BRIEF 12.7 asks) fit one 40 px
line at the capture size instead of wrapping.

Baselines recaptured: server, server-sync, server-conflict, server-signedout
(column layout; the disabled action of phase 5b), settings-storage,
settings-workspace, settings-advanced and archive-rebuild (sample paths), light
and dark.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-04 13:54:26 +01:00
1 parent 5ff9c086fd
commit bc4d8e0768
22 files changed
+104 -20

No files matched your search

@@ -128,7 +128,7 @@ public sealed class RebuildDialogViewModel : ArchiveDialogViewModel
Archive = archive;
Availability = availability;
Indexed = indexed;
_facts = Facts(null, availability == ArchiveAvailability.Offline ? Loc.L("Archive.Error.Offline", Formatting.LeftToRight(archive.RootPath)) : null);
_facts = Facts(null, availability == ArchiveAvailability.Offline ? Loc.L("Archive.Error.Offline", Formatting.LeftToRight(AppEnvironment.Shown(archive.RootPath))) : null);
RebuildCommand = new AsyncRelayCommand(RebuildAsync, () => !IsBusy && availability == ArchiveAvailability.Online);
}
@@ -181,7 +181,7 @@ public sealed class RebuildDialogViewModel : ArchiveDialogViewModel
return
[
new(Loc.L("Archive.Rebuild.Archive"), Archive.Name),
new(Loc.L("Archive.Rebuild.Root"), Archive.RootPath, IsPath: true),
new(Loc.L("Archive.Rebuild.Root"), AppEnvironment.Shown(Archive.RootPath), IsPath: true),
new(Loc.L("Archive.Rebuild.State"), Loc.L("Archive.Availability." + Availability)),
new(Loc.L("Archive.Rebuild.Indexed"), Loc.Plural("Shell.Status.Sequences", Indexed)),
Count(Loc.L("Archive.Rebuild.Sidecars"), f => f.Sidecar is not null),
@@ -57,9 +57,68 @@ public sealed class AppEnvironment
return new(paths.DataRoot, paths.IsPortable, isCapture: false, paths.SyncedFolder, paths.PortableSyncRoot, paths.EarlierPortableData);
}
/// <summary>
/// The data folder a capture shows in place of its temporary one (<see cref="Shown"/>): the default data folder of a
/// sample user, so the screenshots show no path of the machine (its temporary folder, its user name).
/// </summary>
public const string SampleDataDirectory = @"C:\Users\Studio\AppData\Local\Chronos";
/// <summary>The folder a capture shows for its sample archive (<c>archive</c> in its data folder), as the sample settings name it.</summary>
public const string SampleArchiveDirectory = @"D:\ChronosArchive";
/// <summary>The temporary data folder of the capture this process runs (the last one made); null outside a capture.</summary>
private static string? _captureData;
/// <summary>A fresh temporary data folder for screenshots and smoke tests; delete it with <see cref="DeleteCaptureData"/>.</summary>
public static AppEnvironment ForCapture() =>
new(Path.Combine(Path.GetTempPath(), "chronos-capture-" + Guid.CreateVersion7().ToString("N")), portable: false, isCapture: true);
public static AppEnvironment ForCapture()
{
var environment = new AppEnvironment(Path.Combine(Path.GetTempPath(), "chronos-capture-" + Guid.CreateVersion7().ToString("N")), portable: false, isCapture: true);
_captureData = environment.DataDirectory;
return environment;
}
/// <summary>
/// A path as the screens show it: one under a capture's temporary data folder as under <see cref="SampleDataDirectory"/>
/// (its sample archive as <see cref="SampleArchiveDirectory"/>), so the screenshots show nothing of the machine; any
/// other as it is. Only for text on screen: a path typed there goes through <see cref="Actual"/>.
/// </summary>
public static string Shown(string path) => Shown(path, _captureData);
/// <summary>A path typed or shown on screen as the one it stands for: <see cref="Shown(string)"/> undone, so a capture never writes outside its temporary folder.</summary>
public static string Actual(string shown) => Actual(shown, _captureData);
/// <summary><see cref="Shown(string)"/> for the capture whose data folder is <paramref name="captureData"/> (none: the path as it is).</summary>
internal static string Shown(string path, string? captureData)
{
foreach (var (actual, shown) in CaptureFolders(captureData))
{
if (Swap(path, actual, shown) is { } swapped) return swapped;
}
return path;
}
/// <summary><see cref="Actual(string)"/> for the capture whose data folder is <paramref name="captureData"/>.</summary>
internal static string Actual(string shown, string? captureData)
{
foreach (var (actual, sample) in CaptureFolders(captureData))
{
if (Swap(shown, sample, actual) is { } swapped) return swapped;
}
return shown;
}
/// <summary>A capture's folders and what the screens show for each, the more specific first.</summary>
private static (string Actual, string Shown)[] CaptureFolders(string? captureData) =>
captureData is null ? [] : [(Path.Combine(captureData, "archive"), SampleArchiveDirectory), (captureData, SampleDataDirectory)];
/// <summary><paramref name="path"/> with its root <paramref name="from"/> replaced by <paramref name="to"/>; null when it is not under it.</summary>
private static string? Swap(string path, string from, string to)
{
if (string.IsNullOrEmpty(path)) return null;
var root = from.TrimEnd(Path.DirectorySeparatorChar);
if (path.TrimEnd(Path.DirectorySeparatorChar).Equals(root, StringComparison.OrdinalIgnoreCase)) return to;
return path.StartsWith(root + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) ? to + path[root.Length..] : null;
}
/// <summary>Removes the temporary data folder of a capture environment (never a real one).</summary>
public void DeleteCaptureData()
+3 -3
View File
@@ -214,7 +214,7 @@
ToolTipService.ShowOnDisabled="True" Height="30" Margin="10,0,0,0" />
</Grid>
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr with 10 px gaps). The list always
<!-- Header; the rows repeat its columns (Server.html: 1.6fr 150px 150px 150px 1.4fr with 10 px gaps). The actions column is at least wide enough for a row's three actions (Open with proxies, Download originals and an older server's disabled Open in workspace) on one line. The list always
keeps its 10 px scroll-bar gutter and the header the same on its right, so the columns line up with or without scrolling. -->
<Border Grid.Row="1" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="0,1,0,1" Padding="14,8,24,8">
<Grid>
@@ -223,7 +223,7 @@
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="1.4*" MinWidth="280" />
<ColumnDefinition Width="1.4*" MinWidth="400" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Sequence}" />
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Server.Sync.Column.Local}" Margin="10,0,0,0" />
@@ -247,7 +247,7 @@
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="160" />
<ColumnDefinition Width="1.4*" MinWidth="280" />
<ColumnDefinition Width="1.4*" MinWidth="400" />
</Grid.ColumnDefinitions>
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Title}" ToolTip="{Binding Title}" />
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding LocalText}" ToolTip="{Binding LocalText}" Margin="10,0,0,0" />
+13 -12
View File
@@ -169,12 +169,13 @@ public sealed class SettingsViewModel : SectionViewModel
Logs = new LogSettingsRows(_s, Save);
// ---- Workspace ----
WorkspaceRows = new WorkspaceSettingsRows(_s, Save, () => Shell.Services.Workspace.Root, OpenWorkspaceFolder, ChangeWorkspaceFolderAsync);
WorkspaceRows = new WorkspaceSettingsRows(_s, Save, () => AppEnvironment.Shown(Shell.Services.Workspace.Root), OpenWorkspaceFolder, ChangeWorkspaceFolderAsync);
// ---- Storage ----
CacheFolder = new EditableField(CacheStore.Folder(shell.Services.Environment, _s), v => ArchiveLocations.Validate(v), v =>
// A capture shows its folders under a sample data folder; what is typed is taken back to the folder it stands for.
CacheFolder = new EditableField(AppEnvironment.Shown(CacheStore.Folder(shell.Services.Environment, _s)), v => ArchiveLocations.Validate(AppEnvironment.Actual(v)), v =>
{
var full = Path.GetFullPath(v);
var full = Path.GetFullPath(AppEnvironment.Actual(v));
_s.CacheFolder = full.Equals(Shell.Services.Environment.CacheDirectory, StringComparison.OrdinalIgnoreCase) ? null : full;
Save();
_ = UpdateCacheUsageAsync();
@@ -222,8 +223,8 @@ public sealed class SettingsViewModel : SectionViewModel
RedetectCommand = new AsyncRelayCommand(DetectEncodersAsync, () => !_isDetecting && !_isTesting);
SelfTestCommand = new AsyncRelayCommand(SelfTestAsync, () => !_isDetecting && !_isTesting && Encoders.Any(e => e.Row.CanSelfTest));
ClearCacheCommand = new AsyncRelayCommand(ClearCacheAsync);
OpenDataFolderCommand = new RelayCommand(() => ShellActions.Reveal(DataFolder));
OpenLogsCommand = new RelayCommand(() => ShellActions.Reveal(LogsFolder));
OpenDataFolderCommand = new RelayCommand(() => ShellActions.Reveal(Shell.Services.Environment.DataDirectory));
OpenLogsCommand = new RelayCommand(() => ShellActions.Reveal(Shell.Services.Environment.LogDirectory));
ExportDiagnosticsCommand = new AsyncRelayCommand(ExportDiagnosticsAsync);
BackupDatabaseCommand = new AsyncRelayCommand(BackupDatabaseAsync, () => Shell.Services.Database is not null);
RedetectFormatsCommand = new AsyncRelayCommand(() => DetectFormatsAsync(refresh: true), () => !_isDetectingFormats);
@@ -785,8 +786,8 @@ public sealed class SettingsViewModel : SectionViewModel
// ---------------- Advanced ----------------
public string DataFolder => Shell.Services.Environment.DataDirectory;
public string LogsFolder => Shell.Services.Environment.LogDirectory;
public string DataFolder => AppEnvironment.Shown(Shell.Services.Environment.DataDirectory);
public string LogsFolder => AppEnvironment.Shown(Shell.Services.Environment.LogDirectory);
public string PortableText => Loc.L(Shell.Services.Environment.IsPortable ? "Settings.Advanced.PortableOn" : "Settings.Advanced.PortableOff");
/// <summary>Level, retention, size limits and rotation of the log files, and the diagnostics bundle's share of each.</summary>
@@ -877,10 +878,10 @@ public sealed class SettingsViewModel : SectionViewModel
var environment = Shell.Services.Environment;
if (environment.SyncedFolder is not null)
Shell.Notify(Loc.L("Settings.Advanced.DataInOneDrive"), Formatting.LeftToRight(DataFolder), Loc.L("Common.Open"),
Loc.L("Tooltips.Settings.DataInOneDrive"), () => ShellActions.Reveal(DataFolder), isError: true);
Loc.L("Tooltips.Settings.DataInOneDrive"), () => ShellActions.Reveal(Shell.Services.Environment.DataDirectory), isError: true);
else if (environment.PortableSyncRoot is not null)
Shell.Notify(Loc.L("Settings.Advanced.DataOutsideOneDrive"), Formatting.LeftToRight(DataFolder), Loc.L("Common.Open"),
Loc.L("Tooltips.Settings.OpenDataFolder"), () => ShellActions.Reveal(DataFolder));
Loc.L("Tooltips.Settings.OpenDataFolder"), () => ShellActions.Reveal(Shell.Services.Environment.DataDirectory));
if (environment.EarlierPortableData is { } earlier)
Shell.Notify(Loc.L("Settings.Advanced.EarlierData"), Formatting.LeftToRight(earlier), Loc.L("Common.Open"),
Loc.L("Tooltips.Settings.EarlierData"), () => ShellActions.Reveal(earlier));
@@ -1338,7 +1339,7 @@ public sealed class SettingsViewModel : SectionViewModel
{
Heading = Loc.L("Settings.Storage.ClearTitle"),
Message = Loc.L("Settings.Storage.ClearMessage"),
Detail = Formatting.LeftToRight(folder),
Detail = Formatting.LeftToRight(AppEnvironment.Shown(folder)),
DetailToolTip = Loc.L("Tooltips.Settings.CacheFolder"),
SafeText = Loc.L("Settings.Storage.Keep"),
SafeToolTip = Loc.L("Tooltips.Settings.KeepCache"),
@@ -1553,7 +1554,7 @@ public sealed class SettingsViewModel : SectionViewModel
_s.CacheFolder = null;
_s.ThumbnailMemoryItems = defaults.ThumbnailMemoryItems;
_s.CacheLimitGb = defaults.CacheLimitGb;
CacheFolder.Load(CacheStore.Folder(Shell.Services.Environment, _s));
CacheFolder.Load(AppEnvironment.Shown(CacheStore.Folder(Shell.Services.Environment, _s)));
ThumbnailMemory.Load(_s.ThumbnailMemoryItems.ToString(CultureInfo.CurrentCulture));
CacheLimit.Load(_s.CacheLimitGb.ToString(CultureInfo.CurrentCulture));
if (Shell.Services.Thumbnails is { } thumbs) thumbs.Capacity = _s.ThumbnailMemoryItems;
@@ -1670,7 +1671,7 @@ public sealed class SettingsViewModel : SectionViewModel
LoadImportFields();
LoadAnalysisFields();
Parallelism.Load(EffectiveParallelism.ToString(CultureInfo.CurrentCulture));
CacheFolder.Load(CacheStore.Folder(Shell.Services.Environment, _s));
CacheFolder.Load(AppEnvironment.Shown(CacheStore.Folder(Shell.Services.Environment, _s)));
ThumbnailMemory.Load(_s.ThumbnailMemoryItems.ToString(CultureInfo.CurrentCulture));
CacheLimit.Load(_s.CacheLimitGb.ToString(CultureInfo.CurrentCulture));
if (Shell.Services.Thumbnails is { } thumbs) thumbs.Capacity = _s.ThumbnailMemoryItems;
@@ -61,6 +61,26 @@ public sealed class AppEnvironmentTests(TestContext context)
Assert.Null(AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive])).EarlierPortableData);
}
[Test]
public void ACaptureShowsSamplePathsAndTakesWhatIsTypedBackToItsOwnFolder()
{
// Whatever the machine's temporary folder and user name, the screenshots show the same paths.
var data = Path.Combine(context.CreateTempDirectory("temp"), "chronos-capture-0123");
Assert.Equal(AppEnvironment.SampleDataDirectory, AppEnvironment.Shown(data, data));
Assert.Equal(Path.Combine(AppEnvironment.SampleDataDirectory, "cache"), AppEnvironment.Shown(Path.Combine(data, "cache"), data));
Assert.Equal(@"D:\ChronosArchive\2026\Harbour", AppEnvironment.Shown(Path.Combine(data, "archive", "2026", "Harbour"), data));
// A path elsewhere, or one that only starts with the same letters, is shown as it is; outside a capture every path is.
Assert.Equal(data + "-other", AppEnvironment.Shown(data + "-other", data));
Assert.Equal(@"E:\Photos", AppEnvironment.Shown(@"E:\Photos", data));
Assert.Equal(Path.Combine(data, "cache"), AppEnvironment.Shown(Path.Combine(data, "cache"), null));
// What is typed over a shown path goes to the capture's own folder, never to the sample user's.
Assert.Equal(Path.Combine(data, "cache", "big"), AppEnvironment.Actual(Path.Combine(AppEnvironment.SampleDataDirectory, "cache", "big"), data));
Assert.Equal(Path.Combine(data, "archive"), AppEnvironment.Actual(AppEnvironment.SampleArchiveDirectory, data));
Assert.Equal(@"E:\Cache", AppEnvironment.Actual(@"E:\Cache", data));
Assert.Equal(AppEnvironment.SampleDataDirectory, AppEnvironment.Actual(AppEnvironment.SampleDataDirectory, null));
}
[Test]
public void AUserFolderOneDriveSynchronisesIsReportedNotHidden()
{
+5 -1
View File
@@ -24,7 +24,11 @@ dotnet run --project src/Chronos.Tools -- screenshots diff out/screenshots --out
The capture runs on sample data whose clock stands at `SampleData.Now` (2026-10-02 10:18 UTC), in English with English
formats and with animations off, so the same code draws the same pixels on any day. What the screens measure on
the machine is shown as fixed sample values while the clock is frozen (`AppClock`): free space (1.2 TB), the
server's response time (12 ms) and the time and duration of the last sync comparison. Two things still come from the
server's response time (12 ms) and the time and duration of the last sync comparison. The capture's data folder is a
new one in the machine's temporary folder, but the screens show it as a sample user's (`C:\Users\Studio\AppData\Local\Chronos`,
its sample archive as `D:\ChronosArchive`: `AppEnvironment.Shown`), so neither the temporary folder nor the user name
reaches a picture; a path typed over a shown one goes back to the temporary folder (`AppEnvironment.Actual`), so the
capture writes nowhere else. Two captures made with different `TEMP` folders are identical. Two things still come from the
machine: the time zone (times are shown in local time; the baselines are made in the development PC's, Europe/Rome,
which the Windows runner must share) and the fonts and scaling of Windows itself.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB