feat: support extensions marketplace settings context hash

Issue: Support extensions marketplace context in the W... (#414 - closed)

What does this MR do and why?

Summary:

  • Introduces a new field settingsContextHash in extensions gallery settings when extensions gallery is enabled.
  • Updates the Settings Sync URL passed in productConfiguration.configurationStore.sync to include this hash in the path parameter if it exists.
  • Example App: adds a new input field for settingsContextHash when extensions gallery is enabled. Will create a follow up MR to make Example App closely mimic real world by generating a hash of the settings and a local alternative marketplace but for now manually entering the hash should be enough for testing purposes.
  • Updates cleanExtensions logic:
    • Include removing the last synced extensions data in the VSCode web state store as part of the clean extensions step.
    • Handle migration from none to settings_context_hash by not clearing extensions if no last settings context hash stored.
    • If extensions marketplace is enabled and settings context hash is passed, only clear extensions if the last and current settings context hash doesn't match.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Local setup

Screenshots or screen recordings

Case Expectation Validation steps Recording

Regression

No settings_context_hash ➡️ disabled extensions marketplace ➡️ No settings_context_hash

  • This is what is currently implemented, so we're just ensuring no regressions.
  • Installed extensions are cleared when extensions marketplace was previously enabled but is now disabled.
  • When Web IDE starts with extensions marketplace re-enabled, extensions are still cleared.
  • In the Example App form, ensure that settings context hash field is empty.
  • Start Web IDE and install an extension. Make sure the newly installed extension is persisted.
  • Reload and disable extensions marketplace
  • Start the Web IDE and ensure extensions are cleared by checking vscode-web-db/vscode-userdata-store in IndexedDB
  • Reload and re-enable extensions marketplace with no settings context hash.
  • Observe no extensions are installed.

regression.mov

Migration

No settings_context_hash ➡️ settings_context_hash = 1234

  • We can treat this as users migrating to the settings_context_hash. We don't want them to lose their existing extensions when we fully implement settings context hash.
  • Installed extensions are not lost and are carried over to this new settings context.
  • In the Example App form, ensure that settings context hash field is empty.
  • Start Web IDE and install Dracula Theme extension and set the IDE theme. Make sure the newly installed extension is persisted.
  • Reload and enter a new settings context hash: 1234. Ensure that there is no web_ide_last_extensions_marketplace_settings_context_hash item in local storage.
  • Observe that extensions and theme are carried over.
migration

Existing context to new context

settings_context_hash=1234 ➡️ settings_context_hash=5678

  • No extensions should be installed when switching to a new settings context.
  • Non-extensions settings are shared across contexts.
  • In the Example App form, enter settings context hash: 1234.
  • Start the Web IDE and note extensions installed.
  • Reload and enter new settings context hash: 5678.
  • Start the Web IDE and note extensions from previous context are not migrated over.
  • For testing next case: Install extensions: Dracula Theme and Prettier

new_context

Switching between different existing contexts

settings_context_hash=1234 ➡️settings_context_hash=5678

  • Extensions data are contained within their settings context.
  • In the Example App form, enter settings context hash: 1234.
  • Start the Web IDE and note only Dracula Theme extension installed.
  • Reload and enter settings context hash from 5678.
  • Start the Web IDE and observe that the Dracula Theme and Prettier extensions are installed. Observe that the theme settings are carried over.

existing-context

Re-enabling marketplace with same context

settings_context_hash=1234 ➡️ disabled extensions marketplace ➡️ settings_context_hash=1234

  • Installed extensions are cleared when starting Web IDE with disabled extensions marketplace.
  • When marketplace is re-enabled and Web IDE is started, it loads correct extensions settings.
  • In the Example App form, enter settings context hash: 1234
  • Start the Web IDE and note Dracula Theme extension installed.
  • Reload and disable extensions marketplace
  • Start the Web IDE and note extensions are removed in the IndexedDB store.
  • Reload and re-enable extensions marketplace and enter same settings context hash: 1234.
  • Start the Web IDE and observe the same extensions are re-installed.

re-enabled-same-context

Re-enabling marketplace with different context

settings_context_hash=1234 ➡️ disabled extensions marketplace ➡️ settings_context_hash=5678

  • Installed extensions are cleared when starting Web IDE with disabled extensions marketplace.
  • When marketplace is re-enabled and Web IDE is started, it loads correct extensions settings.
  • In the Example App form, enter settings context hash: 1234
  • Start the Web IDE and note Dracula Theme extension installed.
  • Reload and disable extensions marketplace
  • Start the Web IDE and note extensions are removed in the IndexedDB store.
  • Reload and re-enable extensions marketplace and enter same settings context hash: 5678.
  • Start the Web IDE and observe the correct extensions are installed: Dracula Theme and Prettier.

re-enabled-diff-context

Edited by Cindy Halim

Merge request reports

Loading