fix(bench): refuse debug native builds before timing - #36
Merged
Conversation
tests/_native_guard.py rebuilds the cwd-local _interpreter.pyd via plain `maturin develop` (debug) whenever src/*.rs is newer; the cwd package shadows the venv release wheel, so a bench run after a Rust edit + pytest silently timed a DEBUG engine -- engine rows inflated ~5x while python/duckdb rows stayed sane (measured 2026-07-26). The extension now exposes BUILD_PROFILE from cfg!(debug_assertions); bench_serving exits with a rebuild hint unless it reads release, and the native guard's rebuild message names the profile it builds. Verified: debug build -> clear refusal (exit 1); release build -> normal run; mise run gate-specializer green (129 cargo + 753 pytest). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
ahrzb
approved these changes
Jul 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
tests/_native_guard.pyrebuilds the cwd-localsql_transform/_interpreter.pydvia plainmaturin develop(debug) wheneversrc/*.rsis newer. The cwd package shadows the venv release wheel, so anybenchmarks/bench_serving.pyrun after a Rust edit + pytest silently timed a debug engine — engine rows inflated ~5x while python/duckdb rows stayed sane (measured 2026-07-26; the phantom-regression signature).Fix
src/lib.rs: the extension exposesBUILD_PROFILE("debug"/"release") fromcfg!(debug_assertions).benchmarks/bench_serving.py:refuse_debug_build()runs before anything else and exits with a rebuild hint unless the loaded module reports"release"(a pre-attr build reads asNoneand is refused too, naming the loaded path).tests/_native_guard.py: the rebuild message now says it builds the DEBUG profile and that benches will refuse it.Verified
bench_serving: refusing to time a non-release native build (BUILD_PROFILE='debug', loaded from ...) / Rebuild with: uv run maturin develop --release, exit 1.mise run gate-specializergreen: 129 cargo tests, 753 pytest.🤖 Generated with Claude Code