Files
ClaudeDo/tests/ClaudeDo.Data.Tests/ModelRegistryTests.cs
T
mika kuns d3b91b5214 feat(data): split list-handler prompt into triage/wait/merge roles
Adds HandlerTriageAlias/HandlerWaitAlias/HandlerMergeAlias to ModelRegistry and
replaces PromptKind.MergeHelperExecute with MergeHelperWait (phase 3 only) and
MergeHelperMerge (phases 4-5), so the list handler can run as three
cost-scoped sessions instead of two. Triage's Phase 2 now checks/sets a wide
verify command via get_list_config/set_list_config once per run. Merge now
merges before reruns, delegates diff review to a sonnet subagent, rejects
0-file diffs, tracks the merged-but-not-Done verify-gate outcome, and caps
reruns at one per task via handoff_list_handler's new nextPhase parameter.

InteractiveLaunchSpecService.cs still references the removed
PromptKind.MergeHelperExecute and fails to build -- wiring the Worker/UI side
onto the new roles is a follow-up task.
2026-08-11 08:52:28 +02:00

71 lines
2.3 KiB
C#

using ClaudeDo.Data.Models;
namespace ClaudeDo.Data.Tests;
public class ModelRegistryTests
{
[Theory]
[InlineData("sonnet", "sonnet")]
[InlineData("OPUS", "opus")]
[InlineData(" haiku ", "haiku")]
public void NormalizeAlias_canonicalizes_known_aliases(string input, string expected)
{
Assert.Equal(expected, ModelRegistry.NormalizeAlias(input));
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
public void NormalizeAlias_blank_means_inherit(string? input)
{
Assert.Null(ModelRegistry.NormalizeAlias(input));
}
[Fact]
public void NormalizeAlias_unknown_throws()
{
Assert.Throws<ArgumentException>(() => ModelRegistry.NormalizeAlias("gpt4"));
}
[Fact]
public void ByCostAscending_is_haiku_sonnet_opus_fable()
{
Assert.Equal(new[] { "haiku", "sonnet", "opus", "fable" }, ModelRegistry.ByCostAscending);
}
[Theory]
[InlineData("sonnet", "sonnet")]
[InlineData("OPUS", "opus")]
[InlineData(" haiku ", "haiku")]
[InlineData("claude-sonnet-4-6", "sonnet")]
[InlineData("claude-opus-4-6", "opus")]
[InlineData("claude-haiku-4-5-20251001", "haiku")]
[InlineData("us.anthropic.claude-sonnet-4-6-v1:0", "sonnet")]
public void TryNormalizeAlias_matches_aliases_and_full_model_ids(string input, string expected)
{
Assert.Equal(expected, ModelRegistry.TryNormalizeAlias(input));
}
[Theory]
[InlineData(null)]
[InlineData("")]
[InlineData(" ")]
[InlineData("gpt-4")]
[InlineData("some-future-model")]
public void TryNormalizeAlias_never_throws_and_returns_null_when_unrecognized(string? input)
{
Assert.Null(ModelRegistry.TryNormalizeAlias(input));
}
[Fact]
public void List_handler_role_aliases_are_valid_and_split_cost_by_role()
{
// Triage and Merge get the wide-context, expensive role; Wait just queues and blocks,
// so it stays on the cheaper model.
Assert.Equal("opus", ModelRegistry.NormalizeAlias(ModelRegistry.HandlerTriageAlias));
Assert.Equal("sonnet", ModelRegistry.NormalizeAlias(ModelRegistry.HandlerWaitAlias));
Assert.Equal("opus", ModelRegistry.NormalizeAlias(ModelRegistry.HandlerMergeAlias));
}
}