feat(daily-prep): load persisted prep log into the terminal on open

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-04 09:44:38 +02:00
parent 4d82079cac
commit 914095dc99
6 changed files with 34 additions and 0 deletions

View File

@@ -78,6 +78,8 @@ public abstract class StubWorkerClient : IWorkerClient
public virtual Task<DailyNoteDto?> AddDailyNoteAsync(DateOnly day, string text) => Task.FromResult<DailyNoteDto?>(null);
public virtual Task UpdateDailyNoteAsync(string id, string text) => Task.CompletedTask;
public virtual Task DeleteDailyNoteAsync(string id) => Task.CompletedTask;
public string LastPrepLog = "";
public virtual Task<string> GetLastPrepLogAsync() => Task.FromResult(LastPrepLog);
protected void RaisePropertyChanged(string name) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}

View File

@@ -80,4 +80,16 @@ public class DetailsIslandPrepModeTests : IDisposable
Assert.False(vm.IsNotesMode);
Assert.False(vm.IsTaskDetailVisible);
}
[Fact]
public async Task ShowPrep_loads_persisted_log_when_empty()
{
var stub = new DefaultStub { LastPrepLog = "{\"type\":\"assistant\",\"message\":{\"content\":[{\"type\":\"text\",\"text\":\"restored\"}]}}" };
var vm = NewDetailsVm(stub);
vm.ShowPrep();
await vm.LoadLastPrepLogIfEmptyAsync();
Assert.NotEmpty(vm.PrepLog);
}
}

View File

@@ -85,6 +85,7 @@ sealed class FakeWorkerClient : IWorkerClient
public Task<DailyNoteDto?> AddDailyNoteAsync(DateOnly day, string text) => Task.FromResult<DailyNoteDto?>(null);
public Task UpdateDailyNoteAsync(string id, string text) => Task.CompletedTask;
public Task DeleteDailyNoteAsync(string id) => Task.CompletedTask;
public Task<string> GetLastPrepLogAsync() => Task.FromResult(string.Empty);
}
// ── Helper to build VM with pre-seeded Items ──────────────────────────────────