Skip to content

Comments

Add EventFilter + semantic logging test coverage#8046

Merged
Aaronontheweb merged 2 commits intoakkadotnet:devfrom
Aaronontheweb:feature/eventfilter-semantic-logging-tests
Feb 16, 2026
Merged

Add EventFilter + semantic logging test coverage#8046
Aaronontheweb merged 2 commits intoakkadotnet:devfrom
Aaronontheweb:feature/eventfilter-semantic-logging-tests

Conversation

@Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Feb 10, 2026

Summary

  • Adds 28 integration tests (EventFilterSemanticLoggingTests) verifying EventFilter correctly matches semantic log messages with named templates ({PropertyName} style)
  • Adds 32 unit tests (SemanticFormatterNullAndEdgeCaseSpecs) covering SemanticLogMessageFormatter edge cases: decimal trailing zeros, nullable types, null rendering, format specifiers, LogValues<T> boxing
  • Documents null rendering asymmetry in SemanticLogMessageFormatter XML docs: named templates render null as "null" (per Message Templates spec), positional templates render null as "" (via string.Format)

Key scenarios covered

  • Decimal precision mismatch: Converting from positional templates with :f format specifiers to named templates changes decimal formatting output (e.g., {4:f}"100.00" vs {Amount}"100.0" for 100.0m). Includes reproduction test with workarounds (contains:, format specifiers)
  • End-to-end Logger.Info() path: Tests go through the real ILoggingAdapterBusLoggingSemanticLogMessageFormatter chain, not just manually constructed LogMessage instances
  • Default formatter assertion: Verifies that the default HOCON config produces SemanticLogMessageFormatter as the system formatter

Test plan

  • dotnet test src/core/Akka.Tests/Akka.Tests.csproj -c Release --framework net8.0 --filter "FullyQualifiedName~SemanticFormatterNullAndEdgeCaseSpecs" — 32 passed
  • dotnet test src/core/Akka.TestKit.Tests/Akka.TestKit.Tests.csproj -c Release --framework net8.0 --filter "FullyQualifiedName~EventFilterSemanticLoggingTests" — 28 passed

Add comprehensive test coverage for EventFilter matching against
semantic log messages (named templates). Covers exact match, partial
matchers, null handling, decimal precision, type variety, and
end-to-end Logger.Info() scenarios through the real adapter path.

- EventFilterSemanticLoggingTests: 26 integration tests for EventFilter
  with SemanticLogMessageFormatter including customer-reported scenario
  where converting from positional to named templates changed output
- SemanticFormatterNullAndEdgeCaseSpecs: 32 unit tests for formatter
  edge cases (decimal trailing zeros, nullable types, null rendering,
  format specifiers, LogValues boxing)
- Document null rendering asymmetry in SemanticLogMessageFormatter
  XML docs (named: "null", positional: "" via string.Format)
Reproduces exact customer scenario where actor arithmetic produces
100.0m but test EventFilter uses 100m via string interpolation.
Demonstrates three workarounds: contains: partial match, matching
exact precision, and F2/F0 format specifiers in named templates.
@Aaronontheweb Aaronontheweb marked this pull request as ready for review February 16, 2026 18:59
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) February 16, 2026 18:59
@Aaronontheweb Aaronontheweb merged commit f978022 into akkadotnet:dev Feb 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant