Skip to content

v1.2.2

Choose a tag to compare

@kidoz kidoz released this 05 Sep 21:05
· 155 commits to main since this release

structguru v1.2.2

A dependency release. The native sampling filter now draws its per-record random number from fastrand instead of rand, which removes seven transitive crates from the wheel build — among them the yanked chacha20 release that blocked the first 1.2.1 publish. Sampling behavior, the public API, and the wheel matrix are unchanged. No breaking changes; upgrade in place from any v1.x.

Dependencies

  • The sampling filter uses fastrand instead of rand. The filter needs one uniform f64 in [0, 1) per record, drawn on the calling thread. It got that from rand::random, which routes through rand's ChaCha-based thread RNG — a cryptographically secure generator, with chacha20, rand_core, getrandom, cpufeatures, cfg-if, and r-efi behind it, for a sampling decision that never needed unpredictability. fastrand::f64() gives the same half-open draw from a per-thread WyRand generator seeded from the clock and thread id, and the crate has no dependencies on any wheel target.

    # before: rand 0.10  (+ rand_core, chacha20, getrandom, cpufeatures, cfg-if, r-efi)
    # after:  fastrand 2.5

    Cargo.lock shrinks from 44 packages to 38, and the release audit no longer depends on the RustSec status of a cryptographic crate the filter never used. The sampling tests — rate zero drops everything, rate one keeps everything, rate one half stays within its statistical bound — pass unchanged against the new generator. sample_rate semantics, the drop counters, and the sample_max_level gate are untouched.

Context

  • Why a point release for a dependency swap. The first 1.2.1 tag failed the release audit because chacha20 0.10.1 had been yanked after the lockfile was generated; the tag was moved to a commit with the updated lock before anything reached PyPI. Removing the crate entirely, rather than tracking its releases, closes that class of interruption for the sampling path. fastrand is maintained under the smol-rs organization, forbids unsafe code, is dual-licensed MIT/Apache-2.0, and is the generator tempfile itself relies on.