feat(config): trigger the config.toml migration at startup#245
Draft
LorrisSaintGenez wants to merge 1 commit into
Draft
feat(config): trigger the config.toml migration at startup#245LorrisSaintGenez wants to merge 1 commit into
LorrisSaintGenez wants to merge 1 commit into
Conversation
ShouldMigrate fires when config.toml exists and state.toml doesn't: state.toml is only written on success, so its absence doubles as the "not migrated yet" marker and an aborted run retries on the next one. Migrate is a deliberate no-op until the migration body lands. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Not up to standards ⛔
|
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.
What
Step 1 of GROUT-363 — wires the one-time config.toml → state.toml + keychain migration trigger, without the migration body yet.
Config.ShouldMigrate(): true whenconfig.tomlexists andstate.tomldoesn't.state.tomlis only written when the migration (or any new-model write) succeeds, so its absence doubles as the "not migrated yet" marker — an aborted migration naturally retries on the next run, no separate flag needed.Config.Migrate(): deliberate no-op for now — it must NOT writestate.toml, otherwise the trigger would stop firing before the real migration ships. The body lands in the follow-up PRs (per-profile move, skip rules, atomicity).Execute(), right afterInitConfig(): the migration has to run before the command executes because credential resolution readsstate.tomlonce per invocation and caches it. A migration failure never blocks the command (logged in debug mode only).Test
Unit tests only —
Migrateis still a no-op, so there is no observable CLI behavior yet:go test ./pkg/config -run TestConfig_ShouldMigrate -vGROUT-363