Refactor code structure and optimize performance across multiple modules

This commit is contained in:
StellaOps Bot
2025-12-26 20:03:22 +02:00
parent c786faae84
commit f10d83c444
1385 changed files with 69732 additions and 10280 deletions

View File

@@ -6,11 +6,13 @@ using Microsoft.Extensions.Logging.Abstractions;
using StellaOps.Scanner.Surface.FS;
using StellaOps.TestKit;
namespace StellaOps.Scanner.Surface.FS.Tests;
public sealed class FileSurfaceCacheTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task GetOrCreateAsync_PersistsValue()
{
var root = Directory.CreateTempSubdirectory();

View File

@@ -41,7 +41,8 @@ public sealed class FileSurfaceManifestStoreTests : IAsyncDisposable
new TestCryptoHash());
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task PublishAsync_WritesManifestWithDeterministicDigest()
{
var doc = new SurfaceManifestDocument
@@ -86,7 +87,8 @@ public sealed class FileSurfaceManifestStoreTests : IAsyncDisposable
Assert.Equal(new[] { "a", "z" }, artifact.Metadata!.Keys);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task TryGetByUriAsync_ReturnsPublishedManifest()
{
var doc = new SurfaceManifestDocument
@@ -105,7 +107,8 @@ public sealed class FileSurfaceManifestStoreTests : IAsyncDisposable
Assert.Equal("scan-123", retrieved.ScanId);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task PublishAsync_NormalizesDeterminismMetadataAndAttestations()
{
var doc = new SurfaceManifestDocument
@@ -170,7 +173,8 @@ public sealed class FileSurfaceManifestStoreTests : IAsyncDisposable
Assert.Equal(result.Document.DeterminismMerkleRoot, result.DeterminismMerkleRoot);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task TryGetByDigestAsync_ReturnsManifestAcrossTenants()
{
var doc1 = new SurfaceManifestDocument
@@ -219,6 +223,7 @@ public sealed class FileSurfaceManifestStoreTests : IAsyncDisposable
public async ValueTask<byte[]> ComputeHashAsync(Stream stream, string? algorithmId = null, CancellationToken cancellationToken = default)
{
await using var buffer = new MemoryStream();
using StellaOps.TestKit;
await stream.CopyToAsync(buffer, cancellationToken).ConfigureAwait(false);
return SHA256.HashData(buffer.ToArray());
}

View File

@@ -5,11 +5,13 @@ using System.Threading.Tasks;
using StellaOps.Scanner.Surface.FS;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Scanner.Surface.FS.Tests;
public sealed class SurfaceManifestDeterminismVerifierTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task VerifyAsync_Succeeds_WhenRecipeAndFragmentsMatch()
{
// Arrange
@@ -104,7 +106,8 @@ public sealed class SurfaceManifestDeterminismVerifierTests
Assert.Equal(merkleRoot, result.MerkleRoot);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task VerifyAsync_Fails_WhenDssePayloadDoesNotMatch()
{
var fragmentContent = Encoding.UTF8.GetBytes("{\"layers\":1}");