Skip to content

Commit 70a58eb

Browse files
committed
fix: report SQL test planning panics as native compiler errors
1 parent 8bbac27 commit 70a58eb

2 files changed

Lines changed: 12 additions & 9 deletions

File tree

‎crates/sqlbuild-python/src/bindings/_helpers/planner_entries/test_planning.rs‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use pyo3::sync::PyOnceLock;
1313
use pyo3::types::PyDict;
1414
use pyo3::{pyclass, pyfunction, pymethods, wrap_pyfunction};
1515

16+
use crate::bindings::_helpers::boundary::panics::compiler_guard;
1617
use crate::bindings::_helpers::compile_driver::python_calls::{
1718
KeywordArguments, call_with, imported,
1819
};
@@ -159,15 +160,17 @@ pub(crate) struct PlanningRequest {
159160
pub(crate) sql_test_selection: Py<PyAny>,
160161
}
161162

162-
/// Plan the request's selected SQL tests.
163+
/// Plan the request's selected SQL tests, reporting a panic as a native compiler error.
163164
fn plan(py: Python<'_>, request: &PlanningRequest) -> Planned {
164-
plan_selected_sql_tests(
165-
request.project.bind(py),
166-
request.adapter.bind(py),
167-
request.selected_keys.bind(py),
168-
request.sql_test_selection.bind(py),
169-
)
170-
.map(Bound::unbind)
165+
compiler_guard(|| {
166+
plan_selected_sql_tests(
167+
request.project.bind(py),
168+
request.adapter.bind(py),
169+
request.selected_keys.bind(py),
170+
request.sql_test_selection.bind(py),
171+
)
172+
.map(Bound::unbind)
173+
})
171174
}
172175

173176
/// Plan on a native thread when `enabled`, or resolve at once to no planned tests.

‎python-boundary.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ note = "Shape rule: data exceptions only (SqlValueRenderingError), no logic; con
745745
[[stays]]
746746
path = "compiler/compile/types.py"
747747
rule = 1
748-
note = "Shape rule: typing protocols, enums and aliases only (CompiledProjectView, CompiledModelView, CompiledResourceType, AuditInput, ...), no logic; consumed by executor/pipeline/_helpers/testing.py, executor/scenario/_helpers/local/execution.py and project audit factories that annotate AuditInput."
748+
note = "Shape rule: typing protocols, enums and aliases only (CompiledProjectView, CompiledModelView, AuditInput, ...), no logic; consumed by executor/pipeline/_helpers/testing.py, executor/scenario/_helpers/local/execution.py and project audit factories that annotate AuditInput."
749749

750750
[[stays]]
751751
path = "rule_engine/types.py"

0 commit comments

Comments
 (0)