sprints work

This commit is contained in:
StellaOps Bot
2025-12-24 21:46:08 +02:00
parent 43e2af88f6
commit b9f71fc7e9
161 changed files with 29566 additions and 527 deletions

View File

@@ -124,6 +124,9 @@ public enum DeltaGateLevel
/// </summary>
public sealed class DeltaVerdictBuilder
{
private static readonly IVerdictIdGenerator DefaultIdGenerator = new VerdictIdGenerator();
private readonly IVerdictIdGenerator _idGenerator;
private DeltaVerdictStatus _status = DeltaVerdictStatus.Pass;
private DeltaGateLevel _gate = DeltaGateLevel.G1;
private int _riskPoints;
@@ -133,6 +136,22 @@ public sealed class DeltaVerdictBuilder
private readonly List<string> _recommendations = [];
private string? _explanation;
/// <summary>
/// Creates a new <see cref="DeltaVerdictBuilder"/> with the default ID generator.
/// </summary>
public DeltaVerdictBuilder() : this(DefaultIdGenerator)
{
}
/// <summary>
/// Creates a new <see cref="DeltaVerdictBuilder"/> with a custom ID generator.
/// </summary>
/// <param name="idGenerator">Custom verdict ID generator for testing or specialized scenarios.</param>
public DeltaVerdictBuilder(IVerdictIdGenerator idGenerator)
{
_idGenerator = idGenerator ?? throw new ArgumentNullException(nameof(idGenerator));
}
public DeltaVerdictBuilder WithStatus(DeltaVerdictStatus status)
{
_status = status;
@@ -206,17 +225,29 @@ public sealed class DeltaVerdictBuilder
_status = DeltaVerdictStatus.PassWithExceptions;
}
var blockingDrivers = _blockingDrivers.ToList();
var warningDrivers = _warningDrivers.ToList();
var appliedExceptions = _exceptions.ToList();
// Compute content-addressed VerdictId from inputs
var verdictId = _idGenerator.ComputeVerdictId(
deltaId,
blockingDrivers,
warningDrivers,
appliedExceptions,
_gate);
return new DeltaVerdict
{
VerdictId = $"dv:{Guid.NewGuid():N}",
VerdictId = verdictId,
DeltaId = deltaId,
EvaluatedAt = DateTimeOffset.UtcNow,
Status = _status,
RecommendedGate = _gate,
RiskPoints = _riskPoints,
BlockingDrivers = _blockingDrivers.ToList(),
WarningDrivers = _warningDrivers.ToList(),
AppliedExceptions = _exceptions.ToList(),
BlockingDrivers = blockingDrivers,
WarningDrivers = warningDrivers,
AppliedExceptions = appliedExceptions,
Explanation = _explanation ?? GenerateExplanation(),
Recommendations = _recommendations.ToList()
};