Fix import replace for file objects, archive state, and metadata#2957
Open
stevelr wants to merge 1 commit intoanyproto:developfrom
Open
Fix import replace for file objects, archive state, and metadata#2957stevelr wants to merge 1 commit intoanyproto:developfrom
stevelr wants to merge 1 commit intoanyproto:developfrom
Conversation
During replace/update-existing import, three issues caused incorrect object targeting and metadata loss: 1. ID resolution matched imported clones via OldAnytypeID instead of the original object. Prioritize direct object-ID lookup when getExisting is true to ensure in-place replace targets the correct object. 2. File object re-upload could hit dedup and return a different file-object ID, bypassing state reset on the matched existing object. Short-circuit when the existing ID is already resolved. 3. Archive/unarchive and file sync side-effects bump lastModifiedDate. Restore the snapshot's original timestamp after these operations. Also restore legacy file details (name, dates, creator) for both SmartBlockTypeFile snapshots and existing SmartBlockTypeFileObject objects during replace import. Remove SmartBlockTypeFileObject from canUpdateObject exclusion list so file objects participate in resetState during replace. Change setArchived to bidirectional (archive and unarchive) and return whether an unarchive occurred for timestamp restoration. Note: this PR changes some of the same files as two other PRs. Recommended merge order to minimize rebase effort: 1. anyproto#2955 2. anyproto#2956 3. This one
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.
Description
During replace/update-existing import, three issues caused incorrect object targeting and metadata loss:
ID resolution matched imported clones via OldAnytypeID instead of the original object. Prioritize direct object-ID lookup when getExisting is true to ensure in-place replace targets the correct object.
File object re-upload could hit dedup and return a different file-object ID, bypassing state reset on the matched existing object. Short-circuit when the existing ID is already resolved.
Archive/unarchive and file sync side-effects bump lastModifiedDate. Restore the snapshot's original timestamp after these operations. Also restore legacy file details (name, dates, creator) for both SmartBlockTypeFile snapshots and existing SmartBlockTypeFileObject objects during replace import.
Remove SmartBlockTypeFileObject from canUpdateObject exclusion list so file objects participate in resetState during replace. Change setArchived to bidirectional (archive and unarchive) and return whether an unarchive occurred for timestamp restoration.
Note: this PR changes some of the same files as two other PRs.
Recommended merge order to minimize rebase effort:
What type of PR is this? (check all applicable)
Added tests?
[optional] Are there any post-deployment tasks we need to perform?
See note above about merge order