Fix extractors being deleted when an input is started or stopped#26198
Merged
Conversation
The PersistedImpl -> AutoValue migration of InputImpl (#24057) dropped the embedded extractors array from the entity model: the builder ignores unknown properties, so loading an input discards its extractors, and saving uses replaceOne, which then persists the loss by replacing the whole document. Starting or stopping an input persists the desired state on the input document since #25338, so every start/stop deleted all extractors of the input. Updating an input through the REST API had the same effect via the getFields() merge in InputsResource, which also omitted extractors. Fix this by modeling the embedded extractor documents on InputImpl (like the embedded static fields) so they survive full document round-trips, and by carrying them through getFields() and buildFromMap(). Also turn persistDesiredState() into a targeted update of the desired_state field so state changes no longer rewrite the whole document. Fixes #26009 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
kodjo-anipah
reviewed
Jun 3, 2026
| saveWithoutEvents(updatedInput); | ||
| // Use a targeted update instead of saving the whole input to avoid overwriting concurrent changes | ||
| // to other parts of the input document. | ||
| collection.updateOne( |
9 tasks
kodjo-anipah
pushed a commit
that referenced
this pull request
Jun 3, 2026
…1`) (#26203) * Fix extractors being deleted when an input is started or stopped (#26198) * Fix extractors being deleted when an input is started or stopped The PersistedImpl -> AutoValue migration of InputImpl (#24057) dropped the embedded extractors array from the entity model: the builder ignores unknown properties, so loading an input discards its extractors, and saving uses replaceOne, which then persists the loss by replacing the whole document. Starting or stopping an input persists the desired state on the input document since #25338, so every start/stop deleted all extractors of the input. Updating an input through the REST API had the same effect via the getFields() merge in InputsResource, which also omitted extractors. Fix this by modeling the embedded extractor documents on InputImpl (like the embedded static fields) so they survive full document round-trips, and by carrying them through getFields() and buildFromMap(). Also turn persistDesiredState() into a targeted update of the desired_state field so state changes no longer rewrite the whole document. Fixes #26009 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * CL --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> (cherry picked from commit dbc747f) * Remove backported extractor regression tests from 7.1 branch --------- Co-authored-by: Patrick Mann <patrickmann@users.noreply.github.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
dennisoelkers
pushed a commit
that referenced
this pull request
Jun 4, 2026
) * Fix extractors being deleted when an input is started or stopped The PersistedImpl -> AutoValue migration of InputImpl (#24057) dropped the embedded extractors array from the entity model: the builder ignores unknown properties, so loading an input discards its extractors, and saving uses replaceOne, which then persists the loss by replacing the whole document. Starting or stopping an input persists the desired state on the input document since #25338, so every start/stop deleted all extractors of the input. Updating an input through the REST API had the same effect via the getFields() merge in InputsResource, which also omitted extractors. Fix this by modeling the embedded extractor documents on InputImpl (like the embedded static fields) so they survive full document round-trips, and by carrying them through getFields() and buildFromMap(). Also turn persistDesiredState() into a targeted update of the desired_state field so state changes no longer rewrite the whole document. Fixes #26009 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * CL --------- Co-authored-by: Claude Opus 4.8 (1M context) <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.
Closes #26009
Description
Since 7.1.0, extractors were deleted whenever an input was started, stopped, or updated. This was a regression from the
PersistedImplto AutoValue migration ofInputImpl(#24057): the new entity did not model the embeddedextractorsarray, so loading an input silently discarded its extractors, and saving viareplaceOnethen persisted the loss by replacing the whole document. Starting/stopping an input triggers such a save since #25338 (persistDesiredState), and updating an input had the same effect through thegetFields()merge inInputsResource.Fixed by modeling the embedded extractor documents on
InputImpl(analogous to the embedded static fields) so they survive full document round-trips, carrying them throughgetFields()andbuildFromMap(), and turningpersistDesiredState()into a targeted update of thedesired_statefield so state changes no longer rewrite the whole document.Verified that we did not perform any other such migrations in 7.1.
How Tested
InputServiceImplTest:persistDesiredStateKeepsExtractors,saveKeepsExtractors,updateViaFieldsMapKeepsExtractorspersistedDocumentContainsOnlyExpectedFieldscontract test to cover theextractorsfieldManual testing: create an input, add an extractor to it, then stop and start the input from the Inputs page. The extractor must still be listed afterwards. Also edit the input (e.g. change the title) and save, then verify the extractor is still present.
Types of changes
Checklist: