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.
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using ClaudeDo.Ui.ViewModels;
|
|
using Xunit;
|
|
|
|
namespace ClaudeDo.Ui.Tests;
|
|
|
|
public class StaleWorkerBannerDecisionTests
|
|
{
|
|
private const string ShaA = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
|
|
private const string ShaB = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb";
|
|
|
|
[Fact]
|
|
public void True_when_build_is_a_strict_ancestor_of_head()
|
|
{
|
|
Assert.True(IslandsShellViewModel.ShouldShowStaleWorkerBanner(ShaA, ShaB, isAncestor: true));
|
|
}
|
|
|
|
[Fact]
|
|
public void False_when_build_equals_head_even_if_ancestor_check_says_true()
|
|
{
|
|
Assert.False(IslandsShellViewModel.ShouldShowStaleWorkerBanner(ShaA, ShaA, isAncestor: true));
|
|
}
|
|
|
|
[Fact]
|
|
public void False_when_ancestor_check_says_no()
|
|
{
|
|
Assert.False(IslandsShellViewModel.ShouldShowStaleWorkerBanner(ShaA, ShaB, isAncestor: false));
|
|
}
|
|
|
|
[Fact]
|
|
public void False_when_ancestor_check_is_unknown()
|
|
{
|
|
// Unknown must never be treated as stale.
|
|
Assert.False(IslandsShellViewModel.ShouldShowStaleWorkerBanner(ShaA, ShaB, isAncestor: null));
|
|
}
|
|
|
|
[Fact]
|
|
public void False_when_build_sha_missing()
|
|
{
|
|
Assert.False(IslandsShellViewModel.ShouldShowStaleWorkerBanner(null, ShaB, isAncestor: true));
|
|
}
|
|
|
|
[Fact]
|
|
public void False_when_head_sha_missing()
|
|
{
|
|
Assert.False(IslandsShellViewModel.ShouldShowStaleWorkerBanner(ShaA, null, isAncestor: true));
|
|
}
|
|
}
|