feat: migrate experiments config from array to bools#398
Draft
feat: migrate experiments config from array to bools#398
Conversation
Change the experiments field in SystemConfig, ProjectConfig, and Config
from []experiment.Experiment to map[string]bool. This enables dot-notation
access for the upcoming config command and allows explicit enable/disable
of experiments.
Includes backwards-compatible JSON unmarshaling that auto-converts the old
array format (["charm"]) to the new map format ({"charm": true}).
Updates help output to show all available experiments with ENABLED/DISABLED
status for better discoverability.
Reverts the EXPERIMENTS section changes from the experiments migration commit to keep PR #1 focused on the array-to-map refactor. Help menu improvements will be done in a separate PR.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #398 +/- ##
==========================================
+ Coverage 67.90% 67.94% +0.04%
==========================================
Files 218 219 +1
Lines 18050 18103 +53
==========================================
+ Hits 12256 12300 +44
- Misses 4640 4646 +6
- Partials 1154 1157 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Changelog
Summary
This pull request migrates the experiments config format from an array to a map of boolean values. It includes backwards-compatible JSON unmarshaling that will auto-migrate
config.jsonfiles.Motivation
The motivation is to enable friendly dot-notation access for a future
slack config <key> [value]command.The command's
<key>can expressed a nested JSON key as dot-notation (e.g.config experimentsorconfig manifest.source). However, the[value]is more tricky.In order for setting
[value]to be simple and intuitive, we should restrict theconfig.jsonfiles to use simple value types that can be expressed on the command-line (e.g. string, number, and boolean). Arrays are complex and error-prone to express (["value1", "value2"]orvalue1, value2) and all elements must be included each time.This is why this pull request migrates the experiments to an object of
key: booleanpairs. An added bonus is that the new format naturally supports disabling experiments from the config file.Example
Before:
{ "experiments": ["sandboxes"], "manifest": { "source": "local" }, "project_id": "..." }After:
{ "experiments": { "sandboxes": true, "charm" :false }, "manifest": { "source": "local" }, "project_id": "..." }Requirements