Repository navigation
v0.5.0
This release upgrades the bundled libhegel engine from 0.14.14 to 0.32.5, rewriting the FFM
binding layer against the engine's modern typed-draw C ABI. It brings roughly two months of engine
correctness, shrinking, and performance improvements, plus several new features.
New features:
-
Stateful (model-based) testing. Annotate methods of a state-machine class with
@Ruleand
@Invariantand drive it withStateful.run(machine, tc); the engine picks which action runs
next, and failing action sequences shrink like any other generated value. APooltracks
previously generated values so rules can reuse or consume them.class StackMachine { private final Deque<Integer> stack = new ArrayDeque<>(); @Rule void push(TestCase tc) { stack.push(tc.draw(integers())); } @Rule void pop(TestCase tc) { tc.assume(!stack.isEmpty()); stack.pop(); } @Invariant void neverNegative(TestCase tc) { assertTrue(stack.size() >= 0); } } @HegelTest void stackBehaves(TestCase tc) { Stateful.run(new StackMachine(), tc); }
-
Failure reproduction blobs.
new Settings().printBlob(true)(or
@HegelTest(printBlob = true)) prints a copy-pasteable base64 blob with each reported failure;
reproduceFailure("<blob>")replays exactly that test case, bypassing generation and shrinking. -
Antithesis support.
new Settings().backend(Backend.URANDOM)sources every choice from
/dev/urandom, handing the Antithesis fuzzer control over the entire
test case. The default (Backend.AUTO) selects it automatically when running inside Antithesis. -
allowSubnormalonfloats()anddoubles(), for testing code that may run with
flush-to-zero floating point (e.g. compiled with-ffast-math). -
Bounded temporal generators.
dates(),times(), anddatetimes()accept inclusive
min/maxbounds, and bounded dates shrink toward 2000-01-01.domains()gains
maxLength(int). -
Engine output routing. Engine-emitted output (verbose progress, warnings) now flows through
the same stream as the failing-example report instead of always going to stderr.
Engine fixes picked up by the upgrade include: unbounded doubles() no longer returning
Double.MAX_VALUE most of the time, integer and string draws no longer being dominated by the
"interesting constants" pool, bounded values actually shrinking toward their target instead of 0,
regex anchors (\b, \B, $) respected in non-final positions, Unicode category filters covering
astral planes, several shrinker crashes and runaway-execution bugs, flaky tests reported as flaky
instead of under a wrong origin, and substantially more effective shrink passes.
This release also fixes derandomized seeds in CI. A derandomized run derives its seed from the
test's database key, which hegel-java previously sent only when the example database was enabled —
and CI disables the database. Every named test in a CI run therefore derandomized from the same
fallback key and saw the same inputs. Each named test now derives its seed from its own name, so
repeated runs of one test stay deterministic while different tests still see different inputs.
Breaking changes:
- Custom
Generatorimplementations must now implementdoDraw(TestCase); the CBOR schema
protocol (asBasic()/BasicGenerator) no longer exists, andTestCaseexposes typed draw
bridges instead ofgenerateFromSchema. Generators built purely fromGeneratorsfactories and
combinators are unaffected. text()andbinary()now default to a maximum size of 100 (orminSize + 100for larger
minimums) instead of unbounded, matching the other Hegel frontends; set an explicitmaxSizefor
longer values.- A generator configuration the engine rejects (an empty text alphabet, an invalid regex) now
throwsIllegalArgumentExceptioncarrying the engine's diagnostic instead ofHegelException,
and conflicting float bound/special-value combinations are rejected at construction time. reportMultipleFailures(true)aggregates only when several distinct bugs are found; a run that
finds a single bug now rethrows it directly (preserving its type and stack trace) instead of
wrapping it in a one-entry "Hegel found 1 failing example" report, matching the other Hegel
frontends.- The
com.upokecenter:cbordependency is gone.