Skip to content

test(phel): mark lenient core-fn divergences (suite green under Phel)#20

Merged
Chemaclass merged 3 commits into
mainfrom
test/phel-divergences-batch
May 29, 2026
Merged

test(phel): mark lenient core-fn divergences (suite green under Phel)#20
Chemaclass merged 3 commits into
mainfrom
test/phel-divergences-batch

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

What

Adds :phel reader-conditional branches across 71 core-test namespaces so the suite runs 0 failures under Phel (was 209).

Phel is intentionally lenient where Clojure throws on bad-type input (nil-punning DX): predicates, arithmetic, and collection fns return a value (nil/false/0/identity) or coerce the argument instead of throwing. Each :phel branch asserts Phel's actual behavior, with a ;; comment documenting the divergence, mirroring the existing :cljs/:lpy/:cljr stance and the prior parse-* / string-strict divergence commits (#16, #18).

Other dialects' branches (:default/:clj/:cljs/:lpy/:cljr) are untouched — every restructured assertion keeps its original form under :default.

Categories marked

  • Throw -> lenient return: key/val/keys/vals/peek/empty?/not-empty/realized?/min-key/select-keys/descendants/contains? return nil/false instead of throwing.
  • Numeric coercion / IEEE-754: even?/odd?/zero?/pos?/neg?/</<=/>/>=/quot/rem/mod/min/max coerce nil->0 or follow PHP/IEEE float semantics.
  • 64-bit ints: +/-/*///int/long/byte silently promote on overflow (no BigInt throw).
  • char-as-string: \a is a 1-char string, so map/count/reverse/fnext/ffirst/set/last treat it as seqable.
  • transient leniency: persistent ops on transients and *! after persistent! don't throw.
  • stale marker dropped: repeatedly mid-failure now matches :default.

Phel-side follow-up (flagged, non-blocking)

Marked :phel to keep the suite green, but worth deciding whether Phel should tighten:

  • case with no matching clause and no default returns nil instead of erroring.
  • transient/persistent boundary not enforced (persistent ops mutate transients silently).
  • Some bad-input paths throw but leak raw PHP messages (SequenceGenerator::toIterable(), is_nan() deprecation) rather than clean Phel errors.

Result

Passed: 5473
Failed: 0
Error: 0

Phel is intentionally lenient where Clojure throws on bad-type input
(nil-punning DX): predicates/arith/collection fns return a value
(nil/false/0/identity) or coerce instead of throwing. Add :phel reader
conditional branches asserting Phel's actual behavior, mirroring the
existing :cljs/:lpy/:cljr stance and the parse-*/string divergence
commits. Other dialects' branches are untouched.

Also drop a stale :phel marker in repeatedly (Phel now matches :default
for mid-failure side effects).

Brings the phel run of the suite to 0 failures.
@Chemaclass Chemaclass self-assigned this May 29, 2026
Follow-up to the lenient-divergence batch, paired with phel-lang's
transient/persistent! fix:

- assoc!/conj!/dissoc!/disj!/pop! after persistent!, and persistent! twice,
  now throw in Phel, so drop the lenient :phel markers in the *_bang tests
  and let the :default (throws) assertions run.
- conj_bang: drop the stale :phel [] skip for 'cannot conj! after persistent!'.

case stays lenient (returns nil on no-match without default) because Phel's
own test runner and core rely on it; that :phel marker is kept.
phel-lang#2228 (merged to main after this batch was triaged) makes the
ordered comparisons and the predicates/fns built on them reject nil:
- <, <=, >, >=: drop the lenient :phel markers; phel now matches :default (throws)
- neg?, pos?: nil throws (matches :lpy); false/true still coerce
- min, max: nil throws (matches :lpy); strings still compare lexicographically
@Chemaclass Chemaclass merged commit 7d3db18 into main May 29, 2026
4 checks passed
@Chemaclass Chemaclass deleted the test/phel-divergences-batch branch May 29, 2026 20:37
Chemaclass added a commit to phel-lang/phel-lang that referenced this pull request May 29, 2026
The suite now runs 0 failures against main (#2229 fixed the real
bugs; phel-lang/clojure-test-suite#20 marked the intentional :phel
divergences), so drop the soft-gate:

- add a pull_request trigger so the job reports on PRs
- remove continue-on-error (failures now fail the job)
- pin the suite checkout to the merged suite SHA (7d3db18b) for reproducible
  PR/push runs; the nightly cron keeps tracking main to surface upstream drift

Relates to #2223.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant