Refactor SurfaceCacheValidator to simplify oldest entry calculation

Add global using for Xunit in test project

Enhance ImportValidatorTests with async validation and quarantine checks

Implement FileSystemQuarantineServiceTests for quarantine functionality

Add integration tests for ImportValidator to check monotonicity

Create BundleVersionTests to validate version parsing and comparison logic

Implement VersionMonotonicityCheckerTests for monotonicity checks and activation logic
This commit is contained in:
master
2025-12-16 10:44:00 +02:00
parent b1f40945b7
commit 4391f35d8a
107 changed files with 10844 additions and 287 deletions

View File

@@ -0,0 +1,69 @@
using System.Text.Json.Serialization;
namespace StellaOps.Scanner.WebService.Contracts;
/// <summary>
/// Call graph submission request (CallGraphV1 schema).
/// </summary>
public sealed record CallGraphV1Dto(
[property: JsonPropertyName("schema")] string Schema,
[property: JsonPropertyName("scanKey")] string ScanKey,
[property: JsonPropertyName("language")] string Language,
[property: JsonPropertyName("nodes")] IReadOnlyList<CallGraphNodeDto> Nodes,
[property: JsonPropertyName("edges")] IReadOnlyList<CallGraphEdgeDto> Edges,
[property: JsonPropertyName("artifacts")] IReadOnlyList<CallGraphArtifactDto>? Artifacts = null,
[property: JsonPropertyName("entrypoints")] IReadOnlyList<CallGraphEntrypointDto>? Entrypoints = null);
/// <summary>
/// Artifact in a call graph.
/// </summary>
public sealed record CallGraphArtifactDto(
[property: JsonPropertyName("artifactKey")] string ArtifactKey,
[property: JsonPropertyName("kind")] string? Kind = null,
[property: JsonPropertyName("sha256")] string? Sha256 = null);
/// <summary>
/// Node in a call graph.
/// </summary>
public sealed record CallGraphNodeDto(
[property: JsonPropertyName("nodeId")] string NodeId,
[property: JsonPropertyName("symbolKey")] string SymbolKey,
[property: JsonPropertyName("artifactKey")] string? ArtifactKey = null,
[property: JsonPropertyName("visibility")] string? Visibility = null,
[property: JsonPropertyName("isEntrypointCandidate")] bool IsEntrypointCandidate = false);
/// <summary>
/// Edge in a call graph.
/// </summary>
public sealed record CallGraphEdgeDto(
[property: JsonPropertyName("from")] string From,
[property: JsonPropertyName("to")] string To,
[property: JsonPropertyName("kind")] string Kind = "static",
[property: JsonPropertyName("reason")] string? Reason = null,
[property: JsonPropertyName("weight")] double Weight = 1.0);
/// <summary>
/// Entrypoint in a call graph.
/// </summary>
public sealed record CallGraphEntrypointDto(
[property: JsonPropertyName("nodeId")] string NodeId,
[property: JsonPropertyName("kind")] string Kind,
[property: JsonPropertyName("route")] string? Route = null,
[property: JsonPropertyName("framework")] string? Framework = null);
/// <summary>
/// Response when call graph is accepted.
/// </summary>
public sealed record CallGraphAcceptedResponseDto(
[property: JsonPropertyName("callgraphId")] string CallgraphId,
[property: JsonPropertyName("nodeCount")] int NodeCount,
[property: JsonPropertyName("edgeCount")] int EdgeCount,
[property: JsonPropertyName("digest")] string Digest);
/// <summary>
/// Existing call graph reference (for duplicate detection).
/// </summary>
public sealed record ExistingCallGraphDto(
[property: JsonPropertyName("id")] string Id,
[property: JsonPropertyName("digest")] string Digest,
[property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt);