feat(config): one-time config.toml migration to state.toml + keychain#248
Draft
LorrisSaintGenez wants to merge 4 commits into
Draft
feat(config): one-time config.toml migration to state.toml + keychain#248LorrisSaintGenez wants to merge 4 commits into
LorrisSaintGenez wants to merge 4 commits into
Conversation
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 43 |
| Duplication | 12 |
TIP This summary will be updated as you push new changes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two startup-path regressions found while testing edge cases: - An undecodable profile (root-level scalar, unconvertible field type) hit ConfiguredProfiles' log.Fatalf and bricked every command, --help included, forever (state.toml never written). The migration now decodes profiles itself and skips undecodable entries with a log. - An unparseable config.toml was silently read as zero profiles, so an empty state.toml marked the migration as done forever. Migrate now aborts when config.toml cannot be parsed and retries on the next run. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The remaining non-secret profile data moves with the migration so it survives the eventual config.toml removal. GetSearchHosts and GetCrawlerUserID gain a new-model branch: the resolved application's state.toml entry answers first, an empty value falls through to the legacy config.toml lookup while both models coexist. admin_api_key stays excluded as decided on the ticket. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
GROUT-363: one-time, first-run migration of the legacy
config.tomlprofiles into the new storage model (state.toml+ OS keychain). Squashed stack of #245, #246 and #247.config.tomlexists andstate.tomldoesn't —state.tomlis only written on success, so its absence doubles as the "not migrated yet" marker and an aborted run retries on the next command. A failed migration never blocks the command (DEBUG-only log).api_key(+crawler_api_keyif set) goes to the OS keychain under the profile's application ID; onestate.tomlentry per application withalias = <profile name>;current_application_id= thedefault = trueprofile's application;api_key_uuidleft empty for legacy keys.state.tomllast (temp + rename). An empty config.toml still writes an emptystate.tomlso the trigger turns off.search_hostsandcrawler_user_idmove to the application'sstate.tomlentry;GetSearchHosts/GetCrawlerUserIDread them for the resolved application first, falling back to config.toml while both models coexistConfiguredProfiles'slog.Fatalf(which bricked every command at startup); an unparseable config.toml aborts the migration instead of marking it done with an emptystate.tomlapplication_idor emptyapi_key→ skip + log; profiles sharing the sameapplication_id→ the default profile wins, others logged as conflicts;admin_api_keynever migrated, one log line pointing toALGOLIA_ADMIN_API_KEY/--api-key.config.tomlitself is never modified.Test
GROUT-363