Add enums_in_transition support for gradual enum migration#1093
Draft
ashkan25 wants to merge 3 commits intoblock:mainfrom
Draft
Add enums_in_transition support for gradual enum migration#1093ashkan25 wants to merge 3 commits intoblock:mainfrom
ashkan25 wants to merge 3 commits intoblock:mainfrom
Conversation
When EG subgraphs use type_name_overrides to collapse input enum names (e.g. PaymentStatusInput -> PaymentStatus), the standard 3-stage enum migration becomes impossible. This adds an `enums_in_transition` configuration that enables a transition period: - Generates a transition InputEnum type alongside the collapsed output enum - Adds an `equalToAnyOfInput` filter field that accepts the input enum - Processes `equalToAnyOfInput` identically to `equalToAnyOf` at runtime Key mechanisms: - `skip_name_override` on EnumType bypasses type_name_overrides for transition input enum creation - `type_already_final` on Field bypasses to_final_form for filter field type resolution - Shared lambda in FilterNodeInterpreter for both operators Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
- Fix routing/index optimization gap: RoutingPicker, IndexExpressionBuilder, and Filters now handle :equal_to_any_of_input the same as :equal_to_any_of, ensuring shard routing and rollover index pruning work for the new operator - Add missing RBS type signature for equal_to_any_of_input - Add validation warning when enums_in_transition contains names that don't match any defined enum type (with DidYouMean suggestions) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Collaborator
myronmarston
left a comment
There was a problem hiding this comment.
Can you write up a proposal for this as a discussion? I'd like to the context for the problem you're trying to solve, the options you considered, why you chose this option, etc.
In general, we ask that anything with interesting design choices and tradeoffs start as a proposal.
… up test names - Forward **kwargs in Apollo and Warehouse factory extensions so skip_name_override reaches the base Factory#new_enum_type method - Add missing RBS type signatures for enums_in_transition, skip_name_override, type_already_final, and notify_about_unrecognized_enums_in_transition - Replace lambda-in-string test names with plain strings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
When
type_name_overridesis used to collapse input enum names onto output enum names (e.g.,"ColorInput" => "Color"), the standard 3-stage enum value migration becomes impossible — removing the override simultaneously renames all filter field types, breaking all clients at once with no transition period.This PR adds an
enums_in_transitionconfiguration option that enables gradual migration:*Inputenum type alongside the collapsed output enumequalToAnyOfInputfilter field that accepts the new input enum typeequalToAnyOfInputidentically toequalToAnyOfat runtime (same EStermsquery, same null handling, same shard routing optimization)enums_in_transitionnames match defined enum types, withDidYouMeansuggestionsMigration workflow this enables
enums_in_transition— schema gainsColorInputenum andequalToAnyOfInputfilter fieldequalToAnyOf: [Color]toequalToAnyOfInput: [ColorInput]at their own pacetype_name_overridesentry —equalToAnyOfnow naturally uses[ColorInput]equalToAnyOf(or keep usingequalToAnyOfInputas a permanent alias)enums_in_transitionKey mechanisms
skip_name_overrideonEnumTypeconstructor — bypassestype_name_overridesfor transition input enum creationtype_already_finalonField— bypassesto_final_formfor filter field type resolutionFilterNodeInterpreterfor bothequalToAnyOfandequalToAnyOfInputRoutingPicker,IndexExpressionBuilder, andFiltersall handle the new operator for shard routing and index pruning**kwargssoskip_name_overridereaches the base methodTest plan
elasticgraph-schema_definitionunit tests pass (1620 examples)elasticgraph-graphqlunit tests pass (1336 examples)elasticgraph-schema_artifactsunit tests pass (105 examples)type_name_overridesactiveequalToAnyOfInputfilter field on both standard and list element filter typesenums_in_transition