Skip to content

Two legacy readers for one annotation read an object twice, and the migration drops what the model still declares #108

Closed

Description

@CaffeinatedCoder

Reproduced 2026-11-16 on main @ 1690320. The body below says "read against the code, not run". Run, with a second reader class for the annotation of the kernel tests' OldGuardReader (Old:Guard) and the diff from LegacyModels.InTheOldFormat to LegacyModels.Declared, which declares the same object:

  • the migration is DROP INDEX ux_animal;
  • the diff of the model against itself after it is empty.

A reader says its annotation only once it is made (Annotation is an instance member), so the check cannot sit in AddLegacyDeclarationReader: it is the planner's, where the readers are first asked for.


Found by the pre-preview sweep of main @ 948496a (GPT's read of the kernel); read against the code, not run.

What happens

AddLegacyDeclarationReader<TReader>() adds a reader once per class (TryAddEnumerable, SchemaKitServiceCollectionExtensions.cs:101). Two reader classes that name the same annotation are both kept. The planner asks every reader for the entity type's annotation (SchemaOperationPlanner.cs:349-362), so the object comes out of the source twice. The target declares it once: one copy pairs with it and the other is left, and what is left on the source side is dropped (:174).

The migration drops an object the model still declares, and the next diff is empty.

It takes two packages that both read one earlier format, or one package that registers two classes for it. Nothing does today: the only reader is ComplexIndexes5xExclusionReader.

Change

The planner, or the registration, refuses two readers for one annotation, naming both. One annotation has one reader, as one owner has one contributor.

Test

LegacyDeclarationReaderTests: a second reader class for the annotation of the first is refused, shown to fail without the check.

Activity

  1. added this to the 11.0.0 milestone on Nov 14, 2026
  2. added
    bug
    silent
    package/core
    severity/low
    area/migrations
    on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/migrationsbugpackage/coreseverity/lowsilent

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions