From 865232598097cd628933bdeeb940d9c102266e01 Mon Sep 17 00:00:00 2001 From: codex Date: Mon, 10 Aug 2026 10:10:35 +0300 Subject: [PATCH] test: cover requested and legacy startup candidates --- Launcher.Next.Core/StartupRosterPreflight.cs | 2 +- tests/Launcher.Next.Tests/StartupRosterPreflightTests.cs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Launcher.Next.Core/StartupRosterPreflight.cs b/Launcher.Next.Core/StartupRosterPreflight.cs index 77c1735..6d74254 100644 --- a/Launcher.Next.Core/StartupRosterPreflight.cs +++ b/Launcher.Next.Core/StartupRosterPreflight.cs @@ -43,7 +43,7 @@ public static class StartupRosterPreflight foreach (var root in roots) DiscoverRoot(root, requested, entries); var eligible = entries.Where(e => e.Eligible).ToArray(); StartupRosterCandidateStatus status; - if (entries.Any(e => e.EntryPath is null || e.EntrySha256 is null)) status = StartupRosterCandidateStatus.UnresolvedStartupEntry; + if (entries.Any(e => e.EntryPath is null)) status = StartupRosterCandidateStatus.UnresolvedStartupEntry; else if (eligible.Length == 0) status = StartupRosterCandidateStatus.UnresolvedStartupEntry; else if (eligible.Length == 1 && string.Equals(eligible[0].EntrySha256, requestedHash, StringComparison.OrdinalIgnoreCase) && string.Equals(eligible[0].PackageId, requested.PackageId, StringComparison.OrdinalIgnoreCase) diff --git a/tests/Launcher.Next.Tests/StartupRosterPreflightTests.cs b/tests/Launcher.Next.Tests/StartupRosterPreflightTests.cs index 5ce61b1..9ff7b56 100644 --- a/tests/Launcher.Next.Tests/StartupRosterPreflightTests.cs +++ b/tests/Launcher.Next.Tests/StartupRosterPreflightTests.cs @@ -9,13 +9,16 @@ public sealed class StartupRosterPreflightTests public void ForeignVersionIsConflicting() { var root = Path.Combine(Path.GetTempPath(), "roster-" + Guid.NewGuid().ToString("N")); - var old = Path.Combine(root, "P_Rec_Annot", "versions", "0.1.0"); + var requestedRoot = Path.Combine(root, "requested"); + Directory.CreateDirectory(requestedRoot); + File.WriteAllText(Path.Combine(requestedRoot, "PRecAnnot.Plant3D2026.dll"), "new"); + var old = Path.Combine(root, "Applications", "P_Rec_Annot", "versions", "0.1.0"); Directory.CreateDirectory(old); File.WriteAllText(Path.Combine(old, "PRecAnnot.Plant3D2026.dll"), "old"); - File.WriteAllText(Path.Combine(root, "P_Rec_Annot", "current.json"), "{\"Current\":\"0.1.0\"}"); + File.WriteAllText(Path.Combine(root, "Applications", "P_Rec_Annot", "current.json"), "{\"Current\":\"0.1.0\"}"); File.WriteAllText(Path.Combine(old, "package.manifest.json"), "{\"PackageId\":\"P_Rec_Annot\",\"Version\":\"0.1.0\",\"EntryAssembly\":\"PRecAnnot.Plant3D2026.dll\"}"); var requested = new PackageManifest(1, "P_Rec_Annot", "0.2.9", "Plant3D", 2026, "x64", "PRecAnnot.Plant3D2026.dll", [], new("netload", "PHP_REC_ANNOT")); - var report = StartupRosterPreflight.Inspect(root, requested, [root]); + var report = StartupRosterPreflight.Inspect(requestedRoot, requested, [Path.Combine(root, "Applications")]); Assert.Equal(StartupRosterCandidateStatus.ConflictingCandidatePresent, report.Status); Directory.Delete(root, true); }