tests fixes and sprints work

This commit is contained in:
master
2026-01-22 19:08:46 +02:00
parent c32fff8f86
commit 726d70dc7f
881 changed files with 134434 additions and 6228 deletions

View File

@@ -118,12 +118,18 @@ public sealed class FacetQuotaGate : IPolicyGate
private static FacetDriftReport? GetDriftReportFromContext(PolicyGateContext context)
{
// Drift report is expected to be in metadata under a well-known key
if (context.Metadata?.TryGetValue("FacetDriftReport", out var value) == true &&
value is string json)
if (context.Metadata?.TryGetValue("FacetDriftReport", out var json) == true &&
!string.IsNullOrWhiteSpace(json))
{
// In a real implementation, deserialize from JSON
// For now, return null to trigger the no-seal path
return null;
try
{
return System.Text.Json.JsonSerializer.Deserialize<FacetDriftReport>(json);
}
catch (System.Text.Json.JsonException)
{
// Malformed JSON - return null to trigger no-seal path
return null;
}
}
return null;

View File

@@ -109,16 +109,13 @@ public sealed class OpaGateAdapter : IPolicyGate
{
MergeResult = new
{
mergeResult.Findings,
mergeResult.TotalFindings,
mergeResult.CriticalCount,
mergeResult.HighCount,
mergeResult.MediumCount,
mergeResult.LowCount,
mergeResult.UnknownCount,
mergeResult.NewFindings,
mergeResult.RemovedFindings,
mergeResult.UnchangedFindings
mergeResult.Status,
mergeResult.Confidence,
mergeResult.HasConflicts,
mergeResult.RequiresReplayProof,
mergeResult.AllClaims,
mergeResult.WinningClaim,
mergeResult.Conflicts
},
Context = new
{

View File

@@ -173,7 +173,7 @@ public sealed record UnknownsGateOptions
/// <summary>
/// Default implementation of unknowns gate checker.
/// </summary>
public sealed class UnknownsGateChecker : IUnknownsGateChecker
public class UnknownsGateChecker : IUnknownsGateChecker
{
private readonly HttpClient _httpClient;
private readonly IMemoryCache _cache;
@@ -299,7 +299,7 @@ public sealed class UnknownsGateChecker : IUnknownsGateChecker
});
}
public async Task<IReadOnlyList<UnknownState>> GetUnknownsAsync(
public virtual async Task<IReadOnlyList<UnknownState>> GetUnknownsAsync(
string bomRef,
CancellationToken ct = default)
{