feat(vscode-web): enhance settings management and testing for VS Code Web#758
feat(vscode-web): enhance settings management and testing for VS Code Web#758DevelopmentCats wants to merge 5 commits intomainfrom
Conversation
… 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.
There was a problem hiding this comment.
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_settingshelper to merge decoded settings JSON into~/.vscode-server/data/Machine/settings.json, preferringjqand falling back topython3. - Pass settings to the startup script as base64-encoded JSON (
SETTINGS_B64) to avoid quoting issues. - Expand
main.test.tswith 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. |
…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.
|
@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? |
|
@DevelopmentCats Minor is good here. It's a change in behaviour. |
Version Bump RequiredOne or more modules in this PR need their versions updated. To fix this:
The CI will automatically re-run once you push the updated versions. |
matifali
left a comment
There was a problem hiding this comment.
LGTM. Do we have a similar setup for code-server module too? If not let's do it
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:
merge_settingsfunction inrun.shthat merges provided settings with any existing machine settings usingjqorpython3if available, falling back gracefully if neither is present. Settings are now passed as base64-encoded JSON to avoid quoting issues. [1] [2] [3] [4]settingsvariable inmain.tfto clarify that it applies to VS Code Web's Machine settings and will be merged with any existing settings on startup.Documentation Improvements:
jqorpython3) and limitations regarding persistence of user settings. [1] [2]Automated Testing:
main.test.tsto 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.