feat: add Jaro-Winkler typo suggestions for unknown operations (Fixes #43)#44
feat: add Jaro-Winkler typo suggestions for unknown operations (Fixes #43)#44andreasronge merged 1 commit intomainfrom
Conversation
Implements helpful typo suggestions in validation error messages when users provide unknown operation names. Uses Jaro-Winkler similarity algorithm to find the closest matching valid operation with a threshold of 0.8 to avoid spurious suggestions. Fixes #43 - Add suggest_operation/1 helper function in validator.ex with @valid_operations list - Update unknown operation error to include suggestion suffix when similarity > 0.8 - Add comprehensive unit tests covering common typos (missing letter, extra letter) - Add case-insensitive handling via String.downcase - Add E2E test for typo suggestion in complex pipeline - All existing tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: feat: add Jaro-Winkler typo suggestions for unknown operationsSummaryClean implementation of typo suggestions for unknown operation names using Elixir's built-in What's Good
Issues (Must Fix)None. The implementation is complete and correct. Suggestions (Optional)
SecurityNo concerns. The feature only affects validation error messages and uses no external input beyond what's already validated. The VerdictApprove - This is a well-implemented, focused enhancement that directly addresses the issue specification. All tests pass, the code follows existing patterns, and the |
Auto-Triage SummaryReview AnalysisReviewed the PR #44 approval comment from github-actions bot. The review gave an APPROVE verdict with zero must-fix issues and one optional suggestion. Decisions Made
Status
ConclusionThe PR is approved and ready to merge. All critical functionality is implemented correctly with comprehensive test coverage. The single optional suggestion does not warrant blocking or additional work. |
Summary
Implements helpful typo suggestions in validation error messages when users provide unknown operation names. Uses the built-in Jaro-Winkler similarity algorithm to suggest the closest matching valid operation when similarity exceeds 0.8.
This directly supports Phase 5 goals for "Error messages optimized for LLM consumption" - typo suggestions help LLMs self-correct their generated programs, reducing roundtrips.
Changes
lib/ptc_runner/validator.ex:
@valid_operationsmodule attribute listing all 34 valid operationssuggest_operation/1helper function usingString.jaro_distance/2String.downcase/1test/ptc_runner_test.exs:
Test Results
Examples
```
Unknown operation 'filer'. Did you mean 'filter'?
Unknown operation 'selct'. Did you mean 'select'?
Unknown operation 'xyz' (no suggestion, below threshold)
```
Fixes #43
🤖 Generated with Claude Code