Skip to content

v0.2.0 — correctness infrastructure

Choose a tag to compare

@s2x s2x released this 17 Aug 10:48
· 25 commits to main since this release

No API changes. This release is about knowing the existing code is correct rather than adding to it.

Supports liblbug 0.19.x.

Refuses to run against an unverified liblbug

Both connectors depend on liblbug's exact struct layout — lbug_system_config is passed by value and Cdef spells out its fields one by one — and liblbug is pre-1.0, so a minor release may rearrange them. Nothing about that failure is loud: lbug_database_init() would read a config struct that means something else.

check on mismatch
FFI constructor IncompatibleLibraryException
extension MINIT module does not load

LADYBUG_ALLOW_ANY_LIBRARY=1 downgrades both to a warning for development. phpinfo() now reports the supported series, the built-against version and liblbug's storage version.

AddressSanitizer

make ext-asan && make test-asan runs the integration suite against a poisoned heap. Verified not to be decorative: a deliberate one-byte overflow in MINIT is reported with a symbolised stack.

The CI job runs on macOS. On Linux PHP dlopens every extension with RTLD_DEEPBIND, which the sanitizer runtime refuses to run alongside — including the extension under test.

Leak detection

memory_get_usage() cannot see a stranded lbug_database. MemoryTest watches resident memory over four workloads instead. Also verified against a deliberate leak: disabling closeResult() reports 513 KB per iteration.

Benchmarks

make bench runs both backends in one process. On an M4 Pro, PHP 8.5:

scenario ext ffi ratio
fetch scalars 1,056,357/s 164,399/s 6.4x
fetch nodes 411,958/s 73,117/s 5.6x
fetch temporal 513,081/s 169,262/s 3.0x
insert prepared 10,556/s 10,753/s 1.0x
tiny queries 7,469/s 7,551/s 1.0x

The gap is entirely in value conversion. Writes and per-query overhead are bound by liblbug itself, so a write-heavy workload gains nothing from compiling the extension.

Also

  • coverage measured on both backends and merged by unioning covered lines, gated in CI (78.7%)
  • CHANGELOG.md, CONTRIBUTING.md, issue templates
  • fixed: switching between plain, static and instrumented extension builds now forces a rebuild

Full notes in CHANGELOG.md.