fuseraft validate catches many config mistakes but misses two categories:
A — Out-of-range fractional fields. Three config properties are ratios that must be in [0, 1], but no range check exists:
| Property |
Config type |
File |
ContextCapFraction |
ContextWindowConfig |
src/Core/Models/ContextWindowConfig.cs:73 |
TrustScore |
AgentConfig |
src/Core/Models/AgentConfig.cs:66 |
AntiThrashMinSavingsRatio |
CompactionConfig |
src/Core/Models/CompactionConfig.cs:109 |
A value like TrustScore: 1.5 or ContextCapFraction: -0.2 is silently accepted and produces undefined behavior at runtime.
B — ContextBudgetConfig.WarnAt ≥ CutoverAt. If both values are non-zero and WarnAt ≥ CutoverAt, compaction fires before the warning ever triggers, making the warning permanently unreachable. The validator should flag this.
Suggested fix: Add checks in ValidateConfigCommand (src/Cli/Commands/ValidateConfigCommand.cs) alongside the existing MaxRetries > 0 and MaxIterations > 0 checks:
// Per-agent checks
if (agent.TrustScore is < 0.0 or > 1.0)
issues.Add(("error", $"Agent '{agent.Name}': TrustScore must be 0.0–1.0 (got {agent.TrustScore})."));
if (agent.ContextWindow?.ContextCapFraction is < 0.0 or > 1.0)
issues.Add(("error", $"Agent '{agent.Name}': ContextCapFraction must be 0.0–1.0."));
// Compaction checks
if (config.Compaction?.AntiThrashMinSavingsRatio is < 0.0 or > 1.0)
issues.Add(("error", "Compaction.AntiThrashMinSavingsRatio must be 0.0–1.0."));
// ContextBudget cross-check
if (config.ContextBudget is { WarnAt: > 0, CutoverAt: > 0 } b && b.WarnAt >= b.CutoverAt)
issues.Add(("warning", $"ContextBudget.WarnAt ({b.WarnAt}) >= CutoverAt ({b.CutoverAt}): warning will never fire."));
Also add corresponding test cases to tests/FuseraftCli.Tests/ValidateConfigCommandTests.cs.
Files to touch:
src/Cli/Commands/ValidateConfigCommand.cs
tests/FuseraftCli.Tests/ValidateConfigCommandTests.cs
fuseraft validatecatches many config mistakes but misses two categories:A — Out-of-range fractional fields. Three config properties are ratios that must be in
[0, 1], but no range check exists:ContextCapFractionContextWindowConfigsrc/Core/Models/ContextWindowConfig.cs:73TrustScoreAgentConfigsrc/Core/Models/AgentConfig.cs:66AntiThrashMinSavingsRatioCompactionConfigsrc/Core/Models/CompactionConfig.cs:109A value like
TrustScore: 1.5orContextCapFraction: -0.2is silently accepted and produces undefined behavior at runtime.B —
ContextBudgetConfig.WarnAt≥CutoverAt. If both values are non-zero andWarnAt ≥ CutoverAt, compaction fires before the warning ever triggers, making the warning permanently unreachable. The validator should flag this.Suggested fix: Add checks in
ValidateConfigCommand(src/Cli/Commands/ValidateConfigCommand.cs) alongside the existingMaxRetries > 0andMaxIterations > 0checks:Also add corresponding test cases to
tests/FuseraftCli.Tests/ValidateConfigCommandTests.cs.Files to touch:
src/Cli/Commands/ValidateConfigCommand.cstests/FuseraftCli.Tests/ValidateConfigCommandTests.cs