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

@@ -3,6 +3,7 @@ using StellaOps.Cryptography;
using StellaOps.Orchestrator.Core.Domain;
using StellaOps.Orchestrator.Core.Hashing;
using StellaOps.TestKit;
namespace StellaOps.Orchestrator.Tests;
public class CanonicalJsonHasherTests
@@ -15,7 +16,8 @@ public class CanonicalJsonHasherTests
_hasher = new CanonicalJsonHasher(_cryptoHash);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void ProducesStableHash_WhenObjectPropertyOrderDiffers()
{
var first = new { b = 1, a = 2 };
@@ -27,7 +29,8 @@ public class CanonicalJsonHasherTests
Assert.Equal(firstHash, secondHash);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void CanonicalJson_SortsKeysAndPreservesArrays()
{
var value = new
@@ -42,7 +45,8 @@ public class CanonicalJsonHasherTests
Assert.Equal("{\"items\":[\"first\",\"second\"],\"meta\":{\"a\":2,\"z\":1}}", json);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void AuditEntry_UsesCanonicalHash()
{
var entry = AuditEntry.Create(

View File

@@ -4,6 +4,7 @@ using StellaOps.Cryptography;
using StellaOps.Orchestrator.Core;
using StellaOps.Orchestrator.Core.Hashing;
using StellaOps.TestKit;
namespace StellaOps.Orchestrator.Tests;
public class EventEnvelopeTests
@@ -17,14 +18,16 @@ public class EventEnvelopeTests
_hasher = new CanonicalJsonHasher(_cryptoHash);
_envelopeHasher = new EventEnvelopeHasher(_hasher);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void ComputeIdempotencyKey_IsDeterministicAndLowercase()
{
var key = EventEnvelope.ComputeIdempotencyKey("Job.Completed", "job_abc", 3);
Assert.Equal("orch-job.completed-job_abc-3", key);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void Create_PopulatesDefaultsAndSerializes()
{
var job = new EventJob(
@@ -64,7 +67,8 @@ public class EventEnvelopeTests
Assert.Equal(envelope.Actor.Subject, roundtrip.Actor.Subject);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void Hash_IsDeterministic()
{
var job = new EventJob(

View File

@@ -3,6 +3,7 @@ using StellaOps.Cryptography;
using StellaOps.Orchestrator.Core.Domain.Replay;
using StellaOps.Orchestrator.Core.Hashing;
using StellaOps.TestKit;
namespace StellaOps.Orchestrator.Tests;
public class ReplayInputsLockTests
@@ -15,7 +16,8 @@ public class ReplayInputsLockTests
_hasher = new CanonicalJsonHasher(_cryptoHash);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void ReplayInputsLock_ComputesStableHash()
{
var manifest = ReplayManifest.Create(
@@ -38,7 +40,8 @@ public class ReplayInputsLockTests
Assert.Equal(lock1.ComputeHash(_hasher), lock2.ComputeHash(_hasher));
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void ReplayInputsLock_TracksManifestHash()
{
var manifest = ReplayManifest.Create(

View File

@@ -3,6 +3,7 @@ using StellaOps.Cryptography;
using StellaOps.Orchestrator.Core.Domain.Replay;
using StellaOps.Orchestrator.Core.Hashing;
using StellaOps.TestKit;
namespace StellaOps.Orchestrator.Tests;
public class ReplayManifestTests
@@ -15,7 +16,8 @@ public class ReplayManifestTests
_hasher = new CanonicalJsonHasher(_cryptoHash);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void ComputeHash_IsStableWithCanonicalOrdering()
{
var inputs = new ReplayInputs(

View File

@@ -4,6 +4,8 @@ using StellaOps.Cryptography;
using StellaOps.Orchestrator.Core;
using StellaOps.Orchestrator.Core.Hashing;
using StellaOps.TestKit;
namespace StellaOps.Orchestrator.Tests;
public class SchemaSmokeTests
@@ -16,7 +18,8 @@ public class SchemaSmokeTests
_hasher = new CanonicalJsonHasher(_cryptoHash);
}
[Theory]
[Trait("Category", TestCategories.Unit)]
[Theory]
[InlineData("event-envelope.schema.json")]
[InlineData("audit-bundle.schema.json")]
[InlineData("replay-manifest.schema.json")]
@@ -33,7 +36,8 @@ public class SchemaSmokeTests
Assert.True(doc.RootElement.TryGetProperty("title", out _));
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void CanonicalHash_For_EventEnvelope_IsStable()
{
var envelope = EventEnvelope.Create(

View File

@@ -133,6 +133,7 @@
<ProjectReference Include="../../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>