Skip to content

Releases

libhegel 0.53.3 binaries

Choose a tag to compare

@github-actions github-actions released this 02 Dec 03:04
2fb798f

SwiftPM binary targets for libhegel 0.53.3, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.3.

0.53.0

Choose a tag to compare

@velocityzen velocityzen released this 22 Nov 03:21
13ac165

✨ New Features

  • Time zones and zoned datetimes: .zonedDateTime draws a zone, a wall-clock time in it
    and, when the clocks repeated that time, which of the two instants it means. Draws aim at the
    zone's transitions, so skipped and repeated wall times turn up in a short run:

    let meetings = Gen.zonedDateTime(zone: "America/New_York", allowImaginary: false)
    
    try Property.check { tc in
        let start = try tc.draw(meetings, named: "start")
        #expect(start.kind != .gap)
    }

    Draw in one named zone, in zones your own generator picks, or in zones from
    .zone(from: Zones(...)), which draws IANA names. Link names are included by default; legacy
    names, Etc/Unknown and names only your own database knows are drawn when you ask. Bound the
    draws by wall clock or by instant, leave out skipped times with allowImaginary: false, and
    pick which instant of a repeated time you get with ambiguous:.

  • Zone sources: Zones resolve against the IANA database bundled in libhegel (2026e, see
    tzdbVersion). To test against another database, build a ZoneSource from TZif files, zone
    data given as transitions and a yearly rule, an offset oracle, links, or a loader that
    supplies each name the first time a draw needs it. Pass it in Zones(source:), or make it the
    default with ZoneSource.setDefault(_:). A source also answers queries outside a test:
    resolve(_:in:), offset(in:at:), info(for:), zone(named:) and names.

  • Foundation's time zones as a zone source: ZoneSource.foundation reads the time zone
    database Foundation uses on the platform under test, so zoned datetimes drawn or resolved
    against it agree with TimeZone and Calendar there:

    let meetings = Gen.zonedDateTime(zones: Zones(source: .foundation))

    It holds every tz name Foundation knows (598 on macOS 26 and on Linux), loads each zone the
    first time a draw needs it, and reports Foundation's tz data version as its version. Names
    Foundation reads its own way, such as GMT+1 and PST, are left out. On Linux and Windows,
    Hegel now links FoundationInternationalization, which Foundation needs for named zones.

  • Instants, offsets, durations and spans: Timestamp is an instant to the nanosecond,
    UTCOffset a known offset in seconds or an unknown one, and CalendarSpan an amount in
    units from years to nanoseconds. Each has a generator: .timestamp(in:precision:),
    .utcOffset(in:granularity:allowUnknown:) and .calendarSpan(_:sign:).
    .duration(in:precision:) draws Swift's own Duration.

  • Weekdays, months and precision: .calendarDate(in:weekdays:months:) draws only the
    weekdays and months you list. precision: on the time, datetime, timestamp, duration and
    zoned datetime generators, and on .date, draws whole units: .seconds draws no fraction,
    and .hours draws on the hour. Weekday and Month are new enums, and
    CalendarDate.weekday tells you the day of the week.

  • Foundation bridges: Hegel's time values meet Foundation's at the instant:

    let instant = Timestamp(date)                         // and back: instant.date
    let local = LocalDateTime(date, in: .current)         // its wall-clock time in a zone
    let timeZone = TimeZone(zone)                         // nil outside the tz database
    let fixed = TimeZone(UTCOffset.known(seconds: 3600))  // nil if unknown or past ±18 hours

    No conversion goes through a Calendar, whose Gregorian calendar turns Julian before
    1582-10-15, so dates before then keep the proleptic Gregorian calendar. TimeZone(zone)
    takes only tz database names, so Foundation's own readings of names such as GMT+1 (an hour
    east, where POSIX puts it west) and PST never stand in for a zone.

  • Settings.projectDirectory: The directory the default database, .hegel/examples/, and
    a relative database path resolve against, instead of the current directory. .hegel sets it
    to the test's package. Without Swift Testing, pass it to Property.run, and set
    HEGEL_CONFIG to the hegel.toml to read.

🔧 Improvements

  • libhegel 0.53.1: Updated the bundled libhegel to 0.53.1, which adds the time APIs above.
    About one date or time draw in twenty now aims at a value that breaks code: a bound, a leap
    day, the Unix epoch, the 32-bit limits, or a time zone transition. Between steps, a state
    machine checks an invariant without everyStep with a probability of at least 1% at each
    step, not just one over its number of steps. A machine with more than 100 steps, as under
    Antithesis, used to almost never check it.
  • Time values print as every Hegel frontend prints them: dates, times, timestamps, offsets,
    spans and zoned datetimes print the engine's canonical ISO 8601, RFC 3339 and RFC 9557 text,
    so a counterexample reads the same whichever language found it.
  • Time generators check their arguments when they are built: bounds that hold no whole
    value at the precision, or an empty set of weekdays or months, are reported as a usage error
    at the generator's first draw, with the engine's reason.

⚠️ Behaviour Changes

  • Dates span years ±999,999 by default: CalendarDate.min and .max, and so the default
    ranges of .calendarDate() and .localDateTime(), now run from year -999,999 to 999,999
    instead of 1 to 9999. Years outside 0 to 9999 print in ISO 8601's expanded form:
    +010000-01-01, -000001-12-31. To keep the old range, pass it:

    Gen.calendarDate(in: CalendarDate(year: 1, month: 1, day: 1)...CalendarDate(year: 9999, month: 12, day: 31))

    .date() still draws Foundation dates in years 1 to 9999.

  • HegelError has a new case, .cancelled: Property.run and Property.check throw it
    when the task running them is cancelled; property turns it into CancellationError. A
    switch over HegelError with no default needs a case for it.

🐛 Fixes

  • .date() no longer draws 10000-01-01: At nanosecond precision, the last instant of year
    9999 rounds up to year 10000 when stored as a Date. The default range now ends at
    9999-12-31T23:59:59.999Z, and every draw is clamped to its range, so rounding never takes a
    Date past a bound.
  • Parameterized tests keep each test case's failures apart: In
    @Test(.hegel, arguments: [...]), every argument shared one failure-database entry. An
    argument that passed replayed another's saved counterexample, passed it, and deleted it, so
    the failing argument lost its replay; .hegel(reproducing:) failed the other arguments with
    "did not reproduce". Each test case now has its own entry, and a test without arguments keeps
    its old one, so saved failures still replay. The reproduce hint names the failing test case,
    .hegel(reproducing: "...", arguments: "mode: .fast"), and only that test case replays the
    blob.
  • A cancelled test stops its property run: When Swift Testing cancels a test, as
    .timeLimit does, the run used to keep generating cases. An async body that saw the
    cancellation threw CancellationError, which Hegel shrank, reported as a counterexample and
    saved, so the next run replayed it first. Now the run stops after the test case in flight,
    nothing is shrunk, reported or saved for it, and property throws CancellationError, so
    Swift Testing reports only the time limit. This covers explicit examples, generation,
    shrinking and .hegel(reproducing:) replays, for synchronous and async bodies.
  • Synchronous properties no longer starve async ones: A synchronous property holds its
    thread for its whole run. .hegel ran tests on Swift's cooperative pool, one thread per core,
    so synchronous properties running in parallel could hold every thread, and async properties
    and Swift Testing's own reporting waited until one ended. With 32 synchronous properties on
    16 cores, an async property waited 7.5 s between two test cases, long enough for the TooSlow
    health check to fail it. .hegel now runs its tests on threads of Hegel's own, as many as
    the machine has cores, and an async property hands its test cases back to the cooperative
    pool: the same property's longest wait is now 3.9 ms. A test that sets its own task executor
    preference keeps it, so a workaround such as a NIO thread pool still works and can go. The
    rest of an async test, outside property, runs on Hegel's threads and can still wait for
    one.
  • Xcode runs use the package's hegel.toml and failure database: The engine finds both
    from the current directory. swift test runs a package's tests from its root, but Xcode and
    xcodebuild test start them elsewhere, such as /private/tmp. A test that named a
    hegel.toml profile failed with "unknown settings profile", the file's default entry and
    overrides of development and ci were silently ignored, and failures were saved where
    swift test never looked. .hegel now finds both from the test's package, the nearest
    directory above the test's file that holds a Package.swift:
    • Before any test runs, it points HEGEL_CONFIG at the package's hegel.toml when the
      engine wouldn't find it from the current directory. A HEGEL_CONFIG you set stays as it
      is.
    • The default database and a relative database path resolve against the package. A disabled
      database or an absolute path stays as it is.
    • The engine reads one hegel.toml per test process, so when one process runs the tests of
      packages with different hegel.toml files, the first package's applies. .hegel records a
      warning that names a package's hegel.toml when it doesn't apply, and says why.
  • Stall limits no longer count the time a task waits to start: withStallDetection(after:)
    and withRandomCancellation(stallsAfter:) started their clock before the body's task was
    scheduled. With every thread busy, as when many tests run in parallel under xcodebuild test,
    a body...
Read more

libhegel 0.53.2 binaries

Choose a tag to compare

@github-actions github-actions released this 24 Nov 18:01
13ac165

SwiftPM binary targets for libhegel 0.53.2, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.2.

libhegel 0.53.1 binaries

Choose a tag to compare

@github-actions github-actions released this 21 Nov 14:50
cbe60bc

SwiftPM binary targets for libhegel 0.53.1, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.1.

0.52.0

Choose a tag to compare

@velocityzen velocityzen released this 18 Nov 16:55
00626c6

✨ New Features

  • Verbose runs stream each test case: With verbosity: .verbose, every test case's draws
    and notes are now printed as it runs, and a concurrent state machine's round by round. Each
    failing case is followed by one line that says what failed. For a property in Swift Testing,
    that's the failed expectation, led by its location:

    let n = 10
    MyTests/SortTests.swift:12:9: Expectation failed: n < 10 (error)
    

    Otherwise it's the error's type and the first line of its message, followed by … when the
    message goes on. .debug prints each failing case's whole error instead. An output:
    handler receives these lines too. It can now be called from a concurrent worker's thread,
    not only the one that runs the property.

🔧 Improvements

  • libhegel 0.52.0: Updated the bundled libhegel to 0.52.0. The engine now prints each test
    case's output itself, as soon as it can no longer change, instead of keeping all of it in
    memory until the test case ends. Since 0.51.6 it also frees the empty output regions that
    worker rounds and rule steps open. Together, these keep the memory of a long-running test
    case, such as a ConcurrentStateMachine or concurrently workload under Antithesis, flat at
    every verbosity.

    Failure reports are unchanged: the shrunk example's draws and notes, its error, and how to
    reproduce it. A quiet run still prints nothing, and its report still has no draws. No code
    changes are needed.

libhegel 0.53.0 binaries

Choose a tag to compare

@github-actions github-actions released this 20 Nov 16:12
00626c6

SwiftPM binary targets for libhegel 0.53.0, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.53.0.

0.51.9

Choose a tag to compare

@velocityzen velocityzen released this 17 Nov 17:32
59212ee

🔧 Improvements

  • libhegel 0.51.6: Updated the bundled libhegel to 0.51.6. Long-running concurrent state
    machines no longer use more and more memory as they run. Every worker round and every rule
    step opens an output region, and the engine used to keep each one until the test case ended,
    even when nothing was printed into it. Now an empty region is freed as soon as its last
    handle is released. A ConcurrentStateMachine or concurrently workload that runs for a
    long time inside one test case, such as under Antithesis, keeps a flat memory footprint.
    Regions that do hold output are still kept until the test case ends, so a verbose
    long-running case still grows with what it prints.

    The API is unchanged, and no code changes are needed.

libhegel 0.52.0 binaries

Choose a tag to compare

@github-actions github-actions released this 18 Nov 16:34
59212ee

SwiftPM binary targets for libhegel 0.52.0, repackaged from https://github.com/hegeldev/hegel/releases/tag/libhegel/0.52.0.

0.51.8

Choose a tag to compare

@velocityzen velocityzen released this 14 Nov 13:06
019e7d3

✨ New Features

  • reachingAfter: reach claims for states only deep runs reach: Some states are too rare
    for a short run to hit reliably but show up dependably in a deep one. List them in
    reachingAfter, each label mapped to the number of passing generated cases a run needs
    before the claim is checked:

    try property(
        reaching: ["ends inside a body"],
        reachingAfter: ["ends on a frame boundary": 1_000]
    ) { tc in ... }

    The run counts its own passing cases, so the claim follows the real depth however it was
    set: a hegel.toml profile, the test's own testCases, HEGEL_TEST_CASES or
    HEGEL_TEST_CASES_SCALE. Suites no longer need to guess a run's depth from HEGEL_*
    environment variables, a guess that missed most of those sources. A short run skips the
    claim, and a run that reaches the threshold without seeing the state fails just like a
    reaching claim. It works with property(...) in Swift Testing and with Property.run,
    which throws HegelError.unreached. reaching: is unchanged, so existing callers keep
    compiling.

📖 Documentation

  • The README, the hegel-property-testing skill and its oracles reference now explain when to
    use reachingAfter and warn against guessing a run's depth from HEGEL_* variables.

0.51.7

Choose a tag to compare

@velocityzen velocityzen released this 14 Nov 02:51
f677a9c

✨ New Features

  • HEGEL_TEST_CASES_SCALE: Run every property deeper without losing the relative cost of
    each. The scale multiplies the count each property resolves to, its own testCases or the
    profile's, so with HEGEL_TEST_CASES_SCALE=50 a 200-case property runs 10,000 cases and an
    expensive state machine's 20 becomes 1,000. Any positive number works (0.1 for a quick
    pass). Counts round up, never drop below 1, and saturate instead of overflowing. An explicit
    HEGEL_TEST_CASES still wins outright, and a malformed value is reported as a usage error.

    # a scheduled deep run: fresh inputs, every property 50 times deeper
    HEGEL_DEFAULT_PROFILE=nightly HEGEL_TEST_CASES_SCALE=50 swift test

📖 Documentation

  • Profile test_cases precedence is now documented: a property's own testCases wins over
    a hegel.toml profile's test_cases, so a profile's count applies only to properties that
    don't set one. In a suite where every property sets its count, a nightly profile that only
    raises test_cases changes nothing. The README, the Settings docs and the
    hegel-property-testing skill now say so, and their nightly examples put the depth in
    HEGEL_TEST_CASES_SCALE instead of the profile.