Repository navigation
Fix terminal UI validator stub so interactive prompts actually validate input - #53
Merged
Merged
Conversation
…te input make_validator returned None unconditionally, so a Question's validator expression was silently ignored in the interactive terminal UI. It now wraps the validator callable into questionary's True/error-string contract. Also fixes ask_multiselect passing the wrong kwarg (`validator=` instead of `validate=`, which questionary.checkbox ignores), and gives ask_select a manual validate-and-reprompt loop since questionary.select() has no validation hook of its own. Closes #48
Contributor
|
Version hint: patch Comment ID: Display version hint-auto-generated |
Contributor
|
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.
Summary
make_validatorinproject_forge/ui/terminal.pyreturnedNoneunconditionally, so aQuestion'svalidatorexpression was silently discarded and interactive terminal prompts never validated user input.make_validatornow wraps the validator callable into theTrue/error-string contractquestionaryexpects.ask_multiselectwas passingvalidator=instead ofvalidate=toquestionary.checkbox, an unrecognized kwarg thatquestionarysilently dropped — fixed tovalidate=.questionary.select()has no validation hook at all, soask_selectnow runs a manual validate-and-reprompt loop instead of passing a dead kwarg.Test plan
uv run pytest tests/test_ui/test_terminal.py -v— 20 passed, including new tests formake_validator, text-prompt rejection wired through questionary's real validator, and select re-prompting on an invalid choice.uv run pytest -q— 334 passed (pre-existing, unrelatedtest_git_commands.pyfailures in this sandbox due to git push restrictions).uv run ruff check/ruff format --checkon changed files.Closes #48