Skip to content

feat: a declaration needs its contributor's registration, and a package the kernel of its own version - #142

Merged
CaffeinatedCoder merged 2 commits into
mainfrom
feat/provider-capability-stamp
Nov 14, 2026
Merged

CaffeinatedCoder merged 2 commits into
mainfrom
feat/provider-capability-stamp

Conversation

@CaffeinatedCoder

@CaffeinatedCoder CaffeinatedCoder commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Closes #113
Closes #141

Problem

Two wrong wirings were refused late, by a message that did not say what to do:

  • UseNpgsql(cs).UseSchemaKit() is the kernel's method. It stamps the model and registers no contributor, so DeclarePostgres passed and the first diff was refused with "no contributor with that owner is registered", naming a package the consumer already references.
  • A direct reference to CodoMetis.EFCore.SchemaKit at another version than the PostgreSQL package's breaks the package's exact pin. NuGet answers with the warning NU1608 and builds; the pair failed at run time with a MissingMethodException at whichever member differed first.

Point 4 of the issue (the consumer's model told by reference) is #98, merged. Point 2 (the name of the kernel's UseSchemaKit()) was a decision about the public surface (#141): the maintainer decided on 2026-11-14 that the name stays, and the second commit records it in the plan and the guide.

Change

  • A capability beside the stamp. AddSchemaContributor also adds a SchemaContributorRegistration (owner and type), a plain value, since no contributor may be resolved while a model is built. SchemaKitWiringConvention stamps the model and puts the registered owners into a ConditionalWeakTable keyed by the model. Declare and Redeclare require the declaration's owner there and name the declaration's assembly as the package to register. It is not an annotation: that would be written into the snapshot and change with the packages a context registers.
  • It is the kernel's rule, for every provider and every contributor package, not PostgreSQL's.
  • SchemaKitPackages.RequireKernel(Assembly), part of the contract (SK9001): compares the informational versions without the commit. The PostgreSQL package calls it first in UseSchemaKit() and AddEntityFrameworkSchemaKitNpgsql(), from a method that calls nothing else of the kernel; the rest moved into a NoInlining method, since the runtime binds a method's calls when it compiles the method.
  • A snapshot that holds a declaration without a contributor is still refused by the planner at diff.
  • A contributor put into the collection without AddSchemaContributor can no longer be declared for; the method's documentation says so.
  • The guide's table of missed steps, the changelog, the plan's section 3.12 and CLAUDE.md say what is now true.

Tests

  • A_declaration_whose_contributor_the_options_do_not_register_is_refused_where_it_is_written on Npgsql, SQL Server and SQLite, and Only_the_owners_the_options_register_may_be_declared with its allowed twin; The_kernels_call_alone_is_refused_where_a_PostgreSQL_object_is_declared in the PostgreSQL suite. A_declaration_with_no_contributor_is_refused_on_either_side now diffs another context's model, which is what a snapshot is.
  • PackageVersionTests: the same version with and without a commit passes, another is refused with both names and versions, the assembly version alone does not pass.
  • Consumer smoke test: the two kernel rows expect the new refusal, and a new consumer Mixed/ references a kernel packed as <version>.mixed beside the package. The row requires NU1608 in the build's log, so that it tests a pair NuGet really lets through.
  • Shown failing: with the owner check off, the five tests above fail and the smoke test stops at "the kernel's UseSchemaKit() alone: migrations add". With RequireKernel taken out of the package's UseSchemaKit(), the mixed consumer prints REGISTERED and the smoke test stops at that row. SMOKE_BREAK=kernel-only still fails the run.
  • Locally on PostgreSQL 18.4: kernel 658/658, PostgreSQL package 238/238 with the integration tests, the smoke test green in 48 s.

🤖 Generated with Claude Code

…ge the kernel of its own version

The kernel's UseSchemaKit() stamps a model and renders nothing. With
UseNpgsql(cs).UseSchemaKit(), DeclarePostgres passed on that stamp and the
refusal came at the first diff. Declare and Redeclare now ask for a
contributor of the declaration's owner as well, and name the package whose
registration is missing. The owners are kept beside the model, not as an
annotation, which would land in the snapshot.

The PostgreSQL package asks SchemaKitPackages.RequireKernel first in both
registrations. A direct reference to another kernel builds with NU1608; the
pair is now refused with both versions, where it failed with a
MissingMethodException at the first member that differed.

The consumer smoke test has a consumer that mixes the two versions. The name
of the kernel's own UseSchemaKit() is #141.

Closes #113

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 14, 2026
@CaffeinatedCoder CaffeinatedCoder added enhancement New feature or request package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 14, 2026
Decided by the maintainer on 2026-11-14. The plan's section 7 records it,
and the guide no longer says the name is open.

Closes #141

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@CaffeinatedCoder
CaffeinatedCoder merged commit 0126b3a into main Nov 14, 2026
11 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the feat/provider-capability-stamp branch November 14, 2026 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring enhancement New feature or request package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) package/postgresql Affects CodoMetis.EFCore.SchemaKit.PostgreSQL

Projects

None yet

1 participant