Skip to content

fix: strip overrides removes keys missing from local config#50

Open
c10l wants to merge 1 commit intoiHildy:mainfrom
c10l:fix/strip-overrides-missing-local-key
Open

fix: strip overrides removes keys missing from local config#50
c10l wants to merge 1 commit intoiHildy:mainfrom
c10l:fix/strip-overrides-missing-local-key

Conversation

@c10l
Copy link

@c10l c10l commented Mar 24, 2026

Summary

  • Fixes stripOverrides() restoring base values when an override key (object or scalar) is missing from the local config but exists in the base (repo) config
  • Adds currentValue === undefined check to ensure override-declared keys are always stripped, regardless of base config presence
  • Adds 3 new test cases covering object overrides, scalar overrides, and existing-key scenarios

Problem

When a user adds a config section to opencode-synced.overrides.jsonc (e.g., server) that exists in the repo's base config but not in the local config, push reports "No local changes to push" because stripOverrides restores the base value instead of removing it.

Closes #49

Test plan

  • 3 new tests for stripOverrides covering the bug scenarios
  • All 40 existing tests continue to pass
  • Biome lint passes on changed files

When a user adds a config section to opencode-synced.overrides.jsonc
(e.g. server) that exists in the repo's base config but not in the
local config, stripOverrides was restoring the base value instead of
removing it. This caused push to report "no changes" even though the
override section should have been stripped from the repo.

Fix: add check for currentValue === undefined before restoring
baseValue. If an override declares a key that doesn't exist in the
local config, it should always be stripped (the override means
"this key is local-only").

Closes iHildy#49
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request resolves a critical bug in the stripOverrides function that previously caused it to incorrectly restore base configuration values when an override key was present in the base but absent from the local configuration. The fix ensures that the function accurately reflects the user's intent by stripping these overridden keys, thereby preventing issues where local changes were not properly recognized during configuration synchronization.

Highlights

  • Bug Fix: stripOverrides Functionality: The stripOverrides function now correctly removes override keys (both objects and scalars) that are declared in the overrides configuration but are missing from the local configuration, preventing unintended restoration of base values.
  • Improved Override Stripping Logic: An additional check for currentValue === undefined was introduced within stripOverrides to ensure that any key explicitly declared in the overrides is always stripped if it does not exist in the local configuration.
  • Enhanced Test Coverage: Three new test cases were added to src/sync/config.test.ts to specifically validate the corrected behavior of stripOverrides across various scenarios, including object overrides, scalar overrides, and handling of existing keys.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request enhances the stripOverrides function in src/sync/config.ts by modifying its logic to correctly strip keys that are either not present in the local configuration or not present in the base configuration. This ensures that override keys are properly removed if they are not explicitly defined in the local config. Corresponding unit tests have been added in src/sync/config.test.ts to validate these new behaviors, covering cases for both object and scalar keys. There is no feedback to provide on the review comments as none were provided.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stripOverrides restores base value when override key is missing from local config

1 participant