release orchestration strengthening
This commit is contained in:
@@ -65,7 +65,7 @@ public static class DeterminizationConfigEndpoints
|
||||
private static async Task<IResult> GetEffectiveConfig(
|
||||
HttpContext context,
|
||||
IDeterminizationConfigStore configStore,
|
||||
ILogger<DeterminizationConfigEndpoints> logger,
|
||||
ILogger logger,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var tenantId = GetTenantId(context);
|
||||
@@ -86,7 +86,7 @@ public static class DeterminizationConfigEndpoints
|
||||
}
|
||||
|
||||
private static IResult GetDefaultConfig(
|
||||
ILogger<DeterminizationConfigEndpoints> logger)
|
||||
ILogger logger)
|
||||
{
|
||||
logger.LogDebug("Getting default determinization config");
|
||||
return Results.Ok(new DeterminizationOptions());
|
||||
@@ -95,7 +95,7 @@ public static class DeterminizationConfigEndpoints
|
||||
private static async Task<IResult> GetAuditHistory(
|
||||
HttpContext context,
|
||||
IDeterminizationConfigStore configStore,
|
||||
ILogger<DeterminizationConfigEndpoints> logger,
|
||||
ILogger logger,
|
||||
int limit = 50,
|
||||
CancellationToken ct = default)
|
||||
{
|
||||
@@ -122,7 +122,7 @@ public static class DeterminizationConfigEndpoints
|
||||
private static async Task<IResult> UpdateConfig(
|
||||
HttpContext context,
|
||||
IDeterminizationConfigStore configStore,
|
||||
ILogger<DeterminizationConfigEndpoints> logger,
|
||||
ILogger logger,
|
||||
UpdateConfigRequest request,
|
||||
CancellationToken ct)
|
||||
{
|
||||
@@ -171,7 +171,7 @@ public static class DeterminizationConfigEndpoints
|
||||
|
||||
private static IResult ValidateConfig(
|
||||
ValidateConfigRequest request,
|
||||
ILogger<DeterminizationConfigEndpoints> logger)
|
||||
ILogger logger)
|
||||
{
|
||||
logger.LogDebug("Validating determinization config");
|
||||
|
||||
@@ -203,48 +203,43 @@ public static class DeterminizationConfigEndpoints
|
||||
}
|
||||
|
||||
// Validate conflict policy
|
||||
if (config.Conflicts.EscalationSeverityThreshold < 0 || config.Conflicts.EscalationSeverityThreshold > 1)
|
||||
if (config.ConflictPolicy.EscalationSeverityThreshold < 0 || config.ConflictPolicy.EscalationSeverityThreshold > 1)
|
||||
{
|
||||
errors.Add("EscalationSeverityThreshold must be between 0 and 1");
|
||||
}
|
||||
|
||||
if (config.Conflicts.ConflictTtlHours < 1)
|
||||
if (config.ConflictPolicy.ConflictTtlHours < 1)
|
||||
{
|
||||
errors.Add("ConflictTtlHours must be at least 1");
|
||||
}
|
||||
|
||||
// Validate environment thresholds
|
||||
ValidateThresholds(config.Thresholds.Development, "Development", errors, warnings);
|
||||
ValidateThresholds(config.Thresholds.Staging, "Staging", errors, warnings);
|
||||
ValidateThresholds(config.Thresholds.Production, "Production", errors, warnings);
|
||||
ValidateThresholds(config.EnvironmentThresholds.Development, "Development", errors, warnings);
|
||||
ValidateThresholds(config.EnvironmentThresholds.Staging, "Staging", errors, warnings);
|
||||
ValidateThresholds(config.EnvironmentThresholds.Production, "Production", errors, warnings);
|
||||
|
||||
return (errors.Count == 0, errors, warnings);
|
||||
}
|
||||
|
||||
private static void ValidateThresholds(
|
||||
EnvironmentThreshold threshold,
|
||||
EnvironmentThresholdValues threshold,
|
||||
string envName,
|
||||
List<string> errors,
|
||||
List<string> warnings)
|
||||
{
|
||||
if (threshold.EpssThreshold < 0 || threshold.EpssThreshold > 1)
|
||||
if (threshold.MaxPassEntropy < 0 || threshold.MaxPassEntropy > 1)
|
||||
{
|
||||
errors.Add($"{envName}.EpssThreshold must be between 0 and 1");
|
||||
errors.Add($"{envName}.MaxPassEntropy must be between 0 and 1");
|
||||
}
|
||||
|
||||
if (threshold.UncertaintyFactor < 0 || threshold.UncertaintyFactor > 1)
|
||||
if (threshold.MinEvidenceCount < 0)
|
||||
{
|
||||
errors.Add($"{envName}.UncertaintyFactor must be between 0 and 1");
|
||||
errors.Add($"{envName}.MinEvidenceCount must be >= 0");
|
||||
}
|
||||
|
||||
if (threshold.MinScore < 0 || threshold.MinScore > 100)
|
||||
if (threshold.MaxPassEntropy > 0.8)
|
||||
{
|
||||
errors.Add($"{envName}.MinScore must be between 0 and 100");
|
||||
}
|
||||
|
||||
if (threshold.MaxScore < threshold.MinScore)
|
||||
{
|
||||
errors.Add($"{envName}.MaxScore must be >= MinScore");
|
||||
warnings.Add($"{envName}.MaxPassEntropy above 0.8 may reduce confidence controls");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,5 +307,4 @@ public sealed record AuditEntryDto
|
||||
public string? Summary { get; init; }
|
||||
}
|
||||
|
||||
/// <summary>Logger wrapper for DI.</summary>
|
||||
file class DeterminizationConfigEndpoints { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user