Skip to content

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

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
build/package-validation
Aug 16, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
build/package-validation

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Stacked on #7 (both edit Directory.Build.props); retargets to main once that merges.

Why

The README has said "no breaking changes" for two majors running, and the migration sections for 3.0 and 4.0 enumerate the breaks by hand. Nothing checked either: a removed public member packed cleanly, and the claim rested on reading the diff. "Prefer a test to a convention."

What

  • EnablePackageValidation=true + PackageValidationBaselineVersion=6.2.0 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 and in the release gate. Intentional breaks: dotnet pack /p:ApiCompatGenerateSuppressionFile=true writes CompatibilitySuppressions.xml, one entry per break, which is exactly the list the changelog's migration notes should carry. The workflow is in the props comment.
  • PackagingConventionTests.PackageValidationBaseline_IsTheShippedVersionOrTheReleaseBeforeIt: the baseline has to be the shipped version (between releases, when Version is the last release) or the release directly before it (once Version is bumped) — never older. That lags by at most one release and forces the move at every bump, so the baseline can't fossilise at 6.2.0.

Verified

  • All four packages pack cleanly against 6.2.0 (main has no API change since the release).
  • verify-the-guard: making RangeSet<TRange,T>.Overlaps internal (compiles — internal callers are fine) fails the pack with CP0002: Member '…Overlaps(IRange<T>)' exists on [Baseline] … but not on ….
  • Convention test: passes with baseline = 6.2.0 (shipped) and 6.1.0 (previous); fails at 6.0.0 (two behind); with Version bumped to 6.3.0 passes at 6.2.0 and fails at 6.1.0; fails with validation disabled; conventions suite green.

Note: pack now needs network access to fetch the baseline package — CI has it; an offline local pack will fail at the validation step.

EFCore.ComplexIndexes would take the same two properties verbatim; I left it out of this pass since its API surface is far more stable — say the word and I'll mirror it.

🤖 Generated with Claude Code

@CaffeinatedCoder

Copy link
Copy Markdown
Owner Author

Dispatched run for this branch (base isn't main, so no PR-triggered CI): https://github.com/CaffeinatedCoder/CodoMetis.ValueRanges/actions/runs/31944863223 — green, including the Pack job, which is where package validation actually executes against the 6.2.0 baseline. After #7 merges, Update branch to get the checks here.

The README has said "no breaking changes" for two majors running, and the
migration sections for 3.0 and 4.0 enumerate the breaks by hand. Nothing
checked either: a removed public member packed cleanly, and the claim
rested on reading the diff.

EnablePackageValidation with PackageValidationBaselineVersion=6.2.0 makes
it mechanical. 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 with CP0001/CP0002 — in CI's Pack job 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: an API added in 6.3 and removed in 6.4 is invisible
to a 6.2 baseline. PackagingConventionTests requires it to be the shipped
version or the release directly before it (per CHANGELOG.md), 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.

Verified: all four packages pack cleanly against 6.2.0 (main has no API
change since the release); making RangeSet.Overlaps internal fails the pack
with CP0002 naming the member; 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.

Co-Authored-By: Claude Fable 5 <[email protected]>
@CaffeinatedCoder
CaffeinatedCoder force-pushed the build/package-validation branch from e1053a9 to da3ba1b Compare August 16, 2026 12:10
@CaffeinatedCoder
CaffeinatedCoder merged commit 06762c9 into main Aug 16, 2026
6 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the build/package-validation branch August 16, 2026 17:58
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