Repository navigation
test: no package here replaces EF Core's model differ or migrations SQL generator - #337
Merged
Merged
Conversation
…QL generator EF Core resolves IMigrationsModelDiffer and IMigrationsSqlGenerator as single services, so two packages replacing one silently lose the other's DDL. From 11.0.0 on CodoMetis.EFCore.SchemaKit owns both. MigrationServiceOwnershipConventionTests fails on a shipping EF type implementing either and on any code reference to them under src/ (ReplaceService, TryAdd, ServiceDescriptor, a base list), with floors on the assemblies and registrations it finds. AGENTS.md carries the rule. Closes #334 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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 #334
Problem
EF Core resolves
IMigrationsModelDifferandIMigrationsSqlGeneratoras single services. When two packages replace one, the last registration wins and the other's migration DDL disappears without an error. From 11.0.0 on,CodoMetis.EFCore.SchemaKitowns both in the CodoMetis family. The EF packages here touch neither today, but nothing kept it that way.Change
test/CodoMetis.ValueRanges.Conventions.Tests/MigrationServiceOwnershipConventionTests.cs, two tests over every packable project undersrc/(discovered, so a new EF satellite is covered with no edit):Microsoft.EntityFrameworkCore.Relationalimplements either service (EF's and Npgsql's base generators implement the interfaces, so deriving from them counts too). Floor: at least two EF assemblies found.EngineDispatchConventionTests): no code reference toIMigrationsModelDiffer,MigrationsModelDiffer,IMigrationsSqlGenerator,MigrationsSqlGeneratororNpgsqlMigrationsSqlGeneratorundersrc/(outsideobj//bin/). That catchesReplaceService<…>,TryAdd<…>,ServiceDescriptorovertypeof(…), base lists and using aliases; string literals naming them are flagged too. Comments and XML docs are trivia and are not read. Floor: the scan must see at least oneTryAdd/ReplaceServicecall, so it is reading the files that register services.AGENTS.md: a Critical Rules entry. A migration-aware feature goes into SchemaKit or plugs into its contract, never into a replacement of those two services here.Not added to
test/oracles/: this is a convention over the source, likeEngineDispatchConventionTests, not a sweep against an independent answer. Seeds must name a registered oracle.Tests
Seeded in a scratch copy of the tree (
verify-the-guard):coreOptionsBuilder.ReplaceService<IMigrationsSqlGenerator, ValueRangesMigrationsSqlGenerator>()inUseValueRanges, plus that class deriving fromNpgsqlMigrationsSqlGenerator: both tests fail, naming the type (… ValueRangesMigrationsSqlGenerator implements IMigrationsSqlGenerator) and both source lines.services.Replace(ServiceDescriptor.Scoped(typeof(IMigrationsModelDiffer), …))in the NodaTime EF satellite, with a comment naming both services: the source test fails on that line only. The comment is not flagged.TryAdd<renamed away: the floor fails (Scanned 128 source files under src/ and found 0 TryAdd/ReplaceService calls).On the unchanged tree, the full conventions project passes (406/406, .NET 11 RC2 SDK).
🤖 Generated with Claude Code