Report a host's pinned paths among the fields an edit changed
ci / build and test (push) Successful in 4m10s
ci / android head (push) Successful in 5m32s
ci / api image (push) Failing after 18s
ci / desktop nightly (push) Successful in 2m0s

This commit is contained in:
jaap-jan committed 2026-09-28 20:50:23 +02:00
1 parent f05deb4fbc
commit a6a21decbd
3 files changed
+26 -5

No files matched your search

+1
View File
@@ -274,6 +274,7 @@ internal sealed class HostKind : IItemKind<HostSecret>
Note(changed, "Group", before.GroupId, after.GroupId); Note(changed, "Group", before.GroupId, after.GroupId);
Note(changed, "Tags", before.TagIds, after.TagIds); Note(changed, "Tags", before.TagIds, after.TagIds);
Note(changed, "Port forwards", before.PortForwards, after.PortForwards); Note(changed, "Port forwards", before.PortForwards, after.PortForwards);
Note(changed, "Pinned paths", before.PinnedPaths, after.PinnedPaths);
return changed; return changed;
} }
@@ -1020,10 +1020,10 @@ public sealed class ScreenLayoutTests : IAsyncLifetime
} }
/// <remarks> /// <remarks>
/// The FIELDS column is the one that grows: it is a list of names, and a host has fourteen of them — /// The FIELDS column is the one that grows: it is a list of names, and a host has fifteen of them —
/// eleven until inheritance added "Password prompt", tags added "Tags" and forwards added "Port /// eleven until inheritance added "Password prompt", tags added "Tags", forwards added "Port forwards"
/// forwards". Measured with an edit that touched several, because one field name fits anywhere. The /// and pinning added "Pinned paths". Measured with an edit that touched several, because one field
/// count is stated rather than derived, so /// name fits anywhere. The count is stated rather than derived, so
/// it has to be recounted against <c>HostKind.Changes</c> whenever a field is added; the literal in /// it has to be recounted against <c>HostKind.Changes</c> whenever a field is added; the literal in
/// <c>SeedLogsAsync</c> is the thing that actually keeps the column measured at its worst. /// <c>SeedLogsAsync</c> is the thing that actually keeps the column measured at its worst.
/// </remarks> /// </remarks>
@@ -2252,7 +2252,7 @@ public sealed class ScreenLayoutTests : IAsyncLifetime
ItemId = Guid.CreateVersion7(), ItemId = Guid.CreateVersion7(),
ItemLabel = "customer-a-production-database", ItemLabel = "customer-a-production-database",
Operation = ActivityOperation.Updated, Operation = ActivityOperation.Updated,
ChangedFields = "Hostname, Port, Username, Options, Password prompt, Group, Tags, Port forwards", ChangedFields = "Hostname, Port, Username, Options, Password prompt, Group, Tags, Port forwards, Pinned paths",
At = new DateTimeOffset(2026, 7, 30, 9, 15, 0, TimeSpan.Zero), At = new DateTimeOffset(2026, 7, 30, 9, 15, 0, TimeSpan.Zero),
DeviceName = "jaap-jan-workstation", DeviceName = "jaap-jan-workstation",
}, },
@@ -1,3 +1,4 @@
using DodoSSH.Client.Domain;
using DodoSSH.Contracts; using DodoSSH.Contracts;
namespace DodoSSH.Client.Sync.Tests; namespace DodoSSH.Client.Sync.Tests;
@@ -53,4 +54,23 @@ public sealed class ItemKindsTests
reconcilers.Keys.Order().ShouldBe(ItemKinds.SyncedTypes.Order()); reconcilers.Keys.Order().ShouldBe(ItemKinds.SyncedTypes.Order());
} }
[Fact]
public void AHostEditThatOnlyChangedItsPins_IsReportedAsChangingPinnedPaths()
{
// Pinned paths were the one host field Changes did not look at, so an edit that only pinned or
// unpinned a directory reached the keychain log as an update that changed nothing.
var before = new HostSecret
{
Label = "db-01",
Hostname = "db-01.internal",
PinnedPaths = PinnedPathList.Create(["/var/log"]),
};
var after = before with { PinnedPaths = PinnedPathList.Create(["/var/log", "/etc/nginx"]) };
HostKind.Instance.Changes(before, after).ShouldBe(["Pinned paths"]);
HostKind.Instance.Changes(before, before with { PinnedPaths = PinnedPathList.Empty })
.ShouldBe(["Pinned paths"]);
HostKind.Instance.Changes(before, before with { }).ShouldBeEmpty();
}
} }