-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Description
Bug
When a user manually adds a config section to opencode-synced.overrides.jsonc that already exists in the repo's base config, and removes it from their local config, stripOverrides restores the base value instead of removing it.
Steps to Reproduce
opencode.jsonhas aserversection → pushed to repo- User adds
serversection toopencode-synced.overrides.jsonc(wants it local-only) - User removes
serverfromopencode.json - Run
/sync-push→ reports "No local changes to push" - Repo still contains
serversection (should be stripped)
Root Cause
In stripOverrides() (src/sync/config.ts:239-243):
if (isPlainObject(overrideValue) && isPlainObject(currentValue)) {
// recurse...
continue;
}
if (baseValue === undefined) {
delete result[key];
} else {
result[key] = baseValue; // ← restores base when override is object but local doesn't have key
}When overrideValue is a plain object but currentValue is undefined (key not in local config), the code falls through to the scalar branch and restores the base value instead of deleting the key.
Expected Behavior
If an override declares a key that doesn't exist in the local config, it should be stripped from the repo result regardless of whether the base config has it. The override means "this key is local-only."
Fix
Add a check for currentValue === undefined before the baseValue check:
if (currentValue === undefined || baseValue === undefined) {
delete result[key];
} else {
result[key] = baseValue;
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels