feat: Add keyword/string type coercion to where clause comparisons (#232)#233
Conversation
) Implement automatic coercion of keywords to strings in equality operators (=, not=), and membership operators (in, includes). This improves LLM ergonomics by allowing keywords generated by LLMs to match string data values without explicit conversion. - Add normalize_for_comparison helper to coerce non-boolean atoms to strings - Update safe_eq, safe_in, safe_includes to use coercion - Exclude booleans from coercion (true/false do not coerce to strings) - Add comprehensive tests covering keyword/string matching - Document coercion behavior in Section 7.1 of ptc-lisp-specification.md - Note that ordering comparisons (>, <, >=, <=) do NOT coerce 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
PR Review: Add keyword/string type coercion to where clause comparisons (#232)SummaryThis PR implements automatic coercion of keywords to strings in equality and membership operators, allowing LLM-generated keywords to match string data values. The implementation is clean, follows the issue specification exactly, and includes comprehensive tests. What's Good
Issues (Must Fix)None. Suggestions (Optional)
SecurityNo concerns. The coercion only applies to keywords (atoms), which are safe in the BEAM. The boolean guard prevents any unexpected behavior with DocumentationDocumentation updated appropriately in VerdictApprove - The implementation matches the issue specification exactly, tests are comprehensive, and documentation is updated. Clean, minimal change that solves the stated problem without over-engineering. |
Auto-Triage SummaryReview AnalysisThe PR review approved the changes with no must-fix issues. There was one optional suggestion about extracting test setup to reduce boilerplate. Decisions Made
Status
ConclusionNo action items. The PR is approved and ready to merge once CI passes. |
Summary
=,not=) and membership operators (in,includes)truematching"true"Implementation
normalize_for_comparison/1helper that coerces non-boolean atoms to their string representationsafe_eq/2,safe_in/2, andsafe_includes/2to use the coercion helper>,<,>=,<=) intentionally excluded from coercion (maintain strict type checking)Testing
inoperatorincludesoperatorDocumentation
Closes #232