Skip to content

feat(config): apply skip rules during the config.toml migration#247

Merged
LorrisSaintGenez merged 1 commit into
feat/migration-bodyfrom
feat/migration-skip-rules
Jun 12, 2026
Merged

feat(config): apply skip rules during the config.toml migration#247
LorrisSaintGenez merged 1 commit into
feat/migration-bodyfrom
feat/migration-skip-rules

Conversation

@LorrisSaintGenez

@LorrisSaintGenez LorrisSaintGenez commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

What

Third step of GROUT-363, stacked on #246: the migration skip rules, applied before any keychain write.

  • admin_api_key never moves to the new model: one log line points to ALGOLIA_ADMIN_API_KEY / --api-key instead, whether the profile migrates or not
  • A profile without application_id or with an empty api_key has nothing usable to migrate: skipped + log
  • Profiles sharing the same application_id would overwrite each other's keychain entry: the default = true profile wins, the others are logged as conflicts and skipped
  • Profiles are processed in name order so conflict resolution and logs stay deterministic (ConfiguredProfiles iterates a map)

Test

# config.toml with: a profile with an empty api_key, two profiles sharing
# the same application_id (one default), and an admin_api_key-only profile
rm -f ~/.config/algolia/state.toml
go run ./cmd/algolia indices list      # one log line per skip, once
cat ~/.config/algolia/state.toml       # only the default profile's entry remains

GROUT-363

Before any keychain write, profiles go through the skip rules:

- admin_api_key never moves to the new model; one log line points to
  ALGOLIA_ADMIN_API_KEY / --api-key instead.
- No application_id or an empty api_key: nothing usable, skip + log.
- Profiles sharing the same application_id: the default = true profile
  wins, the others are logged as conflicts and skipped.

Profiles are processed in name order so conflict resolution and logs
stay deterministic.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 15 complexity · 1 duplication

Metric Results
Complexity 15
Duplication 1

View in Codacy

TIP This summary will be updated as you push new changes.

@LorrisSaintGenez LorrisSaintGenez marked this pull request as ready for review June 12, 2026 21:08
@LorrisSaintGenez LorrisSaintGenez self-assigned this Jun 12, 2026
@LorrisSaintGenez LorrisSaintGenez merged commit f252ba4 into feat/migration-body Jun 12, 2026
2 checks passed
@LorrisSaintGenez LorrisSaintGenez deleted the feat/migration-skip-rules branch June 12, 2026 21:08
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