fix: Resolve remaining Clojure conformance test failures#250
fix: Resolve remaining Clojure conformance test failures#250andreasronge merged 2 commits intomainfrom
Conversation
Add infrastructure to validate that PTC-Lisp programs are valid Clojure and that the interpreter behaves identically to real Clojure. Key additions: - ClojureValidator module for syntax validation and execution via Babashka - Mix task `mix ptc.install_babashka` to download and install Babashka - Test helpers for Clojure conformance assertions - Clojure conformance tests in runtime_test.exs (~44 tests) - Syntax validation tests in integration_test.exs (~19 tests) - Demo test runner --validate-clojure flag for LLM-generated programs Tests are tagged with :clojure and run by default if Babashka is installed. Skip with: mix test --exclude clojure Known semantic differences documented in guide.md: - (or false false) returns nil vs false in Clojure - (some pred coll) returns false vs nil when no match - filter/map return vectors in PTC-Lisp vs lazy seqs in Clojure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3058289 to
d4dfb29
Compare
PR Review: fix: Resolve remaining Clojure conformance test failuresSummaryThis PR adds comprehensive Babashka-based Clojure validation infrastructure and fixes four Clojure conformance issues (EDN parsing, variadic multiplication, variadic division, and 2-arity reduce). The implementation is well-structured with proper test infrastructure for ongoing Clojure compatibility verification. What's Good
Issues (Must Fix)None identified. The code changes are well-implemented and follow existing patterns. Suggestions (Optional)
SecurityNo concerns. The Babashka installer downloads from official GitHub releases and the validator executes user-provided Lisp programs in a subprocess, which is appropriate for test-time validation. DocumentationAppropriate updates made:
VerdictApprove - The implementation is clean, well-tested, and follows project conventions. The file size concerns are minor and can be addressed in a follow-up PR. |
Auto-Triage SummaryDecisions Made
RationaleIssue #1 - File size concern (DEFER_ISSUE)
Issue #2 - Demo reports (IGNORE)
Status
The PR has been approved with no blocking issues. All suggestions have been appropriately triaged. |
Fix multiple issues causing Clojure conformance tests to fail: **ClojureValidator EDN parsing (12 test failures)** - Add support for parsing Clojure lists `(1 2 3)` in addition to vectors - Use `read-string` to safely parse EDN output before JSON conversion - This prevents lists from being interpreted as function calls **Variadic multiplication `(* 5)` (1 failure)** - Fix single-argument handler to return the value for all variadic ops - Previously only `-` (negation) was handled, others returned error **Variadic division `(/ 100 5 2)` (1 failure)** - Change division from `:normal` (binary only) to `:variadic_nonempty` - Now correctly reduces left-to-right: 100 / 5 / 2 = 10 **2-arity reduce `(reduce + [1 2 3])` (1 failure)** - Add `reduce/2` that uses first element as initial value - Change binding to `:multi_arity` to support both 2 and 3 args **Exclude Clojure tests in CI** - Add `--exclude clojure` to CI test command since Babashka not installed - Remove setup blocks from test files (not needed with tag exclusion) - Clojure tests require local Babashka installation via `mix ptc.install_babashka` All 63 Clojure conformance tests pass locally with Babashka installed. Closes #245 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
d4dfb29 to
24605cb
Compare
PR Review: fix: Resolve remaining Clojure conformance test failuresSummaryThis PR fixes 15 remaining Clojure conformance test failures by addressing four issues: EDN parsing for lists in ClojureValidator, variadic multiplication with single argument, variadic division left-to-right reduction, and 2-arity reduce support. The implementation is clean and well-tested. What's Good
Issues (Must Fix)None identified. The code changes are well-implemented and follow existing patterns. Suggestions (Optional)
SecurityNo concerns. The Babashka validator executes Clojure code in a subprocess with a timeout, which is appropriate for test-time validation. The installer downloads from official GitHub releases. Documentation
VerdictApprove - The implementation is clean, follows project conventions, and correctly fixes the Clojure conformance test failures. All tests pass. The file size concern is tracked in issue #251 and is not blocking. |
Auto-Triage Summary (Cycle 2)Review AnalysisAnalyzed two review comments from github-actions bot. Both reviews provide APPROVE verdicts with only optional suggestions. Decisions Made
RationaleIssue #1 - File size (ALREADY_TRACKED)
Issue #2 - Demo reports (IGNORE)
Status
Conclusion: The previous triage handled all review suggestions appropriately. No additional fixes or issues needed. The PR is ready for merge once all checks pass. |
Summary
Fix multiple issues causing 15 Clojure conformance tests to fail after the initial Clojure validation implementation.
Changes
ClojureValidator EDN parsing (fixed 12 test failures)
(1 2 3)inparse_simple_ednread-stringto safely parse EDN output before JSON conversion inparse_edn_output(2 4)from being interpreted as function calls when converting to JSONVariadic multiplication
(* 5)(fixed 1 failure)apply_funto return the value for all variadic ops-(negation) was handled correctly, others returned{:error, {:not_callable, ...}}Variadic division
(/ 100 5 2)(fixed 1 failure):normal(binary only) to:variadic_nonemptyin env.ex(/ 100 5 2)= 100 / 5 / 2 = 102-arity reduce
(reduce + [1 2 3])(fixed 1 failure)reduce/2in runtime.ex that uses first element as initial value:multi_arityto support both 2 and 3 argument formsTest plan
All 63 Clojure conformance tests now pass:
Full test suite also passes:
Closes #245
🤖 Generated with Claude Code