Skip to content

fix(bench): refuse debug native builds before timing - #36

Merged
ahrzb merged 1 commit into
masterfrom
bench-refuse-debug-build
Jul 26, 2026
Merged

fix(bench): refuse debug native builds before timing#36
ahrzb merged 1 commit into
masterfrom
bench-refuse-debug-build

Conversation

@claude-agent-ahrzb

Copy link
Copy Markdown

Problem

tests/_native_guard.py rebuilds the cwd-local sql_transform/_interpreter.pyd via plain maturin develop (debug) whenever src/*.rs is newer. The cwd package shadows the venv release wheel, so any benchmarks/bench_serving.py 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 phantom-regression signature).

Fix

  • src/lib.rs: the extension exposes BUILD_PROFILE ("debug"/"release") from cfg!(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 as None and 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

  • Debug build → bench_serving: refusing to time a non-release native build (BUILD_PROFILE='debug', loaded from ...) / Rebuild with: uv run maturin develop --release, exit 1.
  • Release build → parity gate + normal timing run (spec 4.3µs @ n=1 on titanic, sane ratios).
  • mise run gate-specializer green: 129 cargo tests, 753 pytest.

🤖 Generated with Claude Code

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
ahrzb merged commit d2b2c41 into master Jul 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant