Repository navigation
Pin the satellites to their own core version and refuse a mixed pair (#169) - #174
Merged
Merged
Conversation
The satellites bind to the core's internals through InternalsVisibleTo, but a ProjectReference packs as ">=", so any later core satisfied them. A consumer who updated only a direct core reference ran a 5.4.1 satellite against core 5.5.0 with no warning, and the 5.4.1 differ, which predates IsSatelliteDiffer, was refused as the core differ while the consumer called the satellite's registration. - src/Directory.Build.targets pins every ProjectReference dependency to [$(Version)] (PinProjectReferenceDependencies), failing the pack when NuGet's item no longer holds one entry per ProjectReference. - The core differ refuses a satellite assembly built as another version than itself at the start of GetDifferences, naming both versions. A direct core reference still overrides the pin with NU1608, and the published 5.4.x satellites declare ">=", so the pin alone does not reach them. - PackagingConventionTests packs each satellite and reads the dependency; the smoke test checks the feed it is given; SatelliteVersionTests compiles stand-in satellites of another version with Roslyn. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #169
Problem
A consumer who references
EFCore.ComplexIndexes.PostgreSQL5.4.1 andEFCore.ComplexIndexesdirectly, and merges only the Dependabot PR for core, gets satellite 5.4.1 with core 5.5.0. Restore says nothing, because the 5.4.1 satellite declaresEFCore.ComplexIndexes >= 5.4.1. The 5.4.1 differ predatesIsSatelliteDiffer, so #150's check takes it for the core differ:GenerateCreateScript()andmigrations addfail with "the model is diffed by the provider-agnostic core differ … call UseNpgsqlComplexIndexes()", which the consumer already calls.The 5.5.0 satellites would have shipped the same
>= 5.5.0while binding to core internals throughInternalsVisibleTo, so any later core would be accepted on a line that takes fixes until 2028.Decision: the dependency range
Exact,
[5.5.0](written as[$(Version)], so every later version pins itself).Version, patch releases onrelease/5.xincluded: a package with nothing in a version is still published, with "No change in this package." So an exact pin never refuses a pair that was released.[5.5.0, 5.6.0)would accept core 5.5.1 under satellite 5.5.0. That is the case to keep out: a patch can change the internals a satellite binds to, and nobody builds or tests that pair. It buys nothing in return, because 5.5.1 of the satellite exists whenever 5.5.1 of the core does.What the pin does, measured with packed packages in a consumer outside the repository (private
NUGET_PACKAGES, local feeds plus nuget.org):GenerateCreateScript(), exclusion constraint,UseNpgsqlComplexIndexes())EXCLUDE>=)So the pin is not enough by itself. A direct reference beats a transitive pin with a warning, and the published 5.4.x satellites can't be changed.
Decision: the 5.4.1 combination at runtime
Refuse a mixed pair with a message that names both versions. Don't take the issue's suggestion of deciding "satellite differ" by type, which would let the 5.4.1 satellite run against 5.5.0 internals:
CustomMigrationsModelDiffer.ThrowIfSatelliteVersionDiffersruns first inGetDifferences.HasDifferences,EnsureCreated(),Migrate()'s pending-changes check andmigrations addall route throughGetDifferences. The check walks the differ's type hierarchy to the first type in one of the satellite assemblies listed inSatellites, and compares its informational version (without+commit) with the core's. Assemblies that aren't satellites are left alone, and so is an application's subclass of a satellite differ, which is checked by the satellite's version. The message:That is the real output from the packed consumer with satellite 5.4.1 from nuget.org. The same consumer at 5.4.1 + 5.4.1 still renders
EXCLUDE.Change
src/Directory.Build.targets:PinProjectReferenceDependencies(beforeGenerateNuspec) rewrites NuGet's_ProjectReferencesWithVersionsto[%(ProjectVersion)]. NuGet has no ProjectReference metadata for a range. The target fails the pack when that item doesn't hold one entry perProjectReference, which is how a rename on NuGet's side would show; otherwise the dependency would quietly go back to>=.CustomMigrationsModelDiffer:ThrowIfSatelliteVersionDiffers, called at the start ofGetDifferences.test/consumer-smoke-test.sh: checks that each satellite in the feed depends onEFCore.ComplexIndexes [version], so the artifacts the pack and release jobs ship are held too.Packaging:line under### Changed. It goes in core's changelog too, because the refusal is core code and the consumer who updates core alone reads core's release notes.CLAUDE.md: thePackagingConventionTestsrow and a paragraph beside the release-notes target.MigrationHarness.CreateDiffer(Type, DbContext), whichBuilderApiParityTestsnow calls instead of reflecting over the generic overload.Not labelled
breaking: the only pair that newly fails is a mixed one, which was never supported. A 5.4.1-satellite consumer with a satellite declaration failed before as well, with the wrong advice.Tests
PackagingConventionTests.Satellites_pin_the_core_to_their_own_versionpacks each satellite (--no-build) and reads[5.5.0]from the nuspec. Seeded: with[%(ProjectVersion)]reverted to%(ProjectVersion), it fails (5.5.0vs[5.5.0]). With the NuGet item name broken, the pack fails: "Cannot pin the dependencies of EFCore.ComplexIndexes.PostgreSQL … expected one versioned entry per ProjectReference (1), found 0."SatelliteVersionTestscompiles stand-in differs with Roslyn: one in an assembly namedEFCore.ComplexIndexes.PostgreSQLat 5.4.1, the same at 5.5.0, aContoso.Migrationssubclass of the core differ, and one of the real Npgsql differ. Seeded: with theThrowIfSatelliteVersionDifferscall removed, the 5.4.1 test fails with exactly the issue's message ("… diffed by the provider-agnostic core differ … call UseNpgsqlComplexIndexes() …").5.5.0.dotnet ef migrations addwasn't run against the mixed pair; it reaches the sameGetDifferences.TestCategory!=Integration). Integration lanes are left to CI.🤖 Generated with Claude Code