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

@@ -3,6 +3,7 @@
// Task: T6 - Add Delta API endpoints
using System.ComponentModel.DataAnnotations;
using PolicyDeltaSummary = StellaOps.Policy.Deltas.DeltaSummary;
using StellaOps.Policy.Deltas;
namespace StellaOps.Policy.Gateway.Contracts;
@@ -95,7 +96,7 @@ public sealed record DeltaSummaryDto
public decimal RiskScore { get; init; }
public required string RiskDirection { get; init; }
public static DeltaSummaryDto FromModel(DeltaSummary summary) => new()
public static DeltaSummaryDto FromModel(PolicyDeltaSummary summary) => new()
{
TotalChanges = summary.TotalChanges,
RiskIncreasing = summary.RiskIncreasing,
@@ -275,7 +276,7 @@ public sealed record DeltaVerdictResponse
public string? Explanation { get; init; }
public required IReadOnlyList<string> Recommendations { get; init; }
public static DeltaVerdictResponse FromModel(DeltaVerdict verdict) => new()
public static DeltaVerdictResponse FromModel(StellaOps.Policy.Deltas.DeltaVerdict verdict) => new()
{
VerdictId = verdict.VerdictId,
DeltaId = verdict.DeltaId,

View File

@@ -268,7 +268,7 @@ public static class DeltasEndpoints
}
// Try to retrieve verdict from cache
if (!cache.TryGetValue(DeltaCachePrefix + deltaId + ":verdict", out DeltaVerdict? verdict) || verdict is null)
if (!cache.TryGetValue(DeltaCachePrefix + deltaId + ":verdict", out StellaOps.Policy.Deltas.DeltaVerdict? verdict) || verdict is null)
{
return Results.NotFound(new ProblemDetails
{

View File

@@ -30,8 +30,7 @@ public static class GatesEndpoints
public static IEndpointRouteBuilder MapGatesEndpoints(this IEndpointRouteBuilder endpoints)
{
var group = endpoints.MapGroup("/api/v1/gates")
.WithTags("Gates")
.WithOpenApi();
.WithTags("Gates");
group.MapGet("/{bomRef}", GetGateStatus)
.WithName("GetGateStatus")
@@ -177,7 +176,7 @@ public static class GatesEndpoints
requestedBy,
ct);
var response = new ExceptionResponse
var response = new GateExceptionResponse
{
Granted = result.Granted,
ExceptionRef = result.ExceptionRef,
@@ -705,7 +704,7 @@ public sealed record ExceptionRequest
/// <summary>
/// Exception response.
/// </summary>
public sealed record ExceptionResponse
public sealed record GateExceptionResponse
{
/// <summary>Whether exception was granted.</summary>
[JsonPropertyName("granted")]

View File

@@ -3,6 +3,7 @@
// Sprint: SPRINT_20260118_030_LIB_verdict_rekor_gate_api
// Task: TASK-030-006 - Gate Decision API Endpoint
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using StellaOps.Auth.Abstractions;
using StellaOps.Auth.ServerIntegration;
@@ -35,7 +36,7 @@ public static class ScoreGateEndpoints
IVerdictSigningService signingService,
IVerdictRekorAnchorService anchorService,
[FromServices] TimeProvider timeProvider,
ILogger<ScoreGateEndpoints> logger,
ILogger logger,
CancellationToken cancellationToken) =>
{
if (request is null)
@@ -148,8 +149,7 @@ public static class ScoreGateEndpoints
})
.RequireAuthorization(policy => policy.RequireStellaOpsScopes(StellaOpsScopes.PolicyRun))
.WithName("EvaluateScoreGate")
.WithDescription("Evaluate score-based CI/CD gate for a finding")
.WithOpenApi();
.WithDescription("Evaluate score-based CI/CD gate for a finding");
// GET /api/v1/gate/health - Health check for gate service
gates.MapGet("/health", ([FromServices] TimeProvider timeProvider) =>
@@ -166,7 +166,7 @@ public static class ScoreGateEndpoints
IVerdictSigningService signingService,
IVerdictRekorAnchorService anchorService,
[FromServices] TimeProvider timeProvider,
ILogger<ScoreGateEndpoints> logger,
ILogger logger,
CancellationToken cancellationToken) =>
{
if (request is null || request.Findings is null || request.Findings.Count == 0)
@@ -260,8 +260,7 @@ public static class ScoreGateEndpoints
})
.RequireAuthorization(policy => policy.RequireStellaOpsScopes(StellaOpsScopes.PolicyRun))
.WithName("EvaluateScoreGateBatch")
.WithDescription("Batch evaluate score-based CI/CD gates for multiple findings")
.WithOpenApi();
.WithDescription("Batch evaluate score-based CI/CD gates for multiple findings");
}
private static async Task<List<ScoreGateBatchDecision>> EvaluateBatchAsync(
@@ -532,7 +531,3 @@ public static class ScoreGateEndpoints
}
}
/// <summary>
/// Logging category for score gate endpoints.
/// </summary>
public sealed class ScoreGateEndpoints { }

View File

@@ -172,7 +172,7 @@ builder.Services.AddSingleton<StellaOps.DeltaVerdict.Bundles.IVerdictBundleBuild
StellaOps.DeltaVerdict.Bundles.VerdictBundleBuilder>();
builder.Services.AddSingleton<StellaOps.DeltaVerdict.Bundles.IVerdictSigningService,
StellaOps.DeltaVerdict.Bundles.VerdictSigningService>();
builder.Services.AddSingleton<StellaOps.DeltaVerdict.Bundles.IRekorSubmissionClient,
builder.Services.AddSingleton<StellaOps.DeltaVerdict.Signing.IRekorSubmissionClient,
StellaOps.DeltaVerdict.Bundles.StubVerdictRekorClient>();
builder.Services.AddSingleton<StellaOps.DeltaVerdict.Bundles.IVerdictRekorAnchorService,
StellaOps.DeltaVerdict.Bundles.VerdictRekorAnchorService>();

View File

@@ -12,6 +12,7 @@
<ItemGroup>
<ProjectReference Include="../../__Libraries/StellaOps.Configuration/StellaOps.Configuration.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.DependencyInjection/StellaOps.DependencyInjection.csproj" />
<ProjectReference Include="../../__Libraries/StellaOps.DeltaVerdict/StellaOps.DeltaVerdict.csproj" />
<ProjectReference Include="../../Authority/StellaOps.Authority/StellaOps.Auth.Abstractions/StellaOps.Auth.Abstractions.csproj" />
<ProjectReference Include="../../Authority/StellaOps.Authority/StellaOps.Auth.Client/StellaOps.Auth.Client.csproj" />
<ProjectReference Include="../../Authority/StellaOps.Authority/StellaOps.Auth.ServerIntegration/StellaOps.Auth.ServerIntegration.csproj" />
@@ -25,6 +26,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Http.Polly" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
<PackageReference Include="Polly.Extensions.Http" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" />
</ItemGroup>

View File

@@ -8,3 +8,4 @@ Source of truth: `docs-archived/implplan/2025-12-29-csproj-audit/SPRINT_20251229
| AUDIT-0445-M | DONE | Revalidated 2026-01-07; maintainability audit for StellaOps.Policy.Gateway. |
| AUDIT-0445-T | DONE | Revalidated 2026-01-07; test coverage audit for StellaOps.Policy.Gateway. |
| AUDIT-0445-A | TODO | Revalidated 2026-01-07 (open findings). |
| TASK-033-013 | DONE | Fixed ScoreGateEndpoints duplication, DeltaVerdict references, and Policy.Gateway builds (SPRINT_20260120_033). |