Pull to refresh
Logo
Lean audit of Clojure's core finds 17 unreported bugs

Lean audit of Clojure's core finds 17 unreported bugs

New Capabilities

A proof assistant plus differential testing turned up a reduce that never returns, a hash map that hides a key it holds, and a removeIf that depends on a type hint

Overview

Updated 41 minutes ago

Clojure 1.12.7 shipped on November 18, 2026. Six days later, a developer published 17 bugs in the language's core that appear nowhere in its issue tracker. Three break ordinary calls: a reduce that never returns, a hash map that contains a key but returns nil for it, and a removeIf whose result flips depending on a type hint.

The bugs were not in the persistent data structures that made Clojure's name. Those survived 3 million randomized operations against Java's collections without a mismatch. The defects sat in separate files, and where two mechanisms meet: hashing and equality, 32-bit integer arithmetic, reflection.

Why it matters

Clojure's collections have been in production for years. One developer with a proof assistant found 17 defects that ordinary testing never surfaced.

Questions about this story

Free account needed to ask — your question is kept and asked for you right after sign-up. Answers are public.

No questions yet — be the first to ask.

Key Indicators

17
Unreported bugs found
Bugs the author could not match to Clojure's JIRA or ask.clojure.org.
3,000,000
Hash map operations compared
1,500 operations across 2,000 seeds, run against java.util.HashMap with no mismatch.
65,505
Elements that hang reduce on vector-of
At this size the chunk mask wraps to zero and the seq's reduce loops forever.
12
Lower-impact bugs
Reproduced on 1.12.7 but with smaller practical effect than the main five.

Voices

Curated perspectives — historical figures and your fellow readers.

Sign up to generate historical perspectives on this story.

People Involved

Organizations Involved

Timeline

2010 November 2026

4 events Latest: Today
Tap a bar to jump to that date
  1. Audit published with 17 unreported bugs

    Today Publication

    Author reports no match in Clojure's JIRA or ask.clojure.org for any of the 17.

  2. Collision-node fix confirmed against a patched build

    Today Verification

    Changing one line to this.hash makes the hidden key findable again.

  3. Clojure 1.12.7 released

    Release

    The version the audit examines on JDK 21, five days before the report.

  4. The chunk mask enters gvec.clj

    Origin

    A commit adds internal-reduce with a 0xffe0 mask that clears bit 16 and above.

Scenarios

1

Clojure ships fixes for the reported bugs in a point release

Possible Resolves by May 31, 2027

Discussed by: The audit author, who reproduced each bug and drafted a patch for the collision node

Each finding has a small, testable cause. The chunk mask needs a different bound, the collision node needs this.hash, the drop path needs a subtraction instead of an addition. If maintainers take the reports, a 1.12.8 or 1.13 release could carry them within months. The author already compiled a patched PersistentHashMap and confirmed the fix on the example.

2

Maintainers file and confirm the reports in Clojure's JIRA

Likely Resolves by Feb 28, 2027

Discussed by: The audit author, who notes the searches for prior tickets are the basis for calling the bugs unreported

The author searched Clojure's JIRA through its REST API and ask.clojure.org by web search and the site's own search. Filing is the first step before any fix. Confirmation depends on someone else reproducing the hanging reduce at 65,505 elements or the dissoc that hides a key, both of which the post gives as runnable snippets.

3

A year passes with no ticket and no release note

Possible Resolves by Nov 24, 2027

Discussed by: No one yet; the report is a day old

Open-source backlogs absorb bug reports unevenly, and three of these defects need unusual inputs: a primitive vector past 65,505 elements, keys with identical hashes but different equality partners, or a reflective call to a functional interface. Bugs that require odd inputs can sit unfiled for years, which is what the author's search suggests already happened once.

Historical Context

3 moments from history that rhyme with this story — and how they unfolded.

2009

seL4 verified kernel (2009)

Researchers at NICTA in Australia finished a machine-checked proof that the C implementation of the seL4 microkernel behaves as its specification says. The kernel was small, roughly ten thousand lines, and the proof was many times larger.

Then

The proof was published and the kernel stayed a research system rather than a mass-market one.

Now

It became the standing example that verification of shipped code is possible, and it set the pattern of pairing a formal proof with conventional testing for the parts the proof cannot reach.

Why this matters now

The Clojure audit runs the same split: Lean for the small functions that reduce to bits, randomized comparison for the trees too large to model.

2009

CompCert verified C compiler (2009)

Xavier Leroy at INRIA released a compiler for a large subset of C, with a machine-checked proof that compiled code preserves the meaning of the source. The proof covered the compiler's passes, not the assembler or the preprocessor around them.

Then

The compiler found use in avionics and other safety-critical work where a miscompiled branch is expensive.

Now

It established that a proof covers exactly the boundary you draw, and that everything outside that boundary still needs testing.

Why this matters now

The Clojure report makes the same boundary explicit: Lean handled the arithmetic, and everything bigger went to differential testing.

2011

Csmith differential testing of compilers (2011)

Researchers generated random but well-defined C programs and compiled each with several compilers. Where the outputs disagreed, at least one compiler had a bug. The project turned up hundreds of defects in GCC and LLVM.

Then

Compiler teams received a steady supply of minimized bug reports.

Now

Differential testing became standard practice for any system with a reference implementation to compare against.

Why this matters now

The Clojure audit's hash map test is the same idea with a different reference: random operations applied to PersistentHashMap and java.util.HashMap, results compared.

Sources

(2)