refactor(worker): OnlineTokenStore zu DpapiTokenStore verallgemeinert

This commit is contained in:
mika kuns
2026-08-27 12:27:34 +02:00
parent 3171690bae
commit 41bfc242fa
21 changed files with 136 additions and 137 deletions
@@ -1,3 +1,4 @@
using ClaudeDo.Worker;
using ClaudeDo.Worker.Config;
using ClaudeDo.Worker.Hub;
using ClaudeDo.Worker.Online;
@@ -21,17 +22,17 @@ public sealed class OnlineInboxHubTests : IDisposable
try { File.Delete(_tokenPath); } catch { }
}
private (WorkerHub hub, OnlineInboxConfig inboxCfg, OnlineTokenStore store) CreateHub(
OnlineInboxConfig? inboxCfg = null, OnlineTokenStore? store = null)
private (WorkerHub hub, OnlineInboxConfig inboxCfg, DpapiTokenStore store) CreateHub(
OnlineInboxConfig? inboxCfg = null, DpapiTokenStore? store = null)
{
var cfg = new WorkerConfig();
inboxCfg ??= cfg.OnlineInbox;
store ??= new OnlineTokenStore(_tokenPath);
store ??= new DpapiTokenStore(_tokenPath);
var broadcaster = new HubBroadcaster(new CapturingHubContext());
var hub = new WorkerHub(
null!, null!, null!, null!, broadcaster, null!,
null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!, null!,
cfg, inboxCfg, store, new ClaudeDo.Worker.Runner.PendingQuestionRegistry(), null!);
cfg, inboxCfg, new OnlineRefreshTokenStore(store), new ClaudeDo.Worker.Runner.PendingQuestionRegistry(), null!);
hub.Clients = new FakeHubCallerClients(new RecordingClientProxy());
hub.Context = new FakeHubCallerContext();
return (hub, inboxCfg, store);
@@ -95,7 +96,7 @@ public sealed class OnlineInboxHubTests : IDisposable
var cfg = new WorkerConfig();
// point SaveOnlineInbox to our temp file
var inboxCfg = cfg.OnlineInbox;
var store = new OnlineTokenStore(_tokenPath);
var store = new DpapiTokenStore(_tokenPath);
var broadcaster = new HubBroadcaster(new CapturingHubContext());
// Patch cfg to save to our temp path by writing an initial file there