Skip to content

Conversation

@akramcodez
Copy link

Description

Settings migration from V2 to V1 was silently dropping unmapped properties when their parent container had some mapped properties. For example, if general.theme was mapped but general.newFeatureFlag was not, the entire general key would be marked as consumed, losing newFeatureFlag.

Solution

  • Changed from tracking top-level keys to tracking full consumed paths
  • Implemented partial migration logic that:
    • Clones containers with mixed properties
    • Removes only consumed nested paths using lodash.unset
    • Recursively cleans empty objects left behind
    • Preserves all unmapped properties

Changes

  • settings.ts: Refactored migration to use path-based tracking
  • settings.test.ts: Added test validating unmapped property preservation

Testing

New test validates that:

  • Mapped properties migrate correctly (preferredEditor, folderTrust)
  • Unmapped properties are preserved (newFeatureFlag, blackbox.apiKey)
  • Partial containers are handled properly

fixes #13

@akramcodez
Copy link
Author

PTAL @blackboxaicode

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.

Data Loss During Settings Migration (V2 → V1)

1 participant