Skip to content

test(analyzers): add branch coverage tests for the analyzer package - #173

Merged
e128 merged 1 commit into
mainfrom
ai-sdlc-readier/setup
Nov 16, 2026
Merged

e128 merged 1 commit into
mainfrom
ai-sdlc-readier/setup

Conversation

@e128

@e128 e128 commented Nov 16, 2026

Copy link
Copy Markdown
Owner

Executive Summary

The AI SDLC Readier setup found the repository already compliant in every step but one. Branch coverage of the published E128.Analyzers package was 15557 of 21601 branches (72.0 percent). This change adds tests and raises it to 18836 of 21601 (87.2 percent). That is still below the 95 percent threshold and the 100 percent target. Reachable branches remain, mostly in code fix providers.

Measurement: Cobertura from all five test projects, merged with ReportGenerator, on macOS arm64 in Debug. The package surface is the sum of the E128.Analyzers and E128.Analyzers.CodeFixers assemblies. Whole-assembly coverage is an upper-bound proxy, not proof of coverage through the package entry points.

Code Changes

  • 177 new files tests/E128.Analyzers.Tests/*BranchCoverageTests.cs. Each file targets one analyzer, code fix provider, or helper. Each test asserts a reported diagnostic or a fix result.
  • lode/infrastructure/agent-worktree-builds.md: records the verified cause of phantom build errors in a nested worktree. The SDK loads the .globalconfig of every ancestor directory, so a worktree under .claude/worktrees/ loads two files at global_level = 100.
  • lode/dotnet/analyzers/testing.md: adds a Branch Coverage Tests section.

No production code, props, nuget.config, or pipeline file changed.

Tests and Tooling

  • scripts/check.sh --all: passed (shell lint, format, build with 0 warnings, tests).
  • Tests: 5206 total, 5204 passed, 0 failed, 2 skipped. The same 2 tests were skipped at baseline (3006 tests then).
  • Architecture tests: 14 of 14 passed. E128.Benchmarks builds in Release. No benchmark ran, and no benchmark export exists.
  • Not run: a Linux container coverage run.
  • Setup findings with no repository change: no deprecated or vulnerable package. 11 packages have no release in 730 days. 6 GitHub repositories are archived or inactive.

Review Guide

  • Six new files build the Roslyn test object directly instead of using AnalyzerTestRunner: FixedBufferFieldCodeFixProvider, SequentialRenameFixAllProvider, CaptiveDependency, ComplexityCeiling, RuntimeRegexToGenerated, and StackAllocSafety. lode/dotnet/analyzers/testing.md says no test does this, and about 54 existing tests do. Decide whether to enforce or relax the rule.
  • The writers left these production quirks untested instead of pinning them as expected behavior. Treat them as candidates, not confirmed defects:
    • ExecuteScalarNullGuardCodeFixProvider can throw after it rewrites an async scalar conversion.
    • EnumIfElseChainCodeFixProvider keeps a break that used to exit an enclosing loop.
    • StringFormatToInterpolation produces invalid code for a format string with doubled braces.
    • SubstringLengthUnderflowAnalyzer and SemaphoreSlimReleaseAnalyzer each report a false positive in one shape.
    • RecursiveDeleteRootAnalyzer misses dir?.Delete(true).
    • UnvalidatedJwtIdentityAnalyzer misses a lambda that builds a ClaimsIdentity from an authenticated outer identity.
  • One #pragma warning disable appears inside a test's source-under-test string. It adds no suppression to the repository.
  • WarningsNotAsErrors in Directory.Build.props includes NU1900. This predates the change.

Rollback

Revert the squash commit. Only test files and two Lode notes change, so no runtime behavior is affected.

🤖 Generated with Claude Code

Add 177 BranchCoverageTests files to E128.Analyzers.Tests. Branch coverage
of the E128.Analyzers package surface rises from 72.0 to 87.2 percent.
Document the nested worktree .globalconfig collision in the Lode and add a
Branch Coverage Tests section to the analyzer testing note.

Co-Authored-By: Claude
@e128
e128 merged commit 9701930 into main Nov 16, 2026
2 checks passed
@e128
e128 deleted the ai-sdlc-readier/setup branch November 16, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant