Files
ClawdDotNet/tests/ClawdDotNet.Core.Tests/Config/ConfigMigrationTests.cs
T
RichardandClaude Opus 5.5 837a634a22 Stufe 4c (#764): Kommentare in C#, WebUI-Skripten, CSS und HTML auf Englisch
Rund 2.600 Kommentarblöcke in 310 C#-Dateien übersetzt, Begründungen vollständig
erhalten: blockweise gleiche Anzahl wie vorher, kein Block unter 60 % seiner
Länge, der Code außerhalb der Kommentare per Tokenizer byte-identisch geprüft.
Zitate deutscher Oberflächentexte und Testdaten bleiben deutsch.

WebUI: Kommentare in JS/CSS/HTML übersetzt, JSDoc-@param an die in 4b
umbenannten Parameter angeglichen.

Dabei behoben:
- 4b hatte "tag" (HTML-Tag) als deutsches "Tag" gelesen und zu "dayValue"
  gemacht (makeElement, svg, Tagesübersicht) - zurück auf tag/day.
- Aufgaben "InProgress" bekamen die Plakettenart "laufend", für die es nie eine
  CSS-Klasse gab - jetzt "success" wie laufende Instanzen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:45:03 +02:00

69 lines
1.9 KiB
C#

using ClawdDotNet.Core.Config;
using Shouldly;
namespace ClawdDotNet.Core.Tests.Config;
/// <summary>
/// Old configurations contain "maxTokens" — a value that was meant as a context limit,
/// but counted cumulatively over all steps and aborted runs prematurely (bug B3).
/// The migration must not take over this value unchanged as the cost budget.
/// </summary>
public sealed class ConfigMigrationTests
{
private static InstanceConfig WithLegacyMaxTokens(int? legacy) => new()
{
OpenRouterApiKey = "sk-test",
Agents =
[
new AgentConfig
{
AgentId = "test",
LoopGuard = new LoopGuardConfig { LegacyMaxTokens = legacy }
}
]
};
[Fact]
public void Ein_altes_zu_knappes_maxTokens_wird_durch_den_neuen_Default_ersetzt()
{
var config = WithLegacyMaxTokens(80_000); // the old, problematic value
ConfigLoader.Migrate(config);
var guard = config.Agents[0].LoopGuard;
guard.MaxCumulativeTokens.ShouldBe(500_000);
guard.LegacyMaxTokens.ShouldBeNull();
}
[Fact]
public void Ein_bewusst_grosszuegiges_maxTokens_bleibt_erhalten()
{
var config = WithLegacyMaxTokens(2_000_000);
ConfigLoader.Migrate(config);
config.Agents[0].LoopGuard.MaxCumulativeTokens.ShouldBe(2_000_000);
}
[Fact]
public void Ohne_altes_Feld_bleibt_der_Default_unveraendert()
{
var config = WithLegacyMaxTokens(null);
ConfigLoader.Migrate(config);
config.Agents[0].LoopGuard.MaxCumulativeTokens.ShouldBe(500_000);
}
[Fact]
public void Migration_ist_mehrfach_anwendbar()
{
var config = WithLegacyMaxTokens(80_000);
ConfigLoader.Migrate(config);
ConfigLoader.Migrate(config);
config.Agents[0].LoopGuard.MaxCumulativeTokens.ShouldBe(500_000);
}
}