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.
This commit is contained in:
@@ -317,4 +317,45 @@ public class GitServiceMergeTests : IDisposable
|
||||
Assert.Equal(headBefore, GitRepoFixture.RunGit(repo.RepoDir, "rev-parse", "HEAD").Trim());
|
||||
Assert.True(string.IsNullOrWhiteSpace(GitRepoFixture.RunGit(repo.RepoDir, "status", "--porcelain")));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IsAncestorAsync_EarlierCommit_ReturnsTrue()
|
||||
{
|
||||
if (!GitRepoFixture.IsGitAvailable()) return;
|
||||
var repo = NewRepo();
|
||||
var first = repo.BaseCommit;
|
||||
|
||||
File.WriteAllText(Path.Combine(repo.RepoDir, "second.txt"), "second\n");
|
||||
GitRepoFixture.RunGit(repo.RepoDir, "add", "-A");
|
||||
GitRepoFixture.RunGit(repo.RepoDir, "commit", "-m", "chore: second commit");
|
||||
|
||||
var git = new GitService();
|
||||
var head = (await git.RevParseHeadAsync(repo.RepoDir)).Trim();
|
||||
|
||||
Assert.True(await git.IsAncestorAsync(repo.RepoDir, first, head));
|
||||
Assert.False(await git.IsAncestorAsync(repo.RepoDir, head, first));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IsAncestorAsync_SameCommit_ReturnsTrue()
|
||||
{
|
||||
if (!GitRepoFixture.IsGitAvailable()) return;
|
||||
var repo = NewRepo();
|
||||
var git = new GitService();
|
||||
var head = (await git.RevParseHeadAsync(repo.RepoDir)).Trim();
|
||||
|
||||
Assert.True(await git.IsAncestorAsync(repo.RepoDir, head, head));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task IsAncestorAsync_UnknownCommit_ReturnsNull()
|
||||
{
|
||||
if (!GitRepoFixture.IsGitAvailable()) return;
|
||||
var repo = NewRepo();
|
||||
var git = new GitService();
|
||||
var head = (await git.RevParseHeadAsync(repo.RepoDir)).Trim();
|
||||
var bogus = new string('a', 40);
|
||||
|
||||
Assert.Null(await git.IsAncestorAsync(repo.RepoDir, bogus, head));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user