Files
frameledger/tests/FrameLedger.App.Tests/AssemblyIdentityTests.cs
T
poli0981andClaude Opus 5.5 648e9c28b1 build: the alpha line - RELEASE_LINE stamped into every assembly, release.yml's line-vs-tag rule and Velopack alpha channel, CI on the alpha branch, no wiki for an alpha (D73) (beta.32 PR-1) (#344)
The owner, 2026-10-31: an alpha build where new .NET versions are tried, .NET 11 RC3 / C# 15 first,
with an experimental-build warning (owner decisions D73-D76, asked while planning). This is the
plumbing on main; it changes nothing in a beta.

- RELEASE_LINE (main | alpha), read like VERSION by Directory.Build.props, stamped as the
  FrameLedger.ReleaseLine assembly metadata; any other value is a build error. Shared.BuildLine
  reads it back for composition (BuildLineTests, AssemblyIdentityTests).
- release.yml: the version gate reads RELEASE_LINE - the alpha line takes vX.Y.Z-alpha.N and
  nothing else, no other line may carry an -alpha. tag; an alpha's vpk download and pack take
  --channel alpha (feed releases.alpha.json, asset names from assets.<channel>.json); the main
  line's pack command is unchanged. An alpha's release is titled "(experimental alpha)".
- ci.yml: also on pushes to alpha; no sonarcloud job and no Changelog step for pull requests into
  alpha. wiki.yml: no publish after an -alpha. tag.
- tools/fps-impact-runbook.ps1: the Agent path no longer names a TFM.
- Docs: 12_BUILD §The alpha line, 13_CI_CD §The alpha line (+ ci/release/wiki sections, branch
  policy), 11_UPDATER §Channels corrected in place (the alpha line uses Velopack channels;
  GithubSource reads the newest ten releases, hence one alpha per beta), 20_OPEN_QUESTIONS §G
  "The main line's .NET" with its decision table written first, CLAUDE.md, CHANGELOG.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 14:58:38 +00:00

87 lines
4.3 KiB
C#

// SPDX-License-Identifier: GPL-3.0-only
// Copyright (C) 2026 poli0981 - additional terms under GPLv3 section 7: see NOTICE
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using FluentAssertions;
using FluentAssertions.Execution;
using FrameLedger.App.Services;
namespace FrameLedger.App.Tests;
/// <summary>
/// beta.14 (D50): every managed assembly the package ships names the product, says what it is and carries the copyright
/// the native binaries carry. Until beta.14 the SDK's defaults stood — each library's company and product were its own
/// assembly name, the Agent's "FrameLedger.Agent" — and no managed binary had a copyright; Explorer's Properties ▸
/// Details and Task Manager read these. <c>tools/versioninfo-check.ps1</c> reads the same from the built and the
/// published binaries; this pins the source, against the native <c>FL_COPYRIGHT</c> word for word.
/// </summary>
public sealed class AssemblyIdentityTests
{
private static readonly Assembly[] _shipped =
[
typeof(UiIdentity).Assembly,
typeof(Domain.Sessions.ExitStatus).Assembly,
typeof(Application.Recording.ExitStatusMapper).Assembly,
typeof(Infrastructure.Persistence.LedgerPaths).Assembly,
typeof(Shared.Ipc.IpcProtocol).Assembly,
];
private static string RepoRoot()
{
for (DirectoryInfo? dir = new(AppContext.BaseDirectory); dir is not null; dir = dir.Parent)
{
if (File.Exists(Path.Combine(dir.FullName, "FrameLedger.slnx")))
{
return dir.FullName;
}
}
throw new InvalidOperationException("the repository root (FrameLedger.slnx) is not above " + AppContext.BaseDirectory);
}
/// <summary>The native version blocks' copyright line, as <c>src/native/CMakeLists.txt</c> sets it.</summary>
private static string NativeCopyright()
{
string cmake = File.ReadAllText(Path.Combine(RepoRoot(), "src", "native", "CMakeLists.txt"));
Match line = Regex.Match(cmake, "^set\\(FL_COPYRIGHT\\s+\"(?<text>[^\"]+)\"\\)", RegexOptions.Multiline | RegexOptions.ExplicitCapture | RegexOptions.CultureInvariant, TimeSpan.FromSeconds(1));
line.Success.Should().BeTrue("src/native/CMakeLists.txt sets FL_COPYRIGHT");
return line.Groups["text"].Value;
}
[Fact]
public void EveryShippedAssemblyNamesTheProductAndCarriesTheNativeCopyright()
{
string copyright = NativeCopyright();
using var scope = new AssertionScope();
foreach (Assembly assembly in _shipped)
{
string name = assembly.GetName().Name!;
(assembly.GetCustomAttribute<AssemblyCompanyAttribute>()?.Company).Should().Be("FrameLedger", name);
(assembly.GetCustomAttribute<AssemblyProductAttribute>()?.Product).Should().Be("FrameLedger", name);
(assembly.GetCustomAttribute<AssemblyCopyrightAttribute>()?.Copyright).Should().Be(copyright, name);
(assembly.GetCustomAttribute<AssemblyDescriptionAttribute>()?.Description).Should().NotBeNullOrWhiteSpace(name);
// The repository every assembly names is the one the App sends issues and document links to.
(assembly.GetCustomAttributes<AssemblyMetadataAttribute>().FirstOrDefault(static a => string.Equals(a.Key, "RepositoryUrl", StringComparison.Ordinal))?.Value)
.Should().Be(IssueLink.Repository, name);
// D73: one release line per build, the one RELEASE_LINE names — every shipped assembly says the same.
(assembly.GetCustomAttributes<AssemblyMetadataAttribute>().FirstOrDefault(static a => string.Equals(a.Key, Shared.BuildLine.MetadataKey, StringComparison.Ordinal))?.Value)
.Should().Be(Shared.BuildLine.Current.Name, name);
}
}
[Fact]
public void TheAppsVersionBlockIsWhatExplorerShows()
{
Assembly app = typeof(UiIdentity).Assembly;
FileVersionInfo block = FileVersionInfo.GetVersionInfo(app.Location);
(block.FileDescription, block.CompanyName, block.ProductName).Should().Be(("FrameLedger", "FrameLedger", "FrameLedger"),
"the apphost FrameLedger.exe carries a copy of this block");
block.LegalCopyright.Should().Be(NativeCopyright(), "one product, one copyright");
}
}