2.0 KiB
2.0 KiB
Roslyn Analyzer for Canonicalization Enforcement (STELLA0100)
Module
__Analyzers
Status
IMPLEMENTED
Description
Custom Roslyn static analyzer (diagnostic STELLA0100) that enforces canonicalization boundaries at compile time. Detects code paths that cross resolver boundaries without proper canonicalization, preventing non-deterministic serialization from leaking into deterministic evaluation pipelines. Includes ResolverBoundaryAttribute for marking boundary methods.
Implementation Details
- Canonicalization Boundary Analyzer:
src/__Analyzers/StellaOps.Determinism.Analyzers/CanonicalizationBoundaryAnalyzer.cs-- RoslynDiagnosticAnalyzerregistered for C# syntax; reports diagnosticSTELLA0100when code crosses canonicalization boundaries without proper serialization guards. Analyzes method invocations and property accesses to detect non-deterministic serialization patterns at resolver boundaries. - Analyzer Tests:
src/__Analyzers/StellaOps.Determinism.Analyzers.Tests/CanonicalizationBoundaryAnalyzerTests.cs-- unit tests verifying the analyzer correctly reports STELLA0100 diagnostics for boundary violations and does not produce false positives for correctly guarded code.
E2E Test Plan
- Add the
StellaOps.Determinism.Analyzerspackage to a test project and verify the STELLA0100 diagnostic is reported when a method crosses a canonicalization boundary without a serialization guard - Verify the analyzer produces no diagnostics for code that correctly uses canonical serializers (e.g.,
LedgerCanonicalJsonSerializer,Rfc8785JsonCanonicalizer) - Verify the analyzer integrates with
dotnet buildand causes a build warning (or error if configured via.editorconfig) for violations - Verify the analyzer does not report false positives on non-serialization code paths or methods not annotated with
ResolverBoundaryAttribute - Verify the analyzer works with partial classes and cross-file method calls within the same assembly