fix(installer): deep-merge object config defaults in settings merger#57
Merged
Conversation
The setup.sh merger preserved a user's existing settings.json object blocks whole, so a new nested config default added by a sync never reached existing installs. Surfaced installing v11.27.0: attribution.sessionUrl showed in `bun run compose` but not in the merged settings.json — the user's existing attribution block shadowed the team's, version sentinel bumped, setting never landed. userWinsScalarStrategy now deep-merges plain objects (new recursive deepMergeUserWins helper): team-only sub-keys land while user customizations win on conflict. Arrays and object/scalar mismatches stay user-wins-whole. New defaultsAdded accounting surfaces a landing default instead of silence. 6 tests added; 539 pass / 0 fail.
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.
What this does
When you re-run the installer, a new nested setting that a sync added — like
attribution.sessionUrlin v11.27.0 — now actually lands in your~/.claude/settings.json. Before this, the installer kept your existingattributionblock exactly as-is and quietly dropped the new sub-key, so the version number went up but the setting never arrived. (That's exactly what happened on the v11.27.0 install — it had to be patched by hand.)Summary
userWinsScalarStrategy, used for any key without a dedicated handler:attribution,sandbox,spinnerVerbs, …) previously did{ ...team, ...user }— the user's whole object shadowed the team's, so team-only sub-keys were lost.deepMergeUserWinshelper: plain objects deep-merge (team-only sub-keys land; user's customized sub-keys win on conflict). Arrays and object↔scalar shape mismatches keep user-wins-whole — a replaced array or retyped field is a deliberate override, not a partial one.MergeAccounting.defaultsAddedcounter + install line ("Added N new team default(s) into existing settings block(s)") so a landing default is visible instead of silent.permissions,hooks,env,statusLine,mcpServers) are untouched.Root cause is also recorded in the team-knowledge repo:
cc-settings-installer-skips-nested-config-defaults.Test Plan
bun run typecheckcleanbun test— 539 pass / 0 fail (6 new merger tests)bun run lint— my files clean (3 pre-existing warnings intests/mcp.test.tsunrelated)attribution.sessionUrlregression lock