fix(ui): Log Visualizer shows every footer-log message

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-10-01 17:35:03 +02:00
co-authored by Claude Sonnet 5.5
parent d9355383a4
commit c956ab102e
5 changed files with 110 additions and 23 deletions
@@ -1,7 +1,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using ClaudeDo.Data.Models;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels;
using ClaudeDo.Ui.ViewModels.Modals;
using Xunit;
namespace ClaudeDo.Ui.Tests;
@@ -55,4 +59,49 @@ public class IslandsShellViewModelWorkerLogTests
Assert.StartsWith(expectedLocalHhmm + " · ", vm.WorkerLogText);
}
[Fact]
public async Task Visualizer_shows_flashed_and_received_footer_lines_with_their_levels()
{
var shell = new IslandsShellViewModel();
shell.FlashFooterInfo("claude 2.0 updating");
shell.OnWorkerLogReceived(new WorkerLogEntry("task merged", WorkerLogLevel.Success, DateTime.UtcNow.AddSeconds(1)));
var vm = new LogVisualizerViewModel(new BufferClient(), shell.FooterHistorySnapshot);
await vm.RefreshAsync();
Assert.Equal(new[] { ("task merged", WorkerLogLevel.Success), ("claude 2.0 updating", WorkerLogLevel.Info) },
vm.Rows.Select(r => (r.Message, r.Level)));
}
[Fact]
public async Task Footer_line_arriving_while_visualizer_is_open_shows_on_next_refresh()
{
var shell = new IslandsShellViewModel();
var vm = new LogVisualizerViewModel(new BufferClient(), shell.FooterHistorySnapshot);
await vm.RefreshAsync();
shell.FlashFooterError("boom");
await vm.RefreshAsync();
Assert.Equal(("boom", WorkerLogLevel.Error), (vm.Rows.Single().Message, vm.Rows.Single().Level));
}
[Fact]
public async Task Worker_warn_in_both_footer_history_and_buffer_appears_once()
{
var shell = new IslandsShellViewModel();
var warn = new WorkerLogEntry("disk low", WorkerLogLevel.Warn, DateTime.UtcNow);
shell.OnWorkerLogReceived(warn);
var vm = new LogVisualizerViewModel(new BufferClient(warn), shell.FooterHistorySnapshot);
await vm.RefreshAsync();
Assert.Single(vm.Rows);
}
private sealed class BufferClient(params WorkerLogEntry[] logs) : StubWorkerClient
{
public override Task<IReadOnlyList<WorkerLogEntry>> GetRecentLogsAsync() => Task.FromResult<IReadOnlyList<WorkerLogEntry>>(logs);
}
}