Skip to content

build: add PublicApiAnalyzers baseline for both src packages (#96)#166

Merged
Chris-Wolfgang merged 1 commit into
mainfrom
feature/publicapi-analyzers-96
Jun 23, 2026
Merged

build: add PublicApiAnalyzers baseline for both src packages (#96)#166
Chris-Wolfgang merged 1 commit into
mainfrom
feature/publicapi-analyzers-96

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Summary

Populates the PublicAPI.Shipped.txt / PublicAPI.Unshipped.txt baselines for the two shippable src/ packages so the PublicApiAnalyzers (RS0016 / RS0017 / RS0025) now guard the public API surface against unintended breaking changes — the goal of #96.

The analyzer infrastructure was already present on main: Directory.Build.props references Microsoft.CodeAnalysis.PublicApiAnalyzers 3.3.4 and globs the two .txt files as AdditionalFiles (opt-in per project via Exists()). What was missing was the actual baseline files in the two library projects. This supersedes the reverted A1 attempt (commits 7d2fe3a / 9e42df7, reverted in 38470e4 during v0.8.1 release prep).

What changed

  • src/Wolfgang.Etl.TestKit/PublicAPI.Shipped.txt (full current public surface) + PublicAPI.Unshipped.txt (#nullable enable only).
  • src/Wolfgang.Etl.TestKit.Xunit/PublicAPI.Shipped.txt (full current public surface) + PublicAPI.Unshipped.txt (#nullable enable only).
  • Both .csproj files: <WarningsAsErrors>$(WarningsAsErrors);RS0016;RS0017;RS0025</WarningsAsErrors>.

Why the csproj WarningsAsErrors

In this repo's current analyzer configuration RS0016 ("symbol not in declared API") was not being raised, so a baseline alone would silently fail to catch additions to the surface (only RS0017 removals fired). Promoting the three tracking diagnostics to errors — scoped to the two opted-in src projects only, no protected-file edits — makes the baseline genuinely enforce both additions and removals. Verified by a negative test: deleting a single baseline entry now fails the build with RS0016.

Stale baseline corrected

The recoverable (reverted) baseline was generated without RS0016 active, so it omitted the recently-added contract-test methods (ExtractAsync_/TransformAsync_CurrentItemCount_tracks_each_yielded_item_Async, LoadAsync_/TransformAsync_stops_reading_source_at_MaximumItemCount_Async) and the implicit public constructors of all 16 contract base classes. Those entries were added so the baseline matches the real surface.

Public surface across TFMs

A single shared baseline builds clean against all 5 TFMs (net462;net481;netstandard2.0;net8.0;net10.0) for both projects — the public surface does not differ per TFM.

Build / test results

  • dotnet build -c Release (all TFMs), both src projects: 0 warnings / 0 errors.
  • dotnet test -c Release -f net8.0:
    • Wolfgang.Etl.TestKit.Tests.Unit: 58 passed
    • Wolfgang.Etl.TestKit.Xunit.Tests.Unit: 199 passed

Closes #96

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

[Maintenance] API: Add PublicApiAnalyzers for breaking-change detection

1 participant