Skip to content

feat(migration): migrate codeTools Redux slice to v2 preference with layered preset#13340

Open
DeJeune wants to merge 2 commits intov2from
DeJeune/migrate-codetools-v2
Open

feat(migration): migrate codeTools Redux slice to v2 preference with layered preset#13340
DeJeune wants to merge 2 commits intov2from
DeJeune/migrate-codetools-v2

Conversation

@DeJeune
Copy link
Collaborator

@DeJeune DeJeune commented Mar 9, 2026

What this PR does

Before this PR:
The codeTools Redux slice stored per-tool settings (selected models, environment variables, directories) in separate Record<toolId, value> maps with a design flaw — directories and currentDirectory were global instead of per-tool.

After this PR:

  • Migrates all codeTools data to v2 Preference using the Layered Preset pattern
  • Fixes design flaw: directories are now per-tool (stored in overrides)
  • Adds the first preset definition file: packages/shared/data/presets/code-tools.ts

Fixes #

Why we need it and why it was done in this way

The following tradeoffs were made:

  • Used ComplexMapping instead of simple 1:1 mappings because multiple Redux maps need to be merged into a single overrides preference key
  • Stored only delta (non-default values) in overrides — tools with all-default settings are omitted entirely

The following alternatives were considered:

  • Separate preference keys per tool per field (e.g., feature.code_tools.qwen_code.model_id) — rejected due to key explosion (8 tools × 4 fields = 32 keys)

Breaking changes

None

Special notes for your reviewer

  • First usage of ComplexPreferenceMappings for a real migration (was empty before)
  • First preset file in packages/shared/data/presets/
  • ReduxExporter.SLICES_TO_EXPORT updated to include codeTools
  • 13 test cases for transform functions (TDD)

Checklist

Release note

NONE

…layered preset

- Add PRESETS_CODE_TOOLS preset defining CLI tools with defaults
- Add CodeToolOverrides type for per-tool user customizations
- Add preference keys: feature.code_tools.{overrides,selected_cli_tool,selected_terminal}
- Add complex mapping to transform selectedModels (full Model -> ID) + envVars + dirs into overrides
- Add 'codeTools' to ReduxExporter SLICES_TO_EXPORT
- Fix original design flaw: directories/currentDirectory now per-tool (via overrides) instead of global

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@DeJeune DeJeune requested a review from a team March 9, 2026 14:47
@DeJeune DeJeune requested a review from 0xfullex as a code owner March 9, 2026 14:47
…nal in overrides

Remove global `selected_cli_tool` and `selected_terminal` preference keys.
All per-tool config (enabled, model, envVars, terminal, directories) is
now stored in the single `feature.code_tools.overrides` key.

Migration strategy for legacy global fields:
- selectedCliTool → that tool gets `enabled: true`
- selectedTerminal → assigned to the selected tool (non-default only)
- directories/currentDirectory → assigned to the selected tool

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

1 participant