build: validate every pack against the last release for API breaks - #21
Merged
Merged
Conversation
A removed or changed public member packed cleanly; whether a release broke a consumer rested on reading the diff. This package's public surface is small and stable, which is exactly when a break slips through unnoticed. EnablePackageValidation with PackageValidationBaselineVersion=5.0.3 makes it mechanical: at pack time the SDK restores each package at the baseline from nuget.org and runs ApiCompat over the public surface, failing the pack with CP0001/CP0002 — in CI's Pack job, in the consumer smoke test's own pack, and in the release gate. For an intentional break, `/p:ApiCompatGenerateSuppressionFile=true` writes CompatibilitySuppressions.xml, each entry one breaking change that belongs in the changelog; the props comment records the workflow. The baseline must move: PackagingConventionTests requires it to be the shipped version or the release directly before it (per the README's "What changed" headings), never older — between releases Version is the last release, so the baseline equals it; once Version is bumped the baseline is the release being superseded; two behind fails. Same change as CodoMetis.ValueRanges #8. Verified: all three packages pack cleanly against 5.0.3 (no src change since the release); making ComplexIndexBuilder.HasFilter internal fails the pack with CP0002 naming the member (a first attempt on AnnotationValues.ValuesEqual packed cleanly — that class is internal, so it was never public surface, which is the check working); the convention test passes with the baseline at the shipped version and at the release before it, fails two behind, fails when Version is bumped without moving it, and fails with validation disabled. ClaudeMdConsistencyTests passes. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Same change as CodoMetis.ValueRanges#8. Independent of the other open PRs (touches
Directory.Build.props,PackagingConventionTests, CLAUDE.md only).Why
A removed or changed public member packed cleanly; whether a release broke a consumer rested on reading the diff. This package's public surface is small and stable — which is exactly when a break slips through unnoticed.
What
EnablePackageValidation=true+PackageValidationBaselineVersion=5.0.3inDirectory.Build.props. At pack time the SDK restores each package at the baseline from nuget.org and runs ApiCompat over the public surface; a removed or changed member fails the pack (CP0001/CP0002) — in CI's Pack job, in the consumer smoke test's own pack, and in the release gate. Intentional breaks:dotnet pack /p:ApiCompatGenerateSuppressionFile=truewritesCompatibilitySuppressions.xml, one entry per break — the list the changelog should carry. Workflow is in the props comment.PackagingConventionTests.Package_validation_baseline_is_the_shipped_version_or_the_release_before_it: the baseline must be the shipped version (between releases, whenVersionis the last release) or the release directly before it (onceVersionis bumped) — never older. Lags by at most one release and forces the move at every bump.Verified
src/change since the release).ComplexIndexBuilder.HasFilterinternalfails the pack withCP0002: Member '…HasFilter(string)' exists on [Baseline] … but not on …. (A first attempt onAnnotationValues.ValuesEqualpacked cleanly — that class isinternal, so it was never public surface. The check working, not a gap.)Versionbumped to 5.0.4 passes at 5.0.3 and fails at 5.0.2; fails with validation disabled.ClaudeMdConsistencyTestspasses.Note: pack now needs network access to fetch the baseline package — CI has it; an offline local pack fails at the validation step.
🤖 Generated with Claude Code