R8: Accounting- + Supervisor-Modul + Core-Datenfundament (S-0)
Portierung der beiden fehlenden Grundbausteine aus PolytraderSharp (voller Ausbau). Core S-0 (Datenfundament fuer Analyse/Forensik): - core_decision_journal + core_order_events (+ ReasonCode/Decision/OrderEvent-Enums), IDecisionJournal/IOrderEventLog mit fehlertoleranten EF-Impls (Handel bricht nie). - SignalId-Durchreichung TradeSignal -> ExecutionService -> core_trade_history; ExecutionService schreibt an jeder Verzweigung Journal/Order-Events. - JSONL-Log-Sink (LogJson + Dual-Sink), pure Analytik: RealizedPnlEngine (FIFO), TradeAnalytics, DossierBuilder. Migration AddAnalysisFoundation. Accounting-Modul (acc_): unabhaengiger IBKR-Kontoauszug (Activity Flex Query) hinter Interfaces mit Offline-Null-Stubs -> append-only Ledger + Periodenabrechnung/BWA + FX (USD/EUR) + CSV/PDF (PDFsharp/MigraDoc). Steuerschicht bewusst offen (Platzhalter-Tab). Kein Handel. Migration InitialAccounting. Supervisor-Modul (sup_): read-only OpenRouter-Agent (Function-Calling-Loop) + read-only Tool-Registry (8 Tools) + Profile + Dossier-Browser + Counterfactual-Job (Stub) + Tagesbericht/MCP-Light (opt-in). Migration InitialSupervisor. Verdrahtung: Program.cs (beide Module + Icons), slnx/App/Tests-Referenzen, provision-db.ps1, AppSettings-Sektionen, docs/konzepte, README. Tests: 79 -> 117 gruen (FIFO/KPIs/Dossier/JSONL, Classifier/Engine/FX/Idempotenz, OpenRouter/Registry/Agent/MCP, STA-Konstruktion beider neuen Fenster). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
cbbedb2e0e
commit
2a312ca035
@@ -0,0 +1,59 @@
|
||||
using FluentAssertions;
|
||||
using IBKRTrader.Modules.Supervisor.Agent;
|
||||
using IBKRTrader.Modules.Supervisor.Mcp;
|
||||
|
||||
namespace IBKRTrader.Tests.Modules.Supervisor;
|
||||
|
||||
[Trait("cat", "unit")]
|
||||
public class McpJsonRpcTests
|
||||
{
|
||||
private static SupervisorToolRegistry Registry()
|
||||
{
|
||||
var reg = new SupervisorToolRegistry();
|
||||
reg.Register(new SupervisorTool("echo", "Echo", """{"type":"object","properties":{"x":{"type":"string"}}}""",
|
||||
args => SupervisorToolRegistry.GetString(args, "x") ?? ""));
|
||||
return reg;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Initialize_ReturnsServerInfo()
|
||||
{
|
||||
var res = McpJsonRpc.Handle("""{"jsonrpc":"2.0","id":1,"method":"initialize"}""", Registry());
|
||||
res.Should().Contain("ibkrtrader-supervisor").And.Contain("protocolVersion");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToolsList_ListsTools()
|
||||
{
|
||||
var res = McpJsonRpc.Handle("""{"jsonrpc":"2.0","id":2,"method":"tools/list"}""", Registry());
|
||||
res.Should().Contain("echo").And.Contain("inputSchema");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ToolsCall_ExecutesAndWrapsResult()
|
||||
{
|
||||
var res = McpJsonRpc.Handle(
|
||||
"""{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"echo","arguments":{"x":"hi"}}}""",
|
||||
Registry());
|
||||
res.Should().Contain("\"text\":\"hi\"").And.Contain("\"isError\":false");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnknownMethod_ReturnsMethodNotFound()
|
||||
{
|
||||
var res = McpJsonRpc.Handle("""{"jsonrpc":"2.0","id":4,"method":"nope"}""", Registry());
|
||||
res.Should().Contain("-32601");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ParseError_ReturnsMinus32700()
|
||||
{
|
||||
McpJsonRpc.Handle("{ kaputt", Registry()).Should().Contain("-32700");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Notification_WithoutId_ReturnsNull()
|
||||
{
|
||||
McpJsonRpc.Handle("""{"jsonrpc":"2.0","method":"ping"}""", Registry()).Should().BeNull();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user