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

@@ -9,6 +9,7 @@ using StellaOps.Notifier.WebService.Contracts;
using StellaOps.Notify.Queue;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class AttestationEventEndpointTests : IClassFixture<NotifierApplicationFactory>
@@ -20,6 +21,7 @@ public sealed class AttestationEventEndpointTests : IClassFixture<NotifierApplic
_factory = factory;
}
[Trait("Category", TestCategories.Unit)]
[Fact(Skip = "Disabled under in-memory compatibility mode")]
public async Task Attestation_event_is_published_to_queue()
{

View File

@@ -1,13 +1,15 @@
using System.Text.Json;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class AttestationTemplateCoverageTests
{
private static readonly string RepoRoot = LocateRepoRoot();
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void Attestation_templates_cover_required_channels()
{
var directory = Path.Combine(RepoRoot, "offline", "notifier", "templates", "attestation");
@@ -42,7 +44,8 @@ public sealed class AttestationTemplateCoverageTests
}
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void Attestation_templates_include_schema_and_locale_metadata()
{
var directory = Path.Combine(RepoRoot, "offline", "notifier", "templates", "attestation");

View File

@@ -4,10 +4,12 @@ using StellaOps.Notifier.Tests.Support;
using StellaOps.Notifier.WebService.Setup;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class AttestationTemplateSeederTests
{
[Trait("Category", TestCategories.Unit)]
[Fact(Skip = "Offline seeding disabled in in-memory mode")]
public async Task SeedTemplates_and_routing_load_from_offline_bundle()
{

View File

@@ -1,11 +1,13 @@
using System.Text.Json;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class DeprecationTemplateTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void Deprecation_templates_cover_slack_and_email()
{
var directory = LocateOfflineDeprecationDir();
@@ -29,7 +31,8 @@ public sealed class DeprecationTemplateTests
Assert.Contains("email", channels);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void Deprecation_templates_require_core_metadata()
{
var directory = LocateOfflineDeprecationDir();

View File

@@ -10,11 +10,13 @@ using StellaOps.Notify.Models;
using StellaOps.AirGap.Policy;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class EventProcessorTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ProcessAsync_MatchesRule_StoresSingleDeliveryWithIdempotency()
{
var ruleRepository = new InMemoryRuleRepository();
@@ -99,7 +101,8 @@ public sealed class EventProcessorTests
// Assert.Equal(0, deliveriesSecond);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ProcessAsync_SealedModeSkipsBlockedChannel()
{
var ruleRepository = new InMemoryRuleRepository();
@@ -192,7 +195,8 @@ public sealed class EventProcessorTests
Assert.Equal("chn-email", record.Metadata["channel"]);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task ProcessAsync_SealedModeAllowsAllowlistedChannel()
{
var ruleRepository = new InMemoryRuleRepository();

View File

@@ -8,11 +8,13 @@ using StellaOps.Notifier.Worker.Options;
using StellaOps.Notifier.Worker.Processing;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public class HttpEgressSloSinkTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task PublishAsync_NoWebhook_DoesNothing()
{
var handler = new StubHandler();
@@ -23,7 +25,8 @@ public class HttpEgressSloSinkTests
Assert.Equal(0, handler.SendCount);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task PublishAsync_SendsWebhookWithPayload()
{
var handler = new StubHandler();

View File

@@ -5,6 +5,7 @@ using StellaOps.Notifier.Tests.Support;
using Xunit;
using Xunit.Sdk;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class OpenApiEndpointTests : IClassFixture<NotifierApplicationFactory>
@@ -19,7 +20,8 @@ public sealed class OpenApiEndpointTests : IClassFixture<NotifierApplicationFact
}
#if false // disabled until test host wiring stabilises
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task OpenApi_endpoint_serves_yaml_with_scope_header()
{
var response = await _client.GetAsync("/.well-known/openapi", TestContext.Current.CancellationToken);

View File

@@ -3,11 +3,13 @@ using StellaOps.Notifier.Tests.Support;
using StellaOps.Notifier.WebService.Setup;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class PackApprovalTemplateSeederTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task SeedAsync_loads_templates_from_docs()
{
var templateRepo = new InMemoryTemplateRepository();

View File

@@ -5,7 +5,8 @@ namespace StellaOps.Notifier.Tests;
public sealed class PackApprovalTemplateTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void PackApproval_templates_cover_slack_and_email()
{
var document = LoadPackApprovalDocument();
@@ -20,7 +21,8 @@ public sealed class PackApprovalTemplateTests
Assert.Contains("email", channels);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void PackApproval_redaction_allows_expected_fields()
{
var document = LoadPackApprovalDocument();
@@ -37,7 +39,8 @@ public sealed class PackApprovalTemplateTests
Assert.Contains("resumeToken", allowed);
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void PackApproval_routing_predicates_present()
{
var document = LoadPackApprovalDocument();
@@ -51,6 +54,7 @@ public sealed class PackApprovalTemplateTests
var path = LocatePackApprovalTemplatesPath();
var json = File.ReadAllText(path);
using var doc = JsonDocument.Parse(json);
using StellaOps.TestKit;
return doc.RootElement.Clone();
}

View File

@@ -8,6 +8,7 @@ using StellaOps.Notifier.WebService.Contracts;
using StellaOps.Notify.Queue;
using Xunit;
using StellaOps.TestKit;
#if false
namespace StellaOps.Notifier.Tests;
@@ -20,7 +21,8 @@ public sealed class RiskEventEndpointTests : IClassFixture<NotifierApplicationFa
_factory = factory;
}
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public async Task Risk_event_is_published_to_queue()
{
var recordingQueue = new RecordingNotifyEventQueue();

View File

@@ -4,10 +4,12 @@ using StellaOps.Notifier.Tests.Support;
using StellaOps.Notifier.WebService.Setup;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class RiskTemplateSeederTests
{
[Trait("Category", TestCategories.Unit)]
[Fact(Skip = "Offline seeding disabled in in-memory mode")]
public async Task SeedTemplates_and_routing_load_from_offline_bundle()
{

View File

@@ -3,11 +3,13 @@ using StellaOps.Notifier.Worker.Processing;
using StellaOps.Notify.Models;
using Xunit;
using StellaOps.TestKit;
namespace StellaOps.Notifier.Tests;
public sealed class RuleEvaluatorTests
{
[Fact]
[Trait("Category", TestCategories.Unit)]
[Fact]
public void Evaluate_MatchingPolicyViolation_ReturnsActions()
{
var rule = NotifyRule.Create(