fix(synonyms): honor --replacements and --corrections when prompting - #281
Open
kai687 wants to merge 1 commit into
Open
fix(synonyms): honor --replacements and --corrections when prompting#281kai687 wants to merge 1 commit into
kai687 wants to merge 1 commit into
Conversation
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>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
TIP This summary will be updated as you push new changes.
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.
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 inAskAltCorrectionsSynonymQuestionswould check forreplacementsProvidedinstead ofcorrectionsProvidedTest plan
No test added:
AskSynonymdrives interactive survey prompts andFlagsProvidedfields are unexported, so covering this needs a refactor to make flag detection injectable. Worth doing separately.Manual check, placeholder path — expect a
placeholderprompt and noreplacementsprompt:Alt-correction path — expect a
wordprompt and nocorrectionsprompt: