new advisories work and features gaps work

This commit is contained in:
master
2026-01-14 18:39:19 +02:00
parent 95d5898650
commit 15aeac8e8b
148 changed files with 16731 additions and 554 deletions

View File

@@ -22,8 +22,7 @@ public static class GreyQueueEndpoints
public static IEndpointRouteBuilder MapGreyQueueEndpoints(this IEndpointRouteBuilder routes)
{
var group = routes.MapGroup("/api/grey-queue")
.WithTags("GreyQueue")
.WithOpenApi();
.WithTags("GreyQueue");
// List and query
group.MapGet("/", ListEntries)

View File

@@ -23,8 +23,7 @@ public static class UnknownsEndpoints
public static IEndpointRouteBuilder MapUnknownsEndpoints(this IEndpointRouteBuilder routes)
{
var group = routes.MapGroup("/api/unknowns")
.WithTags("Unknowns")
.WithOpenApi();
.WithTags("Unknowns");
// WS-004: GET /api/unknowns - List with pagination
group.MapGet("/", ListUnknowns)
@@ -318,7 +317,7 @@ public static class UnknownsEndpoints
private static ProvenanceHintDto MapHintToDto(ProvenanceHint h) => new()
{
Id = h.Id,
Id = h.HintId,
Type = h.Type.ToString(),
Confidence = h.Confidence,
ConfidenceLevel = h.ConfidenceLevel.ToString(),
@@ -328,7 +327,7 @@ public static class UnknownsEndpoints
Action = a.Action,
Priority = a.Priority,
Description = a.Description,
Url = a.Url
Url = a.Link
}).ToList(),
GeneratedAt = h.GeneratedAt
};

View File

@@ -5,7 +5,6 @@
// Description: Entry point for Unknowns WebService with OpenAPI, health checks, auth
// -----------------------------------------------------------------------------
using Microsoft.OpenApi.Models;
using StellaOps.Unknowns.WebService;
using StellaOps.Unknowns.WebService.Endpoints;
@@ -16,15 +15,7 @@ builder.Services.AddUnknownsServices(builder.Configuration);
// OpenAPI / Swagger
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new OpenApiInfo
{
Title = "StellaOps Unknowns API",
Version = "v1",
Description = "API for managing unknown components with provenance hints"
});
});
builder.Services.AddSwaggerGen();
// Health checks
builder.Services.AddHealthChecks()

View File

@@ -7,8 +7,11 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.Extensions.Logging;
using Npgsql;
using StellaOps.Unknowns.Core.Repositories;
using StellaOps.Unknowns.Persistence;
using StellaOps.Unknowns.Persistence.Postgres.Repositories;
namespace StellaOps.Unknowns.WebService;
@@ -28,8 +31,14 @@ public static class ServiceCollectionExtensions
var connectionString = configuration.GetConnectionString("UnknownsDb")
?? throw new InvalidOperationException("UnknownsDb connection string is required");
var dataSourceBuilder = new NpgsqlDataSourceBuilder(connectionString);
var dataSource = dataSourceBuilder.Build();
services.AddSingleton(dataSource);
services.AddSingleton<IUnknownRepository>(sp =>
new PostgresUnknownRepository(connectionString, sp.GetRequiredService<TimeProvider>()));
new PostgresUnknownRepository(
sp.GetRequiredService<NpgsqlDataSource>(),
sp.GetRequiredService<ILogger<PostgresUnknownRepository>>()));
// Register TimeProvider
services.AddSingleton(TimeProvider.System);
@@ -57,7 +66,7 @@ public sealed class DatabaseHealthCheck : IHealthCheck
try
{
// Simple check - try to list with limit 1
await _repository.ListAsync(skip: 0, take: 1, asOf: null, cancellationToken);
await _repository.GetOpenUnknownsAsync(tenantId: "health-check", limit: 1, cancellationToken: cancellationToken);
return HealthCheckResult.Healthy("Database connection successful");
}
catch (Exception ex)