refactor: collapse single-implementation interfaces

Nine interfaces had exactly one implementation and no test double — they existed
only to be named twice in a DI registration: IFindingsStore, IFindingsStoreLocator,
IPrimeScheduleSignal, IRefineRunner, IWeekReportService, IMergeCoordinator,
IMissionControlPane, IOnlineLoginService, ITaskListFilter. Consumers now depend on
the concrete type; the DTO records that shared those files moved next to their
implementation. IInteractiveLaunchSpecService stays — it carries 54 lines of
contract documentation, which is not ceremony.

IMergeCoordinator in particular had a redundant null object: MergeCoordinator with
a null Handler already no-ops, and every test used the real class with Handler set.

Filtering/ collapses from 8 files to 1. ITaskListFilter and TaskListFilterBase were
a double abstraction over four predicates, with MatchesAsContext => false declared
in both. SmartFlagFilter also compiled its expression twice (its own _flag plus the
inherited Matches cache) — it now uses the cache.

StaticTokenAuthProvider was in src but production uses ZitadelAuthProvider; it is
a test double, so it moves to the test project. Its own test goes away with it.
This commit is contained in:
mika kuns
2026-08-26 10:12:23 +02:00
parent 76d836a278
commit 296251e27e
45 changed files with 174 additions and 327 deletions
@@ -1,11 +1,11 @@
using ClaudeDo.Data.Filtering.Filters;
using ClaudeDo.Data.Filtering;
using Microsoft.EntityFrameworkCore;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Data.Tests.Filtering;
/// <summary>
/// Proves that <see cref="ClaudeDo.Data.Filtering.ITaskListFilter.MatchExpression"/> is a real
/// Proves that <see cref="ClaudeDo.Data.Filtering.TaskListFilter.MatchExpression"/> is a real
/// expression tree that EF Core can translate into SQL, not just an in-memory delegate — the
/// whole point of splitting it out from <c>Matches</c>.
/// </summary>
@@ -1,4 +1,4 @@
using ClaudeDo.Data.Filtering.Filters;
using ClaudeDo.Data.Filtering;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Data.Tests.Filtering;
@@ -1,3 +1,4 @@
using ClaudeDo.Data.Filtering;
using ClaudeDo.Data.Models;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
@@ -1,5 +1,4 @@
using ClaudeDo.Data.Filtering;
using ClaudeDo.Data.Filtering.Filters;
namespace ClaudeDo.Data.Tests.Filtering;
@@ -1,4 +1,4 @@
using ClaudeDo.Data.Filtering.Filters;
using ClaudeDo.Data.Filtering;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
namespace ClaudeDo.Data.Tests.Filtering;
@@ -1,4 +1,4 @@
using ClaudeDo.Data.Filtering.Filters;
using ClaudeDo.Data.Filtering;
using ClaudeDo.Data.Models;
using TaskStatus = ClaudeDo.Data.Models.TaskStatus;
@@ -0,0 +1,16 @@
using ClaudeDo.Worker.Online.Interfaces;
namespace ClaudeDo.Worker.Online;
/// <summary>
/// Test double: an <see cref="IOnlineAuthProvider"/> that returns a fixed token supplied at
/// construction. Production uses <c>ZitadelAuthProvider</c>.
/// </summary>
public sealed class StaticTokenAuthProvider(string? token = null) : IOnlineAuthProvider
{
public Task<string?> GetAccessTokenAsync(CancellationToken ct = default)
=> Task.FromResult(token);
public Task<string?> GetAccessTokenAsync(bool forceRefresh, CancellationToken ct = default)
=> Task.FromResult(token);
}
@@ -1,30 +0,0 @@
using ClaudeDo.Worker.Online;
namespace ClaudeDo.Worker.Tests.Online;
public sealed class StaticTokenAuthProviderTests
{
[Fact]
public async Task WithToken_Returns_Token()
{
var provider = new StaticTokenAuthProvider("my-token");
var result = await provider.GetAccessTokenAsync();
Assert.Equal("my-token", result);
}
[Fact]
public async Task WithNull_Returns_Null()
{
var provider = new StaticTokenAuthProvider(null);
var result = await provider.GetAccessTokenAsync();
Assert.Null(result);
}
[Fact]
public async Task Default_Returns_Null()
{
var provider = new StaticTokenAuthProvider();
var result = await provider.GetAccessTokenAsync();
Assert.Null(result);
}
}