Arithmetic and comparisons lowered to raw Chez ops, so an operand outside Chez's tower (BigDecimal) crashed with a raw condition, and Chez contagion leaked: (* 1.0 0) gave exact 0 where the JVM gives 0.0, (* ##Inf 0) gave 0 instead of ##NaN, (/ 1 0) raised an untyped error. One seam now (host/chez/seq.ss): call position emits jolt-n* macros with the both-Chez-numbers fast path open-coded; value position folds through the same binary ops. Anything outside the tower falls to per-op slow hooks that java/bigdec.ss extends, so bigdec arithmetic works in every position (the old static-only :bigdec typing limitation is gone). JVM rules patched into the fast path: a double operand wins, an exact zero divisor throws ArithmeticException while a double zero divisor yields Inf/NaN, quot/rem/mod cover ratios and doubles, min/max return the original operand with NaN winning, a nil operand is NPE and a non-number CCE, zero-arg -// throw ArityException at runtime instead of failing expansion. Also: with-precision now binds *math-context* and bigdec results round with real RoundingMode semantics (UNNECESSARY throws; division rounds to precision instead of throwing); rationalize goes through the shortest decimal print like BigDecimal.valueOf (the identity stub is gone); ratios coerce to bigdec like Numbers.toBigDecimal; min/max int-literal operands no longer coerce to flonum in the numeric pass. Perf neutral: fib and seq benches unchanged (the fast path is two type checks the optimizer folds); hinted fl/fx paths untouched. 19 JVM-certified corpus rows; cts baseline 5614->5730 pass, 192->88 errors, 84->79 baselined namespaces. |
||
|---|---|---|
| .. | ||
| certify.clj | ||
| known-divergences.edn | ||
| profile.edn | ||
| README.md | ||
| regen-corpus.clj | ||
| SPEC.md | ||
Conformance: certifying the corpus against reference Clojure
See SPEC.md for the full host-neutral language-spec contract: the corpus schema, conformance levels, the feature profile, and how to host jolt on a new runtime. This README covers the certification tooling specifically.
The corpus (test/chez/corpus.edn) is jolt's host-neutral behavioral suite — one
row per case: {:suite :label :expected :actual}, where :actual is a Clojure
source expression and :expected its result (or :throws). The runtime harness
(host/chez/run-corpus.ss, invoked by make corpus) replays it on Chez and
compares by value-equality.
Every :expected is sourced from reference JVM Clojure, so the corpus is both a
regression suite and a specification certified against Clojure rather than
against its authors' beliefs. This directory holds the certification tooling that
closes that gap.
What's here
-
certify.clj— runs every corpus row's:actualand:expectedthrough reference JVM Clojure (each in a freshusernamespace, output/stdin sunk, a 5s per-case watchdog) and compares with Clojure's=. It buckets each row:certified/certified-throws— jolt's:expectedmatches real Clojuredivergent— both evaluate but jolt's:expecteddisagrees with Clojurethrows-mismatch— jolt and Clojure disagree on whether it throwsjvm-error—:actualisn't runnable on vanilla Clojure (host-coupled / jolt-specific) — informational, not certifiableread-error/timeout— won't read on the JVM reader, or ran too long
-
known-divergences.edn— every current divergence, classified. Most are deliberate jolt-specific or host-model deltas (see:legend): the all-double numeric model, snapshot-heap concurrency, the no-JVM host model, jolt reader features, the jolt printer, intentional strictness. A few are genuine:bugentries with a tracked bead. These categories become the:featuresflags in conformance inc3.
make certify is the gate wrapper. It skips cleanly when clojure (JVM) is not
installed; otherwise it runs certify.clj and fails the build on a NEW
(unclassified) divergence or a stale allowlist entry. Flaky entries (JVM
result is timing-dependent, e.g. future-cancel) are tolerated either way.
Running
make certify # the gate wrapper (skips if clojure absent)
clojure -M test/conformance/certify.clj # gate directly (exit≠0 on new/stale)
clojure -M test/conformance/certify.clj test/chez/corpus.edn --edn /tmp/report.edn # full machine-readable report
Current state
Of ~2740 vanilla-certifiable rows, >2730 match reference Clojure exactly; the handful of divergences are all classified (deliberate deltas plus a few tracked bugs). The corpus is trustworthy as a spec, with the host-specific deltas made explicit rather than hidden.
Adding / changing cases
When you add corpus rows or change behavior, re-run the certifier. A NEW divergence
means either a real bug (file it, tag the allowlist entry :bug + :bead) or a
deliberate delta (classify it). A stale entry means a divergence was fixed — remove
it from known-divergences.edn.