fix(code-server): merge settings with existing instead of skipping#953
Open
35C4n0r wants to merge 2 commits into
Open
fix(code-server): merge settings with existing instead of skipping#95335C4n0r wants to merge 2 commits into
35C4n0r wants to merge 2 commits into
Conversation
The code-server module had two settings bugs matching issue #447: User settings were only written when the file did not exist, and machine settings always overwrote the entire file. Port the merge_settings function from the vscode-web module so both User and Machine settings are deep-merged (jq, python3 fallback). Switch from fragile escaped-JSON to base64 encoding. Add integration tests for create, merge, and machine-merge paths. Update README and variable descriptions to document the new behaviour. Also remove the stale python3-fallback comment from vscode-web run.sh.
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
The code-server module had the same settings bug reported in #447 for vscode-web: User settings were only written when the file did not exist (silently skipped otherwise), and Machine settings always overwrote the entire file, destroying any existing settings.
This PR ports the
merge_settingsapproach already used in the vscode-web module (added in #758) to code-server, so both modules handle settings the same way.Type of Change
Module Information
Path:
registry/coder/modules/code-serverWhat Changed
run.shmerge_settings()function (identical to vscode-web).merge_settings()usesjq -s '.[0] * .[1]'for deep merge, falls back to python3, and preserves existing settings with a warning if neither tool is available.replace(jsonencode(...))) to base64 encoding.{}) are now skipped entirely instead of writing an empty object.main.tflocalsblock withsettings_b64andmachine_settings_b64.SETTINGS/MACHINE_SETTINGStemplate vars with base64 variants.settingsandmachine_settingsvariable descriptions to document merge behaviour.main.test.tsbeforeAll,afterEachcleanup, timeout).README.mdjq/python3requirement warning (matching vscode-web).Testing & Validation
bun test)bun fmt)terraform testpassRelated Issues
Closes #447