Repository navigation
fix: two legacy readers for one annotation are refused - #148
Merged
Merged
Conversation
AddLegacyDeclarationReader keeps one registration per class, so two classes that read the same annotation were both asked. Each read the object out of the snapshot; one copy paired with the model's declaration, and the other was dropped by the migration while the model still declared it. The diff after that was empty. The planner now refuses the pair where it first asks for the readers, naming the annotation and both classes. It is the planner's and not the registration's, since a reader says its annotation only once it is made. Closes #108 Co-Authored-By: Claude Fable 5.2 <[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 #108
Problem
AddLegacyDeclarationReader<TReader>()keeps one registration per class, so two classes that read the same annotation are both kept, and the planner asks every reader. Each reads the object out of the snapshot. One copy pairs with the model's declaration; the other is left over where the diff starts.Run on
main(the issue had it from reading): with a second reader class for the annotation of the kernel tests'OldGuardReader, the diff from the snapshot in the old format to the model that declares the same object isand the diff after it is empty. The migration drops an object the model still declares, and nothing reports it afterwards.
Nothing registers two readers for one annotation today. It takes two packages that both take over from one earlier package, or one package with two classes.
Change
SchemaOperationPlanner: where the readers are first asked for, two with one annotation are refused, naming the annotation and both classes (SchemaKitStrings.TwoReadersForOneAnnotation). It is refused whatever the models hold, as two contributors for one owner are.AddLegacyDeclarationReader's:Annotationis an instance member, so a reader says it only once it is made.CLAUDE.md: the rule, beside the reader's.Tests
LegacyDeclarationReaderTests.Two_readers_of_one_annotation_are_refused: the pair above, refused with both class names in the message.Two_readers_of_one_annotation_are_refused_where_no_model_holds_it: the same registration with models that carry no annotation.mainwrites theDROP).CustomExclusion:Constraints, so nothing of it changes.🤖 Generated with Claude Code