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 b4fc66feb6
3353 changed files with 88254 additions and 1590657 deletions

View File

@@ -2,9 +2,11 @@ using System.Text.Json;
using StellaOps.Replay.Core;
using Xunit;
using StellaOps.TestKit;
public class ReplayManifestTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void SerializesWithNamespacesAndAnalysis_V1()
{
var manifest = new ReplayManifest
@@ -48,7 +50,8 @@ public class ReplayManifestTests
Assert.Contains("\"namespace\":\"runtime_traces\"", json);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void SerializesWithV2HashFields()
{
var manifest = new ReplayManifest

View File

@@ -5,6 +5,7 @@ using System.Threading.Tasks;
using StellaOps.Replay.Core;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Replay.Core.Tests;
/// <summary>
@@ -19,7 +20,8 @@ public class ReplayManifestV2Tests
#region Section 4.1: Minimal Valid Manifest v2
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void MinimalValidManifestV2_SerializesCorrectly()
{
var manifest = new ReplayManifest
@@ -67,7 +69,8 @@ public class ReplayManifestV2Tests
#region Section 4.2: Manifest with Runtime Traces
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void ManifestWithRuntimeTraces_SerializesCorrectly()
{
var manifest = new ReplayManifest
@@ -116,7 +119,8 @@ public class ReplayManifestV2Tests
#region Section 4.3: Sorting Validation
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void SortingValidation_UnsortedGraphs_FailsValidation()
{
var manifest = new ReplayManifest
@@ -151,7 +155,8 @@ public class ReplayManifestV2Tests
Assert.Contains(result.Errors, e => e.ErrorCode == ReplayManifestErrorCodes.UnsortedEntries);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void SortingValidation_SortedGraphs_PassesValidation()
{
var manifest = new ReplayManifest
@@ -189,7 +194,8 @@ public class ReplayManifestV2Tests
#region Section 4.4: Invalid Manifest Vectors
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void InvalidManifest_MissingSchemaVersion_FailsValidation()
{
var manifest = new ReplayManifest
@@ -204,7 +210,8 @@ public class ReplayManifestV2Tests
Assert.Contains(result.Errors, e => e.ErrorCode == ReplayManifestErrorCodes.MissingVersion);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void InvalidManifest_VersionMismatch_WhenV2Required_FailsValidation()
{
var manifest = new ReplayManifest
@@ -219,7 +226,8 @@ public class ReplayManifestV2Tests
Assert.Contains(result.Errors, e => e.ErrorCode == ReplayManifestErrorCodes.VersionMismatch);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void InvalidManifest_MissingHashAlg_InV2_FailsValidation()
{
var manifest = new ReplayManifest
@@ -246,7 +254,8 @@ public class ReplayManifestV2Tests
Assert.Contains(result.Errors, e => e.ErrorCode == ReplayManifestErrorCodes.MissingHashAlg);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task InvalidManifest_MissingCasReference_FailsValidation()
{
var casValidator = new InMemoryCasValidator();
@@ -276,7 +285,8 @@ public class ReplayManifestV2Tests
Assert.Contains(result.Errors, e => e.ErrorCode == ReplayManifestErrorCodes.CasNotFound);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task InvalidManifest_HashMismatch_FailsValidation()
{
var casValidator = new InMemoryCasValidator();
@@ -315,7 +325,8 @@ public class ReplayManifestV2Tests
#region Section 5: Migration Path
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void UpgradeToV2_ConvertsV1ManifestCorrectly()
{
var v1 = new ReplayManifest
@@ -347,7 +358,8 @@ public class ReplayManifestV2Tests
Assert.Equal("sha256", v2.Reachability.Graphs[0].HashAlgorithm);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void UpgradeToV2_SortsGraphsByUri()
{
var v1 = new ReplayManifest
@@ -373,7 +385,8 @@ public class ReplayManifestV2Tests
#region ReachabilityReplayWriter Tests
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BuildManifestV2_WithValidGraphs_CreatesSortedManifest()
{
var scan = new ReplayScanMetadata { Id = "test-scan" };
@@ -401,7 +414,8 @@ public class ReplayManifestV2Tests
Assert.Equal("cas://graphs/zzzz", manifest.Reachability.Graphs[1].CasUri);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BuildManifestV2_WithLegacySha256_MigratesHashField()
{
var scan = new ReplayScanMetadata { Id = "test-scan" };
@@ -423,7 +437,8 @@ public class ReplayManifestV2Tests
Assert.Equal("sha256", manifest.Reachability.Graphs[0].HashAlgorithm);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BuildManifestV2_InfersHashAlgorithmFromPrefix()
{
var scan = new ReplayScanMetadata { Id = "test-scan" };
@@ -444,7 +459,8 @@ public class ReplayManifestV2Tests
Assert.Equal("blake3-256", manifest.Reachability.Graphs[0].HashAlgorithm);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void BuildManifestV2_RequiresAtLeastOneGraph()
{
var scan = new ReplayScanMetadata { Id = "test-scan" };
@@ -460,7 +476,8 @@ public class ReplayManifestV2Tests
#region CodeIdCoverage Tests
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void CodeIdCoverage_SerializesWithSnakeCaseKeys()
{
var coverage = new CodeIdCoverage

View File

@@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../StellaOps.Replay.Core/StellaOps.Replay.Core.csproj" />
<ProjectReference Include="../StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />