Skip to content

fix(synonyms): honor --replacements and --corrections when prompting - #281

Open
kai687 wants to merge 1 commit into
mainfrom
fix/synonyms-replacements-flag
Open

fix(synonyms): honor --replacements and --corrections when prompting#281
kai687 wants to merge 1 commit into
mainfrom
fix/synonyms-replacements-flag

Conversation

@kai687

@kai687 kai687 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

This PR fixes a bug in algolia synonyms save. The CLI is supposed to ask for missing synonym options if they're not provided through flags.

This PR fixes two checks that lead to the CLI ignoring 2 flags:

  • --replacements. The check for this flag would always return false due to a typo.
  • --corrections. This flag would always be ignored because the logic in AskAltCorrectionsSynonymQuestions would check for replacementsProvided instead of correctionsProvided

Test plan

No test added: AskSynonym drives interactive survey prompts and FlagsProvided fields are unexported, so covering this needs a refactor to make flag detection injectable. Worth doing separately.

Manual check, placeholder path — expect a placeholder prompt and no replacements prompt:

algolia synonyms save MOVIES --id 1 --type placeholder --replacements a,b

Alt-correction path — expect a word prompt and no corrections prompt:

algolia synonyms save MOVIES --id 2 --type altCorrection1 --corrections x,y

AskSynonym built replacementsProvided from Changed("repalcements"), a flag
name that is never registered, so pflag always returned false. Supplying
--replacements did not suppress the replacements question for placeholder
synonyms.

AskAltCorrectionSynonymQuestions also gated the corrections question on
replacementsProvided instead of correctionsProvided, so --corrections was
ignored too and correctionsProvided was never read. Fixing only the typo
would have made --replacements skip the corrections question and fail
validation, so both checks are corrected together.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

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

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