Skip to content

feat: a 5.x annotation that nothing reads is refused, not passed over - #95

Merged
CaffeinatedCoder merged 1 commit into
mainfrom
feat/unread-5x-annotations
Nov 12, 2026
Merged

CaffeinatedCoder merged 1 commit into
mainfrom
feat/unread-5x-annotations

Conversation

@CaffeinatedCoder

Copy link
Copy Markdown
Owner

Closes #93

Problem

The planner reads SchemaKit's own annotations and, since #92, a 5.x annotation that has a registered reader. Everything else EFCore.ComplexIndexes 5.x stored in a snapshot was passed over: its indexes, its temporal constraints, and its exclusion constraints on a context without the PostgreSQL package. A project that moved got a first migration that looked right. Declared again, an object 5.x built was created a second time; removed from the model, it was never dropped. Neither was an error.

Change

  • LegacyFormats (kernel, internal) lists the annotations of 5.x that declare an object: CustomIndex:CompositeIndexes, CustomTemporal:Constraints, CustomTemporal:ForeignKeys and CustomExclusion:Constraints on an entity type, and CustomIndex:IsIndexed on a property of a complex type, at any depth.
  • The planner asks it for every entity type of the source side, before anything else and whether or not the target declares anything. An annotation that holds a declaration and has no registered reader is refused, naming the entity type, the annotation and what to do: the issue that will read it, or for exclusion constraints the call that registers the reader.
  • A reader leaves the guard by being registered, so the index reader (PgIndex: typed indexes with expression and JSON-member keys and typed filters #27) and the temporal handover (Spike C: a 5.x snapshot hands over with zero operations #18) need no edit here for the entity-level annotations. The property-level marker has no reader seam yet; PgIndex: typed indexes with expression and JSON-member keys and typed filters #27 brings it.
  • Not refused: an empty annotation or an empty list, which 5.x read as no declaration; a marker that is false; the two model-level annotations, which declare nothing.
  • A second fixture from the published 5.6.0, ScaffoldedOtherKinds: an index on a property of a complex type, an index on the entity type, a temporal constraint. generate.sh now scaffolds both contexts, and a second run leaves the first fixture byte for byte as it was.

Tests

Locally: 489 kernel tests, 108 PostgreSQL tests offline, 38 on PostgreSQL 18.6.

Guards shown to fail. Ten defects seeded one at a time: the planner not asking, each list entry removed, the property marker not looked for, complex properties not walked, an empty annotation counted, a false marker counted, a registered reader not exempting its annotation. Each failed its test.

Decisions in this PR that are not confirmed

  • It applies to a context that declares nothing. A consumer who only swapped the packages is stopped at the first migrations add. That is the point, but it means preview.1 cannot be tried at all on a project with 5.x indexes or temporal constraints.
  • Only the source side. The same annotations kept by hand in the model a migration leads to are not looked at, unless a reader is registered (PgExclusion: the 5.x reader, and a 5.x snapshot with exclusion constraints hands over with no operations #92 refuses those).
  • CustomTemporal:ForeignKeys is listed although no published 5.x writes it: it is in 5.x's source.
  • The message names an issue, not a version, since no version that reads them is decided.

🤖 Generated with Claude Code

The source side of a diff refuses an entity type that carries a declaration
of EFCore.ComplexIndexes 5.x with no registered reader: its indexes, its
temporal constraints, and its exclusion constraints on a context without the
PostgreSQL package. Passed over, those objects were created a second time or
never dropped, without an error.

A second fixture scaffolded by the published 5.6.0 says where 5.x puts each
of them.

Closes #93

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@CaffeinatedCoder CaffeinatedCoder added this to the 11.0.0 milestone Nov 12, 2026
@CaffeinatedCoder CaffeinatedCoder added enhancement New feature or request silent Answers wrongly without throwing; the fix ships as a minor, never a patch package/core Affects CodoMetis.EFCore.SchemaKit (the kernel) area/migrations The differ and generator decorators, snapshot format, EnsureCreated and the UseSchemaKit wiring labels Nov 12, 2026
@CaffeinatedCoder
CaffeinatedCoder merged commit f19cb84 into main Nov 12, 2026
7 checks passed
@CaffeinatedCoder
CaffeinatedCoder deleted the feat/unread-5x-annotations branch November 12, 2026 15:46
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) silent Answers wrongly without throwing; the fix ships as a minor, never a patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A 5.x annotation that no reader reads is passed over in silence

1 participant