fix(mcp): register ticket import tools in the external MCP container
The external MCP server has its own DI container; TicketMcpTools could not resolve TicketImportService there, so both tools failed at runtime. Also surface a skipped import in the prime outcome and treat a sweep where every project board fails as an error instead of an empty backlog.
This commit is contained in:
@@ -311,6 +311,7 @@ public class PrimeRunnerTests : IDisposable
|
||||
var outcome = await runner.FireAsync(Schedule(PrimeActionKind.ImportTickets), CancellationToken.None);
|
||||
|
||||
Assert.True(outcome.Success);
|
||||
Assert.Contains("not configured", outcome.Message);
|
||||
var only = Assert.Single(claude.AllArguments);
|
||||
Assert.Contains(DailyPrepPrompt.SetMyDayTool, only);
|
||||
}
|
||||
|
||||
@@ -156,6 +156,15 @@ public sealed class TicketImportAllTests : IDisposable
|
||||
Assert.Contains("Hub Lagertechnik", r.SkippedReason);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetCandidates_throws_when_no_board_is_readable()
|
||||
{
|
||||
var (import, _) = await HarnessAsync(respond: r =>
|
||||
r.RequestUri!.AbsolutePath.Contains("/Board/project/") ? (HttpStatusCode.Forbidden, "") : Respond(r));
|
||||
|
||||
await Assert.ThrowsAsync<TicketApiException>(() => import.GetCandidatesAsync(CancellationToken.None));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetCandidates_throws_when_not_configured()
|
||||
{
|
||||
@@ -214,7 +223,8 @@ public sealed class TicketImportAllTests : IDisposable
|
||||
return (HttpStatusCode.NotFound, "");
|
||||
}
|
||||
|
||||
private async Task<(TicketImportService Import, ClaudeDoDbContext Ctx)> HarnessAsync(bool configured = true)
|
||||
private async Task<(TicketImportService Import, ClaudeDoDbContext Ctx)> HarnessAsync(
|
||||
bool configured = true, Func<HttpRequestMessage, (HttpStatusCode, string)>? respond = null)
|
||||
{
|
||||
var db = new DbFixture();
|
||||
_dbs.Add(db);
|
||||
@@ -240,7 +250,7 @@ public sealed class TicketImportAllTests : IDisposable
|
||||
|
||||
var clients = new TicketClientFactory(
|
||||
new TicketSystemConfig(worker, patStore),
|
||||
new StubHttpClientFactory(new StubHandler(Respond)),
|
||||
new StubHttpClientFactory(new StubHandler(respond ?? Respond)),
|
||||
NullLogger<BandelTicketClient>.Instance);
|
||||
var import = new TicketImportService(clients, factory, NullLogger<TicketImportService>.Instance);
|
||||
return (import, factory.CreateDbContext());
|
||||
|
||||
Reference in New Issue
Block a user