Skip to content

build: validate every pack against the last release for API breaks - #21

Merged
CaffeinatedCoder merged 3 commits into
mainfrom
build/package-validation
Aug 16, 2026
Merged

CaffeinatedCoder merged 3 commits into
mainfrom
build/package-validation

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

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.3 in Directory.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=true writes CompatibilitySuppressions.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, when Version is the last release) or the release directly before it (once Version is bumped) — never older. Lags by at most one release and forces the move at every bump.

Verified

  • All three packages pack cleanly against 5.0.3 (no src/ change since the release).
  • verify-the-guard: making ComplexIndexBuilder.HasFilter internal fails the pack with CP0002: Member '…HasFilter(string)' exists on [Baseline] … but not on …. (A first attempt on AnnotationValues.ValuesEqual packed cleanly — that class is internal, so it was never public surface. The check working, not a gap.)
  • Convention test: passes with baseline = 5.0.3 (shipped) and 5.0.2 (previous); fails at 5.0.1; with Version bumped to 5.0.4 passes at 5.0.3 and fails at 5.0.2; fails with validation disabled. ClaudeMdConsistencyTests passes.

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

CaffeinatedCoder and others added 3 commits August 16, 2026 13:48
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>
@CaffeinatedCoder
CaffeinatedCoder merged commit 9f04da7 into main Aug 16, 2026
8 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the build/package-validation branch August 16, 2026 13:26
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