Skip to content

Last synced keybindings and globalState not updating version when syncing with no changes #89817

@Tyriar

Description

@Tyriar

Repro:

  • Machine A: Sync to server 1
  • Machine B: Change to server 2 and do first sync
  • Machine A: Change to server 2 and sync

Logs after 2 syncs, notice the 200 response codes:

[2020-01-31 11:53:33.674] [userDataSync] [info] Sync: Triggerred.
[2020-01-31 11:53:33.678] [userDataSync] [trace] Sending request to server {"url":"snip/resource/settings/latest","headers":{"Cache-Control":"no-cache","If-None-Match":"9f7f222d-59b5-48e2-beab-450ed22c4549"}}
[2020-01-31 11:53:33.721] [userDataSync] [trace] Request finished {"url":"snip/resource/settings/latest","status":304}
[2020-01-31 11:53:33.722] [userDataSync] [trace] Started Syncing...
[2020-01-31 11:53:33.722] [userDataSync] [trace] Settings: Started synchronizing settings...
[2020-01-31 11:53:33.724] [userDataSync] [trace] Sending request to server {"url":"snip/resource/settings/latest","headers":{"Cache-Control":"no-cache","If-None-Match":"9f7f222d-59b5-48e2-beab-450ed22c4549"}}
[2020-01-31 11:53:33.754] [userDataSync] [trace] Request finished {"url":"snip/resource/settings/latest","status":304}
[2020-01-31 11:53:33.756] [userDataSync] [trace] Settings: Merging remote settings with local settings...
[2020-01-31 11:53:33.765] [userDataSync] [trace] Settings: No changes found during synchronizing settings.
[2020-01-31 11:53:33.765] [userDataSync] [info] Settings: Updating last synchronised settings
[2020-01-31 11:53:33.779] [userDataSync] [trace] Settings: Finished synchronizing settings.
[2020-01-31 11:53:33.779] [userDataSync] [trace] Keybindings: Started synchronizing keybindings...
[2020-01-31 11:53:33.783] [userDataSync] [trace] Sending request to server {"url":"snip/resource/keybindings/latest","headers":{"Cache-Control":"no-cache","If-None-Match":"ed8ba4b5-ceb8-4ed0-a994-e96402e1a6b6"}}
[2020-01-31 11:53:33.824] [userDataSync] [trace] Request finished {"url":"snip/resource/keybindings/latest","status":200}
[2020-01-31 11:53:33.825] [userDataSync] [trace] Keybindings: No changes found during synchronizing keybindings.
[2020-01-31 11:53:33.825] [userDataSync] [trace] Keybindings: Finished synchronizing keybindings...
[2020-01-31 11:53:33.826] [userDataSync] [trace] UI State: Started synchronizing ui state...
[2020-01-31 11:53:33.828] [userDataSync] [trace] Sending request to server {"url":"snip/resource/globalState/latest","headers":{"Cache-Control":"no-cache","If-None-Match":"c3870b76-a09b-4aad-87a4-b460b2d3aa5a"}}
[2020-01-31 11:53:33.870] [userDataSync] [trace] Request finished {"url":"snip/resource/globalState/latest","status":200}
[2020-01-31 11:53:33.870] [userDataSync] [trace] UI State: Merging remote ui state with local ui state...
[2020-01-31 11:53:33.870] [userDataSync] [trace] UI State: No changes found during synchronizing ui state.
[2020-01-31 11:53:33.870] [userDataSync] [trace] UI State: Finished synchronizing ui state.
[2020-01-31 11:53:33.870] [userDataSync] [trace] Extensions: Started synchronizing extensions...
[2020-01-31 11:53:33.873] [userDataSync] [trace] Sending request to server {"url":"snip/resource/extensions/latest","headers":{"Cache-Control":"no-cache","If-None-Match":"bbf4ecd2-c229-40f9-ba67-50d66967034f"}}
[2020-01-31 11:53:33.903] [userDataSync] [trace] Request finished {"url":"snip/resource/extensions/latest","status":304}
[2020-01-31 11:53:33.923] [userDataSync] [trace] Extensions: Merging remote extensions with local extensions...
[2020-01-31 11:53:33.923] [userDataSync] [trace] Extensions: No changes found during synchronizing extensions.
[2020-01-31 11:53:33.923] [userDataSync] [trace] Extensions: Finished synchronizing extensions.
[2020-01-31 11:53:33.923] [userDataSync] [trace] Finished Syncing. Took 201ms

The versions of keybindings and globalState passed into If-None-Match do not exist on the new server:

  • ed8ba4b5-ceb8-4ed0-a994-e96402e1a6b6
  • c3870b76-a09b-4aad-87a4-b460b2d3aa5a

Settings and extensions are though. I believe what is happening is that the last sync version number is not updating when there are no changes. The content of .sync files backs this up:

❯ cat ~/Library/Application\ Support/Code\ -\ Insiders/User/.sync/GlobalState/.lastSyncGlobalState.json 
{"ref":"c3870b76-a09b-4aad-87a4-b460b2d3aa5a","content":"{\"argv\":{\"locale\":\"en-gb\"},\"storage\":{}}"}

❯ cat ~/Library/Application\ Support/Code\ -\ Insiders/User/.sync/Keybindings/.lastSyncKeybindings.json 
{"ref":"ed8ba4b5-ceb8-4ed0-a994-e96402e1a6b6", ...

It's hard to think of a case where this would happen normally but it's pretty likely to end up causing other bugs; the synced version must always be updated after fetching the latest content and merging.

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugsettings-syncverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions