Fix build and code structure improvements. New but essential UI functionality. CI improvements. Documentation improvements. AI module improvements.

This commit is contained in:
StellaOps Bot
2025-12-26 21:54:17 +02:00
parent 335ff7da16
commit c2b9cd8d1f
3717 changed files with 264714 additions and 48202 deletions

View File

@@ -463,8 +463,8 @@ public sealed class MetricLabelAnalyzerTests
var test = """
using System;
using System.Collections.Generic;
using StellaOps.TestKit;
using StellaOps.TestKit;
namespace TestNamespace
{
public class GoldenSignalMetrics

View File

@@ -6,21 +6,17 @@
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" Version="1.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.XUnit" />
<!-- Note: Analyzer tests have xUnit v2/v3 compatibility issues - tests may fail -->
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StellaOps.Telemetry.Analyzers.csproj" />
<ProjectReference Include="../../../__Libraries/StellaOps.TestKit/StellaOps.TestKit.csproj" />
</ItemGroup>
</Project>
</Project>

View File

@@ -0,0 +1,11 @@
namespace StellaOps.Telemetry.Analyzers.Tests;
/// <summary>
/// Test category constants for organizing tests
/// </summary>
public static class TestCategories
{
public const string Unit = "Unit";
public const string Integration = "Integration";
public const string Acceptance = "Acceptance";
}

View File

@@ -12,8 +12,14 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.11.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.11.0" PrivateAssets="all" />
<!-- Exclude test project from this build -->
<Compile Remove="StellaOps.Telemetry.Analyzers.Tests\**\*" />
<None Remove="StellaOps.Telemetry.Analyzers.Tests\**\*" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" PrivateAssets="all" />
</ItemGroup>
<ItemGroup>

View File

@@ -4,6 +4,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using StellaOps.TestKit;
using Xunit;
namespace StellaOps.Telemetry.Core.Tests;
@@ -218,8 +219,7 @@ public sealed class AsyncResumeTestHarness
using (accessor.CreateScope(new TelemetryContext { TenantId = "await-test" }))
{
capturedBefore = accessor.Context?.TenantId;
using StellaOps.TestKit;
await Task.Delay(10).ConfigureAwait(false);
await Task.Delay(10);
capturedAfter = accessor.Context?.TenantId;
}

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using StellaOps.TestKit;
using Xunit;
namespace StellaOps.Telemetry.Core.Tests;
@@ -223,7 +224,6 @@ public sealed class CliTelemetryContextTests
using (CliTelemetryContext.Initialize(accessor, tenantId: "explicit-tenant"))
{
var context = accessor.Context;
using StellaOps.TestKit;
Assert.NotNull(context);
Assert.Equal("explicit-tenant", context.TenantId);
}

View File

@@ -1,8 +0,0 @@
<Project>
<PropertyGroup>
<!-- Override repo defaults to keep telemetry tests self-contained -->
<UseConcelierTestInfra>false</UseConcelierTestInfra>
<ConcelierTestingPath></ConcelierTestingPath>
<ConcelierSharedTestsPath></ConcelierSharedTestsPath>
</PropertyGroup>
</Project>

View File

@@ -1,27 +0,0 @@
<Project>
<!-- Prevent global plugin/test copy targets from firing for telemetry tests -->
<Target Name="DisablePluginCopyTargets" BeforeTargets="ConcelierCopyPluginArtifacts;AuthorityCopyPluginArtifacts;NotifyCopyPluginArtifacts;ScannerCopyBuildxPluginArtifacts;ScannerCopyOsAnalyzerPluginArtifacts;ScannerCopyLangAnalyzerPluginArtifacts">
<PropertyGroup>
<ConcelierPluginOutputRoot></ConcelierPluginOutputRoot>
<AuthorityPluginOutputRoot></AuthorityPluginOutputRoot>
<NotifyPluginOutputRoot></NotifyPluginOutputRoot>
<ScannerBuildxPluginOutputRoot></ScannerBuildxPluginOutputRoot>
<ScannerOsAnalyzerPluginOutputRoot></ScannerOsAnalyzerPluginOutputRoot>
<ScannerLangAnalyzerPluginOutputRoot></ScannerLangAnalyzerPluginOutputRoot>
<IsConcelierPlugin>false</IsConcelierPlugin>
<IsAuthorityPlugin>false</IsAuthorityPlugin>
<IsNotifyPlugin>false</IsNotifyPlugin>
<IsScannerBuildxPlugin>false</IsScannerBuildxPlugin>
<IsScannerOsAnalyzerPlugin>false</IsScannerOsAnalyzerPlugin>
<IsScannerLangAnalyzerPlugin>false</IsScannerLangAnalyzerPlugin>
</PropertyGroup>
<ItemGroup>
<ConcelierPluginArtifacts Remove="@(ConcelierPluginArtifacts)" />
<AuthorityPluginArtifacts Remove="@(AuthorityPluginArtifacts)" />
<NotifyPluginArtifacts Remove="@(NotifyPluginArtifacts)" />
<ScannerBuildxPluginArtifacts Remove="@(ScannerBuildxPluginArtifacts)" />
<ScannerOsAnalyzerPluginArtifacts Remove="@(ScannerOsAnalyzerPluginArtifacts)" />
<ScannerLangAnalyzerPluginArtifacts Remove="@(ScannerLangAnalyzerPluginArtifacts)" />
</ItemGroup>
</Target>
</Project>

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Metrics;
@@ -179,7 +179,6 @@ public sealed class GoldenSignalMetricsTests : IDisposable
};
using var metrics = new GoldenSignalMetrics(options);
using StellaOps.TestKit;
for (int i = 0; i < 10; i++)
{
metrics.IncrementRequests(1, GoldenSignalMetrics.Tag("unique_id", $"id-{i}"));

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
@@ -480,7 +480,6 @@ public sealed class IncidentModeServiceTests : IDisposable
using var service = CreateService(opt =>
{
opt.Enabled = false;
using StellaOps.TestKit;
});
var result = await service.ActivateFromConfigAsync();

View File

@@ -1,6 +1,7 @@
using System.Diagnostics.Metrics;
using Microsoft.Extensions.Options;
using StellaOps.Telemetry.Core;
using StellaOps.TestKit;
public class MetricLabelGuardTests
{
@@ -43,7 +44,6 @@ public class MetricLabelGuardTests
var guard = new MetricLabelGuard(options);
using var meter = new Meter("test");
using StellaOps.TestKit;
var histogram = meter.CreateHistogram<double>("request.duration");
histogram.RecordRequestDuration(guard, 42, "verylongroute", "GET", "200", "ok");

View File

@@ -1,4 +1,4 @@
using Xunit;
using Xunit;
using StellaOps.TestKit;
@@ -25,7 +25,6 @@ public sealed class ProofCoverageMetricsTests
{
using var metrics = new ProofCoverageMetrics();
using StellaOps.TestKit;
metrics.RecordScanCoverage(
tenantId: "tenant-1",
surfaceId: "surface-1",

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.IO;
using System.Text;
using Microsoft.Extensions.Logging;
@@ -253,7 +253,6 @@ public sealed class SealedModeFileExporterTests : IDisposable
using var exporter = CreateExporter(opt =>
{
opt.MaxBytes = 50;
using StellaOps.TestKit;
opt.MaxRotatedFiles = 2;
});
exporter.Initialize();

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
@@ -347,7 +347,6 @@ public sealed class SealedModeTelemetryServiceTests : IDisposable
public void RecordDriftEvent_DoesNotThrow()
{
using var service = CreateService(opt => opt.Enabled = true);
using StellaOps.TestKit;
var endpoint = new Uri("https://collector.example.com");
// Should not throw

View File

@@ -5,8 +5,11 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<!-- Opt out of Concelier test infra to avoid pulling large cross-module graph -->
<UseConcelierTestInfra>false</UseConcelierTestInfra>
<ConcelierTestingPath></ConcelierTestingPath>
<ConcelierSharedTestsPath></ConcelierSharedTestsPath>
</PropertyGroup>
<ItemGroup>
@@ -17,11 +20,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.0" />
<PackageReference Include="Moq" Version="4.20.70" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="Moq" />
<PackageReference Include="xunit.runner.visualstudio" >
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
@@ -31,7 +34,6 @@
</ItemGroup>
<ItemGroup>
<Using Include="Xunit" />
<Using Include="StellaOps.TestKit" />
</ItemGroup>
</Project>
</Project>

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using StellaOps.TestKit;
using Xunit;
namespace StellaOps.Telemetry.Core.Tests;
@@ -78,7 +79,6 @@ public sealed class TelemetryContextAccessorTests
using (accessor.CreateScope(scopeContext))
{
Assert.Same(scopeContext, accessor.Context);
using StellaOps.TestKit;
}
Assert.Null(accessor.Context);

View File

@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using Xunit;
@@ -80,7 +80,6 @@ public sealed class TelemetryContextTests
public void TraceId_ReturnsActivityTraceId_WhenActivityExists()
{
using var activity = new Activity("test-operation");
using StellaOps.TestKit;
activity.Start();
var context = new TelemetryContext();

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using StellaOps.AirGap.Policy;
@@ -49,7 +49,6 @@ public sealed class TelemetryExporterGuardTests
var provider = new CollectingLoggerProvider();
using var loggerFactory = LoggerFactory.Create(builder => builder.AddProvider(provider));
using StellaOps.TestKit;
var guard = new TelemetryExporterGuard(loggerFactory.CreateLogger<TelemetryExporterGuard>(), policy);
var descriptor = new TelemetryServiceDescriptor("PolicyEngine", "1.2.3");
var collectorOptions = new StellaOpsTelemetryOptions.CollectorOptions
@@ -92,7 +91,7 @@ using StellaOps.TestKit;
_entries = entries;
}
public IDisposable BeginScope<TState>(TState state) => NullScope.Instance;
public IDisposable BeginScope<TState>(TState state) where TState : notnull => NullScope.Instance;
public bool IsEnabled(LogLevel logLevel) => true;

View File

@@ -5,6 +5,7 @@ using System.Net;
using System.Net.Http;
using Microsoft.Extensions.Options;
using StellaOps.Telemetry.Core;
using StellaOps.TestKit;
public class TelemetryPropagationHandlerTests
{
@@ -46,7 +47,6 @@ public class TelemetryPropagationHandlerTests
using var activity = new Activity("test-trace").Start();
using StellaOps.TestKit;
var terminal = new RecordingHandler();
var handler = new TelemetryPropagationHandler(accessor, options)
{

View File

@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using StellaOps.Telemetry.Core;
using StellaOps.TestKit;
public class TelemetryPropagationMiddlewareTests
{
@@ -18,7 +19,6 @@ public class TelemetryPropagationMiddlewareTests
// Assert using HttpContext.Items (source of truth for propagation in tests)
var ctx = context.Items[typeof(TelemetryContext)] as TelemetryContext
?? context.Items["TelemetryContext"] as TelemetryContext;
using StellaOps.TestKit;
Assert.NotNull(ctx);
Assert.Equal("tenant-a", ctx!.TenantId);
Assert.Equal("service-x", ctx.Actor);

View File

@@ -1,5 +1,6 @@
using System.Diagnostics.Metrics;
using StellaOps.Telemetry.Core;
using StellaOps.TestKit;
namespace StellaOps.Telemetry.Core.Tests;
@@ -146,7 +147,6 @@ public sealed class TimeToFirstSignalMetricsTests : IDisposable
phase: TtfsPhase.Unknown))
{
throw new InvalidOperationException("boom");
using StellaOps.TestKit;
}
}));

View File

@@ -1,4 +1,4 @@
using System.Diagnostics.Metrics;
using System.Diagnostics.Metrics;
using Microsoft.Extensions.Logging;
using StellaOps.Telemetry.Core.Triage;
@@ -140,7 +140,6 @@ public sealed class TtfsIngestionServiceTests : IDisposable
public void IngestEvent_DecisionRecorded_RecordsDecisionMetricsAndClickBudgetViolation()
{
using var loggerFactory = LoggerFactory.Create(_ => { });
using StellaOps.TestKit;
var service = new TtfsIngestionService(loggerFactory.CreateLogger<TtfsIngestionService>());
service.IngestEvent(new TtfsEvent

View File

@@ -49,7 +49,9 @@ public sealed class RedactingLogProcessor : BaseProcessor<LogRecord>
try
{
// Redact state (structured log properties)
#pragma warning disable CS0618 // State is obsolete but needed for compatibility
if (data.State is IReadOnlyList<KeyValuePair<string, object?>> stateList)
#pragma warning restore CS0618
{
RedactStateList(stateList, tenantId);
}

View File

@@ -11,12 +11,12 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Grpc.AspNetCore" Version="2.70.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
<PackageReference Include="Grpc.AspNetCore" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" />
</ItemGroup>
<ItemGroup>

View File

@@ -13,7 +13,7 @@ public sealed class TelemetryContextAccessor : ITelemetryContextAccessor
public TelemetryContextAccessor()
{
// Ensure clean state per accessor instantiation (important for tests)
CurrentHolder.Value = null;
CurrentHolder.Value = null!;
}
/// <inheritdoc/>
@@ -22,7 +22,7 @@ public sealed class TelemetryContextAccessor : ITelemetryContextAccessor
get => CurrentHolder.Value?.Context;
set
{
CurrentHolder.Value = value is null ? null : new TelemetryContextHolder { Context = value };
CurrentHolder.Value = value is null ? null! : new TelemetryContextHolder { Context = value };
}
}
@@ -70,7 +70,7 @@ public sealed class TelemetryContextAccessor : ITelemetryContextAccessor
_accessor.Context = _previous;
if (_previous is null)
{
CurrentHolder.Value = null;
CurrentHolder.Value = null!;
}
}
}

View File

@@ -0,0 +1,102 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.Telemetry.Analyzers", "StellaOps.Telemetry.Analyzers", "{34C004CA-CEED-282F-91ED-B98195D08F7A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.Telemetry.Analyzers.Tests", "StellaOps.Telemetry.Analyzers.Tests", "{4D125E03-8C9F-580A-2610-D49CF8472F23}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.Telemetry.Core", "StellaOps.Telemetry.Core", "{A4AF7409-4779-34D6-CEBB-3F233FDCBAF7}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.Telemetry.Core", "StellaOps.Telemetry.Core", "{6DBB36A1-1F14-4B40-996E-215FB9C2CDD1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.Telemetry.Core.Tests", "StellaOps.Telemetry.Core.Tests", "{85FF29F6-CC5C-90C6-443C-A5D584B22F75}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "__External", "__External", "{5B52EF8A-3661-DCFF-797D-BC4D6AC60BDA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AirGap", "AirGap", "{F310596E-88BB-9E54-885E-21C61971917E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.AirGap.Policy", "StellaOps.AirGap.Policy", "{D9492ED1-A812-924B-65E4-F518592B49BB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.AirGap.Policy", "StellaOps.AirGap.Policy", "{3823DE1E-2ACE-C956-99E1-00DB786D9E1D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "__Libraries", "__Libraries", "{1345DD29-BB3A-FB5F-4B3D-E29F6045A27A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.Canonical.Json", "StellaOps.Canonical.Json", "{79E122F4-2325-3E92-438E-5825A307B594}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "StellaOps.TestKit", "StellaOps.TestKit", "{8380A20C-A5B8-EE91-1A58-270323688CB9}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellaOps.AirGap.Policy", "E:\dev\git.stella-ops.org\src\AirGap\StellaOps.AirGap.Policy\StellaOps.AirGap.Policy\StellaOps.AirGap.Policy.csproj", "{AD31623A-BC43-52C2-D906-AC1D8784A541}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellaOps.Canonical.Json", "E:\dev\git.stella-ops.org\src\__Libraries\StellaOps.Canonical.Json\StellaOps.Canonical.Json.csproj", "{AF9E7F02-25AD-3540-18D7-F6A4F8BA5A60}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellaOps.Telemetry.Analyzers", "StellaOps.Telemetry.Analyzers\StellaOps.Telemetry.Analyzers.csproj", "{1C00C081-9E6C-034C-6BF2-5BBC7A927489}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellaOps.Telemetry.Analyzers.Tests", "StellaOps.Telemetry.Analyzers\StellaOps.Telemetry.Analyzers.Tests\StellaOps.Telemetry.Analyzers.Tests.csproj", "{3267C3FE-F721-B951-34B9-D453A4D0B3DA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellaOps.Telemetry.Core", "StellaOps.Telemetry.Core\StellaOps.Telemetry.Core\StellaOps.Telemetry.Core.csproj", "{8CD19568-1638-B8F6-8447-82CFD4F17ADF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellaOps.Telemetry.Core.Tests", "StellaOps.Telemetry.Core\StellaOps.Telemetry.Core.Tests\StellaOps.Telemetry.Core.Tests.csproj", "{0A9739A6-1C96-5F82-9E43-81518427E719}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StellaOps.TestKit", "E:\dev\git.stella-ops.org\src\__Libraries\StellaOps.TestKit\StellaOps.TestKit.csproj", "{AF043113-CCE3-59C1-DF71-9804155F26A8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{AD31623A-BC43-52C2-D906-AC1D8784A541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AD31623A-BC43-52C2-D906-AC1D8784A541}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AD31623A-BC43-52C2-D906-AC1D8784A541}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AD31623A-BC43-52C2-D906-AC1D8784A541}.Release|Any CPU.Build.0 = Release|Any CPU
{AF9E7F02-25AD-3540-18D7-F6A4F8BA5A60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU