Files
james.maesandCodex GPT-6 38dd5c1488 feat: implement Windows MarkdownViewr (#35)
This replaces the blocked history in PR #3 with one properly attributed,
signed/DCO commit. The owner personally reviewed and approved PR #3 in
the release session.

**No file changes from the approved candidate:** both
baee14f492 and
e605df62c4 have exact Git tree
a85912cbad. Original PR #3 and its commits
are preserved for review history. Historical commits were locally signed
but GitHub reported no_user; protected merge checks those introduced
commits even for squash merging. This commit resolves attribution
without bypassing or weakening signature rules.

The reader, Settings, themes, source highlighting/split, live reload,
file associations, Print/PDF, About credits, toolbar/footer/editor
fixes, user-first README/screenshots and developer guides are exactly
the approved implementation. Stable/dev separation and protected Azure
signing caller are unchanged.

Evidence:
- Approved tree baee14f / CI38285775463 passes all checks. Downloaded
focused29/29, published111/111, stable110/110 and dev110/110 TRXs have
zero failures/skips. Core coverage100% lines/98.86% branches; actual
update/restart/coexistence/default-preservation receipts verify.
- New single-commit hooks, online workflow security, signing and DCO
pass. GitHub must rerun all required checks on this commit; results are
not copied across SHAs.
- Live repository setup validates18 Actions-bound checks, with only
fuzzing added and all prior protections preserved.
- OpenSSF project15417 is now owner-reviewed and saved at70% under
owner-confirmed CDLA-Permissive2.0. This is an in-progress assessment,
not a passing badge.
- Production CI OIDC and signed1.0/dev publication remain required;
local representative signing is not CI proof.

Substantial AI assistance: Codex (GPT-6). Supersedes PR #3. Release work
remains tracked in #33.

Closes #4, #6, #7, #8, #9, #10, #11, #12, #13, #14, #15, #16, #17, #18,
#19, #20, #21, #22, #23, #24, #25, #26, #27, #28, #29, #32, #34.
Refs #1, #5, #30, #31, #33.

Signed-off-by: James Maes <james@kof22.com>
Co-authored-by: Codex GPT-6 <noreply@openai.com>
2026-10-12 14:01:42 -05:00

63 lines
3.3 KiB
C#

/*
* Copyright (c) 2026 James Maes
* SPDX-License-Identifier: MIT
*/
using System.Text.Json;
namespace MarkdownViewr.Windows.Core.Tests;
/// <summary>The actual restored package inventory and credit destinations must stay in sync when dependencies change.</summary>
public sealed class AboutComponentsTests
{
/// <summary>Every application/build/test package restored for this repository is acknowledged without omitted transitive libraries.</summary>
[Fact]
public void Catalog_RestoredAssets_CoversEveryPackage()
{
string root = FindRepository();
string[] paths = ["src/MarkdownViewr.Windows/obj/project.assets.json", "tests/MarkdownViewr.Windows.Core.Tests/obj/project.assets.json", "tests/MarkdownViewr.Windows.UiTests/obj/project.assets.json"];
var restored = new HashSet<string>(StringComparer.Ordinal);
foreach(string path in paths)
{
using var assets = JsonDocument.Parse(File.ReadAllText(Path.Combine(root, path)));
foreach(JsonProperty library in assets.RootElement.GetProperty("libraries").EnumerateObject())
{
if(string.Equals(library.Value.GetProperty("type").GetString(), "package", StringComparison.Ordinal))
{
restored.Add(library.Name);
}
}
}
AboutComponent[] credits = AboutComponents.Runtime.Concat(AboutComponents.Development).ToArray();
var credited = credits.Where(credit => !string.Equals(credit.Name, ".NET Runtime", StringComparison.Ordinal)).Select(credit => credit.Name + "/" + credit.Version).ToHashSet(StringComparer.Ordinal);
Assert.True(restored.SetEquals(credited), "About credits must match actual restored direct/transitive package versions. Missing: " + string.Join(", ", restored.Except(credited, StringComparer.Ordinal)) + "; stale: " + string.Join(", ", credited.Except(restored, StringComparer.Ordinal)));
Assert.Equal(credits.Length, credits.Select(credit => credit.Name).Distinct(StringComparer.Ordinal).Count());
foreach(AboutComponent credit in credits)
{
Assert.NotEmpty(credit.License);
Assert.Equal("https", new Uri(credit.ProjectUrl).Scheme);
Assert.Equal("https", new Uri(credit.LicenseUrl).Scheme);
Assert.DoesNotContain("deprecateLicenseUrl", credit.LicenseUrl, StringComparison.Ordinal);
}
Assert.Contains(AboutComponents.Runtime, credit => string.Equals(credit.Name, "Microsoft.Web.WebView2", StringComparison.Ordinal));
Assert.Contains(AboutComponents.Runtime, credit => string.Equals(credit.Name, "AngleSharp.Css", StringComparison.Ordinal));
Assert.Contains(AboutComponents.Development, credit => string.Equals(credit.Name, "FlaUI.Core", StringComparison.Ordinal));
}
/// <summary>Build-produced assets are independent evidence of what the repository currently uses, not a duplicated fixture list.</summary>
private static string FindRepository()
{
for(DirectoryInfo? directory = new(AppContext.BaseDirectory); directory is not null; directory = directory.Parent)
{
if(File.Exists(Path.Combine(directory.FullName, "MarkdownViewr.Windows.slnx")))
{
return directory.FullName;
}
}
throw new DirectoryNotFoundException("Restore/build this repository before checking its actual dependency credits.");
}
}