fix(worker): route WeekReportService permission-mode through PermissionModeResolver
Closes the last unrouted --permission-mode call site: haiku default models were hardcoding raw "auto", which the CLI silently downgrades to interactive "default" and hangs the report generation. Also drops the author's personal C:\Private default exclude in favor of an empty default (config stays via ReportExcludedPaths).
This commit is contained in:
@@ -26,9 +26,10 @@ public class WeekReportServiceTests : IDisposable
|
||||
private sealed class FakeClaude : IClaudeProcess
|
||||
{
|
||||
public int Calls;
|
||||
public IReadOnlyList<string>? LastArgs;
|
||||
public RunResult Next = new() { ExitCode = 0, ResultMarkdown = "## Bericht" };
|
||||
public Task<RunResult> RunAsync(IReadOnlyList<string> args, string prompt, string wd, Func<string, Task> onLine, CancellationToken ct)
|
||||
{ Calls++; return Task.FromResult(Next); }
|
||||
{ Calls++; LastArgs = args; return Task.FromResult(Next); }
|
||||
}
|
||||
|
||||
private WeekReportService Make(FakeReader reader, FakeClaude claude) =>
|
||||
@@ -65,6 +66,32 @@ public class WeekReportServiceTests : IDisposable
|
||||
Assert.Equal(md, await svc.GetStoredAsync(Start, End));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task HaikuDefaultModel_RoutesPermissionModeThroughResolver()
|
||||
{
|
||||
using (var ctx = _db.CreateContext())
|
||||
{
|
||||
var repo = new AppSettingsRepository(ctx);
|
||||
var settings = await repo.GetAsync();
|
||||
settings.DefaultModel = "haiku";
|
||||
await repo.UpdateAsync(settings);
|
||||
}
|
||||
|
||||
var activityRepo = new RepoActivity { RepoPath = @"C:\Dev\App" };
|
||||
var day = new DayActivity { Date = new DateOnly(2026, 6, 1) };
|
||||
day.Prompts.Add("x");
|
||||
activityRepo.Days.Add(day);
|
||||
var claude = new FakeClaude();
|
||||
var svc = Make(new FakeReader { Result = new[] { activityRepo } }, claude);
|
||||
|
||||
await svc.GenerateAsync(Start, End);
|
||||
|
||||
Assert.NotNull(claude.LastArgs);
|
||||
var modeIndex = claude.LastArgs!.ToList().IndexOf("--permission-mode") + 1;
|
||||
Assert.Equal(PermissionModeResolver.Resolve("haiku", "auto"), claude.LastArgs[modeIndex]);
|
||||
Assert.NotEqual("auto", claude.LastArgs[modeIndex]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ClaudeFailure_Throws_AndDoesNotStore()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user