Skip to content

feat(vscode-web): enhance settings management and testing for VS Code Web#758

Open
DevelopmentCats wants to merge 5 commits intomainfrom
cat/vscode-settings-merge
Open

feat(vscode-web): enhance settings management and testing for VS Code Web#758
DevelopmentCats wants to merge 5 commits intomainfrom
cat/vscode-settings-merge

Conversation

@DevelopmentCats
Copy link
Contributor

This pull request enhances the VS Code Web module by improving how machine settings are handled and merged, updating documentation to clarify the settings behavior, and adding robust automated tests for the new functionality. The most significant changes are grouped below.

Machine Settings Handling and Merging:

  • Introduced a new merge_settings function in run.sh that merges provided settings with any existing machine settings using jq or python3 if available, falling back gracefully if neither is present. Settings are now passed as base64-encoded JSON to avoid quoting issues. [1] [2] [3] [4]
  • Updated the settings variable in main.tf to clarify that it applies to VS Code Web's Machine settings and will be merged with any existing settings on startup.

Documentation Improvements:

  • Updated the README to clarify that settings are merged with existing machine settings, not simply overwritten, and added a note about the requirements (jq or python3) and limitations regarding persistence of user settings. [1] [2]

Automated Testing:

  • Expanded main.test.ts to include integration tests that verify settings file creation and merging behavior inside a container, as well as improved error handling for invalid configuration combinations.

These changes collectively make machine settings management more robust, user-friendly, and well-documented.

… Web module

- Added functionality to merge new settings with existing machine settings during startup.
- Updated tests to validate settings merging and error handling for invalid configurations.
- Improved test structure with before/after hooks for better resource management.
- Enhanced README to clarify settings merging requirements and behavior.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves VS Code Web module “Machine settings” handling by merging module-provided settings into an existing VS Code settings file on startup, clarifies the behavior in Terraform docs/README, and expands the module’s automated tests around configuration validation and settings behavior.

Changes:

  • Add a merge_settings helper to merge decoded settings JSON into ~/.vscode-server/data/Machine/settings.json, preferring jq and falling back to python3.
  • Pass settings to the startup script as base64-encoded JSON (SETTINGS_B64) to avoid quoting issues.
  • Expand main.test.ts with container-based tests for settings file creation/merge and improve apply-failure assertions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
registry/coder/modules/vscode-web/run.sh Adds machine settings merge logic and decodes settings from base64 before applying.
registry/coder/modules/vscode-web/main.tf Documents machine-settings semantics and switches settings injection to base64 JSON via locals.
registry/coder/modules/vscode-web/main.test.ts Adds integration tests for settings creation/merge and updates failure assertions.
registry/coder/modules/vscode-web/README.md Clarifies “Machine settings” behavior, merge semantics, and tool requirements.

@matifali matifali requested a review from phorcys420 February 25, 2026 17:11
…or fallback scenarios

- Added tests to verify settings merging behavior under different conditions, including when neither jq nor Python3 is installed.
- Updated run.sh to handle settings decoding errors gracefully, providing warnings when settings cannot be applied.
@DevelopmentCats
Copy link
Contributor Author

@matifali What do you think we need to do in regards to version bump on this one?

Technically I feel like its fine as a patch, but since its not just a simple change and this requires additional dependencies for settings merging I think it might be fine as a minor bump?

@matifali
Copy link
Member

matifali commented Feb 25, 2026

@DevelopmentCats Minor is good here. It's a change in behaviour.

@DevelopmentCats DevelopmentCats added the version:minor Add to PRs requiring a minor version upgrade label Feb 27, 2026
@github-actions
Copy link
Contributor

Version Bump Required

One or more modules in this PR need their versions updated.

To fix this:

  1. Run the version bump script locally:
    ./.github/scripts/version-bump.sh minor
  2. Commit the changes:
    git add . && git commit -m "chore: bump module versions (minor)"
  3. Push your changes

The CI will automatically re-run once you push the updated versions.

Copy link
Member

@matifali matifali left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Do we have a similar setup for code-server module too? If not let's do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version:minor Add to PRs requiring a minor version upgrade

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants