Files
ClaudeDo/tests/ClaudeDo.Worker.Tests/Hub/WorkerBuildInfoHubTests.cs
T
mika kuns 8bc7bc0c4f feat(ui): warn when the running worker predates the selected repo's merged HEAD
Stamps ClaudeDo.Worker's build with its exact git SHA (SourceRevisionId ->
InformationalVersion) and exposes it via a new GetWorkerBuildInfo hub call.
For the currently selected list, the shell compares that SHA against the
list's git HEAD (GitService.IsAncestorAsync) and shows a persistent footer
banner -- never auto-clearing, never shown on an unrelated repo or when the
ancestry can't be determined -- so "verified against a merge" claims aren't
silently made against a stale process. No auto-restart; the banner just
offers the existing RestartWorkerCommand.
2026-08-06 11:36:26 +02:00

37 lines
1.5 KiB
C#

using ClaudeDo.Worker.Hub;
using Xunit;
namespace ClaudeDo.Worker.Tests.Hub;
public sealed class WorkerBuildInfoHubTests
{
[Theory]
[InlineData(null, null)]
[InlineData("", null)]
[InlineData("1.2.3", null)]
[InlineData("1.2.3+", null)]
[InlineData("1.2.3+abc1234", "abc1234")]
// MinVer's own pre-release metadata can already contain a '+' (e.g. "+devsha"); our
// SourceRevisionId is appended last, so only the segment after the LAST '+' is authoritative.
[InlineData("0.0.0-alpha.0.4+devsha+f5b1a2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9", "f5b1a2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9")]
public void ParseBuildSha_ExtractsSegmentAfterLastPlus(string? informationalVersion, string? expected)
{
Assert.Equal(expected, WorkerHub.ParseBuildSha(informationalVersion));
}
[Fact]
public void GetWorkerBuildInfo_ReturnsDto()
{
var hub = new WorkerHub(
null!, null!, null!, null!, null!, null!,
null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!,
null!, new ClaudeDo.Worker.Online.OnlineInboxConfig(), new ClaudeDo.Worker.Online.OnlineTokenStore(),
new ClaudeDo.Worker.Runner.PendingQuestionRegistry(), null!);
// No assertion on the actual SHA value (depends on the build environment) — just that
// the call doesn't throw and always returns a DTO, never null.
var info = hub.GetWorkerBuildInfo();
Assert.NotNull(info);
}
}