Stufe 4c (#764): Bezeichner auf Englisch - Typen, Methoden, Felder, Parameter, Locals, Testnamen

Mit Roslyn umbenannt (Verweise folgen, Zeichenketten bleiben unberuehrt).
Nicht umbenannt, weil gespeichert oder ueber die API gebunden (Stufe 4e):
Properties, Record-Parameter, Enum-Member sowie die Parameter der
Endpunkt-Handler (Routen-/Query-Bindung ueber den Namen). Die JSON-Felder
anonymer Objekte bleiben ausdruecklich benannt (JsonFilter: pfad).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard
2026-10-04 13:18:43 +02:00
co-authored by Claude Opus 5.5
parent 837a634a22
commit 77062facc9
190 changed files with 4813 additions and 4813 deletions
@@ -21,14 +21,14 @@ namespace ClawdDotNet.Core.Tests.Engine;
/// </summary>
public sealed class DelegationDepthTests
{
private static readonly TimeSpan Frist = TimeSpan.FromSeconds(20);
private static readonly TimeSpan Deadline = TimeSpan.FromSeconds(20);
/// <summary>Waits for the run, but fails instead of hanging.</summary>
private static async Task<AgentRunResult> MitFrist(Task<AgentRunResult> lauf)
private static async Task<AgentRunResult> WithDeadline(Task<AgentRunResult> run)
{
var fertig = await Task.WhenAny(lauf, Task.Delay(Frist));
fertig.ShouldBe(lauf, "Der Lauf ist nicht zurückgekommen — das ist die Verklemmung aus B8.");
return await lauf;
var done = await Task.WhenAny(run, Task.Delay(Deadline));
done.ShouldBe(run, "Der Lauf ist nicht zurückgekommen — das ist die Verklemmung aus B8.");
return await run;
}
// ═══════════════════════════════════════════════════════════
@@ -36,7 +36,7 @@ public sealed class DelegationDepthTests
// ═══════════════════════════════════════════════════════════
[Fact]
public async Task A_nach_B_nach_A_wird_abgebrochen_statt_zu_verklemmen()
public async Task A_to_B_to_A_is_aborted_instead_of_deadlocking()
{
var tool = new DelegatingTool(new Dictionary<string, string>
{
@@ -50,22 +50,22 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
var result = await MitFrist(
var result = await WithDeadline(
fixture.Engine.ChatAsync(a, "Bitte klären", "test-instance", default));
result.Status.ShouldBe(AgentRunStatus.Completed);
// The way back B → A was rejected, the way there A → B was not.
var rueckweg = tool.Handoffs.Single(h => h is { From: "agent-b", To: "agent-a" });
rueckweg.Delivered.ShouldBeFalse();
rueckweg.Error.ShouldNotBeNull().ShouldContain("Zyklus");
rueckweg.Error.ShouldNotBeNull().ShouldContain("agent-a -> agent-b -> agent-a");
var wayBack = tool.Handoffs.Single(h => h is { From: "agent-b", To: "agent-a" });
wayBack.Delivered.ShouldBeFalse();
wayBack.Error.ShouldNotBeNull().ShouldContain("Zyklus");
wayBack.Error.ShouldNotBeNull().ShouldContain("agent-a -> agent-b -> agent-a");
tool.Handoffs.Single(h => h is { From: "agent-a", To: "agent-b" }).Delivered.ShouldBeTrue();
}
[Fact]
public async Task Die_Ablehnung_kommt_als_Ergebnis_zurueck_nicht_als_Wurf()
public async Task The_rejection_comes_back_as_a_result_not_as_a_throw()
{
// The rejected agent should be able to continue working — it gets a reason,
// not an abort. Otherwise the cycle check would only lead to a different failure.
@@ -81,7 +81,7 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
var result = await MitFrist(
var result = await WithDeadline(
fixture.Engine.ChatAsync(a, "Bitte klären", "test-instance", default));
result.Status.ShouldBe(AgentRunStatus.Completed);
@@ -93,7 +93,7 @@ public sealed class DelegationDepthTests
// ═══════════════════════════════════════════════════════════
[Fact]
public async Task Eine_Staffel_endet_an_der_Tiefengrenze()
public async Task A_relay_ends_at_the_depth_limit()
{
// A → B → C → D would be depth 3. With MaxDelegationDepth = 2 it stops at C.
var tool = new DelegatingTool(new Dictionary<string, string>
@@ -113,18 +113,18 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
await MitFrist(fixture.Engine.ChatAsync(a, "Bitte klären", "test-instance", default));
await WithDeadline(fixture.Engine.ChatAsync(a, "Bitte klären", "test-instance", default));
tool.Handoffs.Single(h => h.To == "agent-b").Delivered.ShouldBeTrue();
tool.Handoffs.Single(h => h.To == "agent-c").Delivered.ShouldBeTrue();
var zuTief = tool.Handoffs.Single(h => h.To == "agent-d");
zuTief.Delivered.ShouldBeFalse();
zuTief.Error.ShouldNotBeNull().ShouldContain("Delegationstiefe");
var tooDeep = tool.Handoffs.Single(h => h.To == "agent-d");
tooDeep.Delivered.ShouldBeFalse();
tooDeep.Error.ShouldNotBeNull().ShouldContain("Delegationstiefe");
}
[Fact]
public async Task Innerhalb_der_Grenze_geht_die_Staffel_durch()
public async Task Within_the_limit_the_relay_goes_through()
{
var tool = new DelegatingTool(new Dictionary<string, string>
{
@@ -141,7 +141,7 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
var result = await MitFrist(
var result = await WithDeadline(
fixture.Engine.ChatAsync(a, "Bitte klären", "test-instance", default));
result.Status.ShouldBe(AgentRunStatus.Completed);
@@ -153,7 +153,7 @@ public sealed class DelegationDepthTests
// ═══════════════════════════════════════════════════════════
[Fact]
public async Task Zwei_Laeufe_nacheinander_erben_die_Kette_des_anderen_nicht()
public async Task Two_consecutive_runs_do_not_inherit_each_others_chain()
{
// Otherwise an agent could be permanently "used up" after a deep chain.
var tool = new DelegatingTool(new Dictionary<string, string> { ["agent-a"] = "agent-b" });
@@ -164,8 +164,8 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
await MitFrist(fixture.Engine.ChatAsync(a, "Erste Frage", "test-instance", default));
await MitFrist(fixture.Engine.ChatAsync(a, "Zweite Frage", "test-instance", default));
await WithDeadline(fixture.Engine.ChatAsync(a, "Erste Frage", "test-instance", default));
await WithDeadline(fixture.Engine.ChatAsync(a, "Zweite Frage", "test-instance", default));
tool.Handoffs.Count(h => h.To == "agent-b").ShouldBe(2);
tool.Handoffs.ShouldAllBe(h => h.Delivered);
@@ -176,7 +176,7 @@ public sealed class DelegationDepthTests
// ═══════════════════════════════════════════════════════════
[Fact]
public async Task Auch_ueber_spawn_laesst_sich_die_Kette_nicht_umgehen()
public async Task The_chain_cannot_be_bypassed_via_spawn_either()
{
var tool = new DelegatingTool(new Dictionary<string, string>
{
@@ -190,11 +190,11 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
await MitFrist(fixture.Engine.ChatAsync(a, "Bitte klären", "test-instance", default));
await WithDeadline(fixture.Engine.ChatAsync(a, "Bitte klären", "test-instance", default));
var rueckweg = tool.Handoffs.Single(h => h is { From: "agent-b", To: "agent-a" });
rueckweg.Delivered.ShouldBeFalse();
rueckweg.Error.ShouldNotBeNull().ShouldContain("Zyklus");
var wayBack = tool.Handoffs.Single(h => h is { From: "agent-b", To: "agent-a" });
wayBack.Delivered.ShouldBeFalse();
wayBack.Error.ShouldNotBeNull().ShouldContain("Zyklus");
}
// ═══════════════════════════════════════════════════════════
@@ -217,7 +217,7 @@ public sealed class DelegationDepthTests
/// would be green without showing anything.</para>
/// </summary>
[Fact]
public async Task Zwei_unabhaengige_Ketten_ueber_Kreuz_verklemmen_sich_nicht()
public async Task Two_independent_crossing_chains_do_not_deadlock()
{
var tool = new DelegatingTool(new Dictionary<string, string>
{
@@ -233,24 +233,24 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
var laufA = fixture.Engine.ChatAsync(a, "A fragt B", "test-instance", default);
var laufB = fixture.Engine.ChatAsync(b, "B fragt A", "test-instance", default);
var runA = fixture.Engine.ChatAsync(a, "A fragt B", "test-instance", default);
var runB = fixture.Engine.ChatAsync(b, "B fragt A", "test-instance", default);
var beide = Task.WhenAll(laufA, laufB);
var fertig = await Task.WhenAny(beide, Task.Delay(Frist));
var both = Task.WhenAll(runA, runB);
var done = await Task.WhenAny(both, Task.Delay(Deadline));
fertig.ShouldBe(beide, "Beide Laeufe warten auf das Gate des jeweils anderen (#461).");
done.ShouldBe(both, "Beide Laeufe warten auf das Gate des jeweils anderen (#461).");
// Both outer runs come to an end. At least one hand-off failed at the
// deadline — which one is decided by the order and is not
// fixed; that both runs come back is.
(await laufA).Status.ShouldBe(AgentRunStatus.Completed);
(await laufB).Status.ShouldBe(AgentRunStatus.Completed);
(await runA).Status.ShouldBe(AgentRunStatus.Completed);
(await runB).Status.ShouldBe(AgentRunStatus.Completed);
tool.Handoffs.ShouldContain(h => !h.Delivered && h.Error!.Contains("belegt"));
}
[Fact]
public async Task Ein_Chat_vom_Menschen_wartet_weiter_so_lange_es_dauert()
public async Task A_chat_from_a_human_keeps_waiting_as_long_as_it_takes()
{
// The counter-check to the deadline: it only applies to delegated runs. A second
// chat of the same agent queues up and is served, even if the first one
@@ -262,11 +262,11 @@ public sealed class DelegationDepthTests
fixture.Client.RespondsContextually();
var erster = fixture.Engine.ChatAsync(a, "Erste Frage", "test-instance", default);
var zweiter = fixture.Engine.ChatAsync(a, "Zweite Frage", "test-instance", default);
var firstOne = fixture.Engine.ChatAsync(a, "Erste Frage", "test-instance", default);
var secondOne = fixture.Engine.ChatAsync(a, "Zweite Frage", "test-instance", default);
(await MitFrist(erster)).Status.ShouldBe(AgentRunStatus.Completed);
(await MitFrist(zweiter)).Status.ShouldBe(AgentRunStatus.Completed);
(await WithDeadline(firstOne)).Status.ShouldBe(AgentRunStatus.Completed);
(await WithDeadline(secondOne)).Status.ShouldBe(AgentRunStatus.Completed);
}
// ═══════════════════════════════════════════════════════════
@@ -274,32 +274,32 @@ public sealed class DelegationDepthTests
// ═══════════════════════════════════════════════════════════
[Fact]
public void Die_Kette_zaehlt_Weitergaben_nicht_Agenten()
public void The_chain_counts_handoffs_not_agents()
{
var kette = DelegationChain.Root("a");
kette.Depth.ShouldBe(0);
kette.Append("b").Depth.ShouldBe(1);
kette.Append("b").Append("c").Depth.ShouldBe(2);
var chain = DelegationChain.Root("a");
chain.Depth.ShouldBe(0);
chain.Append("b").Depth.ShouldBe(1);
chain.Append("b").Append("c").Depth.ShouldBe(2);
}
[Fact]
public void Append_veraendert_die_Kette_des_Aufrufers_nicht()
public void Append_does_not_change_the_callers_chain()
{
// Immutable: two hand-offs from the same run must not see
// each other — otherwise the second would count the first as a predecessor.
var kette = DelegationChain.Root("a");
var chain = DelegationChain.Root("a");
var nachB = kette.Append("b");
var nachC = kette.Append("c");
var toB = chain.Append("b");
var toC = chain.Append("c");
kette.Agents.ShouldBe(["a"]);
nachB.Agents.ShouldBe(["a", "b"]);
nachC.Agents.ShouldBe(["a", "c"]);
nachB.Contains("c").ShouldBeFalse();
chain.Agents.ShouldBe(["a"]);
toB.Agents.ShouldBe(["a", "b"]);
toC.Agents.ShouldBe(["a", "c"]);
toB.Contains("c").ShouldBeFalse();
}
[Fact]
public void Die_Kette_liest_sich_als_Weg()
public void The_chain_reads_as_a_path()
{
DelegationChain.Root("a").Append("b").Append("c").ToString()
.ShouldBe("a -> b -> c");