From e92f46e540c7189872e044519c65a865171c9bd8 Mon Sep 17 00:00:00 2001 From: Kevin Longe <273747162+kvlonge@users.noreply.github.com> Date: Thu, 22 Oct 2026 12:20:38 +0100 Subject: [PATCH] chore: remove dead native bindings, stub entries, Rust items and test helpers Remove 33 native functions that no Python or Rust code calls besides their registration, the stub entries no Python code names (keeping every class a kept entry annotates), public Rust constants, methods and wrappers nothing uses, unused test helpers and a dead test helper package, nine workflow path filters that match deleted directories, and the unused `rich` runtime dependency. Add `make check-native-stub`, part of `make check-ci`: the stub may declare only functions, classes and constants the extension registers; protocols, typed dicts, type aliases and private stub-only classes are typing-only and exempt. --- .github/workflows/verify.yml | 8 +- Makefile | 8 +- .../src/compiled_project/models.rs | 10 - .../src/command_connection/constants.rs | 1 - crates/sqlbuild-core/src/dbt_cli/constants.rs | 7 - .../src/diagnostic_routing/constants.rs | 1 - .../src/event_export/constants.rs | 1 - crates/sqlbuild-core/src/text/models.rs | 41 - .../sqlbuild-core/src/text/tests/test_text.rs | 37 +- .../src/text/tests/test_types.rs | 7 - .../src/bindings/_helpers/analysis/queries.rs | 25 - .../bindings/_helpers/dbt_events/stream.rs | 9 - .../bindings/_helpers/discovery/snapshot.rs | 11 +- .../src/bindings/_helpers/graph/views.rs | 7 - .../model_config/column_migrations.rs | 30 +- .../_helpers/model_config/registration.rs | 5 +- .../bindings/_helpers/plan_output/display.rs | 9 - .../bindings/_helpers/plan_output/safety.rs | 7 - .../_helpers/planner_entries/model_entries.rs | 18 - .../_helpers/planner_entries/plan_output.rs | 12 - .../planner_resolution/cursor_policies.rs | 11 - .../_helpers/planner_selection/selectors.rs | 11 +- .../_helpers/planner_strategy/microbatches.rs | 19 +- .../_helpers/rules/builtin_catalogue.rs | 16 +- .../_helpers/rules/fixture_formatting.rs | 9 - .../src/bindings/_helpers/rules/lint.rs | 28 +- .../src/bindings/_helpers/rules/lint_text.rs | 16 - .../bindings/_helpers/rules/registration.rs | 8 +- .../src/bindings/_helpers/rules/results.rs | 67 +- .../src/bindings/_helpers/rules/rule_cache.rs | 60 +- .../bindings/_helpers/rules/rules_config.rs | 12 - .../_helpers/scopes/relationship_names.rs | 55 +- .../_helpers/semantic_shapes/shapes.rs | 10 - .../_helpers/sqltext/model_headers.rs | 32 - .../state_rows/migration_projections.rs | 10 - .../sqlbuild-recall/src/records/constants.rs | 5 - .../src/writer/_helpers/session.rs | 8 - .../sqlbuild-recall/src/writer/constants.rs | 2 - .../src/refactoring/constants.rs | 2 - .../src/refactoring/models.rs | 5 - .../src/lint_text/_helpers/sql_diagnostics.rs | 11 +- .../lint_text/main/interpolation_text_at.rs | 11 - .../sqlbuild-rules/src/lint_text/main/mod.rs | 2 - .../lint_text/main/simplify_fixture_nulls.rs | 9 - .../tests/test_fixture_formatting.rs | 2 +- .../src/lint_text/tests/test_lint_text.rs | 2 +- .../src/sql_lint/_helpers/formatter.rs | 8 - .../src/sql_lint/main/batch_formatter.rs | 5 - .../sqlbuild-rules/src/sql_lint/main/mod.rs | 1 - .../src/sql_lint/tests/helpers.rs | 10 +- .../src/sql_lint/tests/test_sql_lint.rs | 2 +- fensu.toml | 2 - pyproject.toml | 1 - scripts/check_native_stub.py | 14 + scripts/native_stub/__init__.py | 1 + scripts/native_stub/_helpers/__init__.py | 1 + scripts/native_stub/_helpers/declarations.py | 38 + scripts/native_stub/constants.py | 6 + scripts/native_stub/main/__init__.py | 1 + scripts/native_stub/main/check.py | 28 + src/sqlbuild/_native.pyi | 2173 +---------------- .../cli/commands/main/sqlite/_test_types.py | 7 - .../commands/_helpers/dbt_init/_test_types.py | 11 - .../cli/commands/_helpers/dbt_init/helpers.py | 68 - .../sqlbuild/compiler/discovery/helpers.py | 18 - .../src/sqlbuild/compiler/helpers.py | 9 - .../scripts/native_stub}/__init__.py | 0 .../scripts/native_stub/_helpers/__init__.py | 0 .../native_stub/_helpers/_test_types.py | 9 + .../native_stub/_helpers/test_declarations.py | 65 + .../commands/_helpers/entry/_test_types.py | 9 - .../sqlbuild/cli/commands/_helpers/helpers.py | 17 - .../cli/compile_reuse/_helpers/helpers.py | 34 - .../compiler/planner/_helpers/helpers.py | 51 - .../executor/janitor/main/_test_types.py | 7 - .../sqlbuild/executor/janitor/main/helpers.py | 29 - .../sqlbuild/integrations/dagster/helpers.py | 38 - .../sqlbuild/integrations/dbt/_test_types.py | 9 - .../src/sqlbuild/integrations/dbt/helpers.py | 73 - .../src/sqlbuild/lint/_helpers/_test_types.py | 46 - .../src/sqlbuild/lint/_helpers/helpers.py | 23 - uv.lock | 2 - 82 files changed, 241 insertions(+), 3252 deletions(-) delete mode 100644 crates/sqlbuild-rules/src/lint_text/main/interpolation_text_at.rs delete mode 100644 crates/sqlbuild-rules/src/lint_text/main/simplify_fixture_nulls.rs delete mode 100644 crates/sqlbuild-rules/src/sql_lint/main/batch_formatter.rs create mode 100644 scripts/check_native_stub.py create mode 100644 scripts/native_stub/__init__.py create mode 100644 scripts/native_stub/_helpers/__init__.py create mode 100644 scripts/native_stub/_helpers/declarations.py create mode 100644 scripts/native_stub/constants.py create mode 100644 scripts/native_stub/main/__init__.py create mode 100644 scripts/native_stub/main/check.py delete mode 100644 tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/_test_types.py delete mode 100644 tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/helpers.py rename tests/{integration/src/sqlbuild/cli/commands/_helpers/dbt_init => unit/scripts/native_stub}/__init__.py (100%) create mode 100644 tests/unit/scripts/native_stub/_helpers/__init__.py create mode 100644 tests/unit/scripts/native_stub/_helpers/_test_types.py create mode 100644 tests/unit/scripts/native_stub/_helpers/test_declarations.py diff --git a/.github/workflows/verify.yml b/.github/workflows/verify.yml index 1b234f6fd1..96aeac78c6 100644 --- a/.github/workflows/verify.yml +++ b/.github/workflows/verify.yml @@ -147,7 +147,7 @@ jobs: ;; esac case "${path}" in - scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|tests/goldens/*|tests/e2e/fixtures/*|website/examples/*|src/sqlbuild/cli/commands/_helpers/compile/*|.github/workflows/verify.yml|Makefile) + scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|tests/goldens/*|tests/e2e/fixtures/*|website/examples/*|.github/workflows/verify.yml|Makefile) compiler_differential=true ;; esac @@ -163,16 +163,16 @@ jobs: performance=true rules_performance=true ;; - src/sqlbuild/cli/commands/_helpers/compile/*|src/sqlbuild/executor/testing/*|scripts/cold_compile_performance/*|scripts/compile_performance_ratio/*|scripts/compare_compile_performance.py|tests/e2e/src/sqlbuild/cli/commands/main/compile/*) + src/sqlbuild/executor/testing/*|scripts/cold_compile_performance/*|scripts/compile_performance_ratio/*|scripts/compare_compile_performance.py|tests/e2e/src/sqlbuild/cli/commands/main/compile/*) broad=true performance=true ;; - src/sqlbuild/cli/commands/_helpers/lineage/*|src/sqlbuild/cli/commands/_helpers/plan/*|src/sqlbuild/cli/commands/_helpers/scope/*|src/sqlbuild/cli/commands/_helpers/build_planning/*|src/sqlbuild/cli/commands/main/inspection/*|src/sqlbuild/cli/commands/main/project/*|src/sqlbuild/cli/output/*|src/sqlbuild/executor/build/*|src/sqlbuild/executor/run/*|src/sqlbuild/presentation/*) + src/sqlbuild/executor/build/*|src/sqlbuild/executor/run/*|src/sqlbuild/presentation/*) # Inspection, plan, and build guards run inside the fresh-process compile jobs. broad=true performance=true ;; - src/sqlbuild/rule_engine/*|src/sqlbuild/lint/*|scripts/rules_benchmark/*|scripts/benchmark_rules_ci.py|tests/performance/*) + src/sqlbuild/rule_engine/*|src/sqlbuild/lint/*|scripts/rules_benchmark/*|scripts/benchmark_rules_ci.py) broad=true performance=true format_performance=true diff --git a/Makefile b/Makefile index 496dcf84e4..c449993398 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ SHELL := /bin/bash -.PHONY: verify verify-quick verify-pg coverage cli-preview rust-check check-native-layering check-build-features check-python-boundary check-release-gate check-docs-skill \ +.PHONY: verify verify-quick verify-pg coverage cli-preview rust-check check-native-layering check-native-stub check-build-features check-python-boundary check-release-gate check-docs-skill \ check-e2e-shards test-e2e-duckdb test-e2e-duckdb-build-core \ test-e2e-duckdb-build-incremental \ test-e2e-duckdb-cli-data test-e2e-duckdb-cli test-e2e-duckdb-inspection \ @@ -645,7 +645,7 @@ verify-quick: exit $$status -check-ci: check-e2e-shards check-native-layering check-build-features check-python-boundary check-release-gate check-docs-skill rust-lint +check-ci: check-e2e-shards check-native-layering check-native-stub check-build-features check-python-boundary check-release-gate check-docs-skill rust-lint uv run ruff format --check . uv run ruff check . uv run ty check src tests @@ -657,6 +657,10 @@ check-native-layering: uv run python -m scripts.check_native_layering +check-native-stub: + uv run python -m scripts.check_native_stub + + check-build-features: uv run python -m scripts.check_build_features diff --git a/crates/sqlbuild-analysis/src/compiled_project/models.rs b/crates/sqlbuild-analysis/src/compiled_project/models.rs index 3f947b3376..d769f01a51 100644 --- a/crates/sqlbuild-analysis/src/compiled_project/models.rs +++ b/crates/sqlbuild-analysis/src/compiled_project/models.rs @@ -140,16 +140,6 @@ pub struct ModelLoopSettings { pub require_sql_analysis: bool, } -/// The `description` config value's shape. -#[derive(Clone, Debug, Default, PartialEq, Eq)] -pub enum DescriptionShape { - #[default] - Absent, - Text(String), - /// Present but not a non-blank string. - Invalid, -} - /// The per-model `sql_analysis` / legacy `sql_validation` override. #[derive(Clone, Copy, Debug, Default, PartialEq, Eq)] pub enum AnalysisOverride { diff --git a/crates/sqlbuild-config/src/command_connection/constants.rs b/crates/sqlbuild-config/src/command_connection/constants.rs index ab3bddc173..f747e2218a 100644 --- a/crates/sqlbuild-config/src/command_connection/constants.rs +++ b/crates/sqlbuild-config/src/command_connection/constants.rs @@ -4,7 +4,6 @@ pub const CLI_WAREHOUSE_SOURCE: &str = "--warehouse"; pub const CONNECTION_WAREHOUSE_SOURCE: &str = "connection warehouse"; pub const CONNECTION_DEFAULT_WAREHOUSE_SOURCE: &str = "connection default"; pub const CONNECTION_WAREHOUSE_KEY: &str = "warehouse"; -pub const CONNECTION_DATABASE_KEY: &str = "database"; pub const CONNECTION_SOURCE_KEY: &str = "source"; pub const DBT_PROFILE_CONNECTION_SOURCE: &str = "dbt_profile"; pub const DUCKDB_ADAPTER: &str = "duckdb"; diff --git a/crates/sqlbuild-core/src/dbt_cli/constants.rs b/crates/sqlbuild-core/src/dbt_cli/constants.rs index 4ccf2bf8eb..1133982617 100644 --- a/crates/sqlbuild-core/src/dbt_cli/constants.rs +++ b/crates/sqlbuild-core/src/dbt_cli/constants.rs @@ -2,13 +2,6 @@ /// The dbt executable when no override is set. pub const DEFAULT_DBT_EXECUTABLE: &str = "dbt"; -/// SQLBuild cursor flags `sqb dbt` forwards to SQLBuild. -pub const CURSOR_FLAGS: [&str; 4] = [ - "--start-cursor-ts", - "--end-cursor-ts", - "--start-cursor-int", - "--end-cursor-int", -]; /// SQLBuild-only flags `sqb dbt run` and `sqb dbt build` accept. pub const EXECUTION_SQLBUILD_FLAGS: [&str; 7] = [ "--start-cursor-ts", diff --git a/crates/sqlbuild-core/src/diagnostic_routing/constants.rs b/crates/sqlbuild-core/src/diagnostic_routing/constants.rs index 3cf4ff16c8..ed55035676 100644 --- a/crates/sqlbuild-core/src/diagnostic_routing/constants.rs +++ b/crates/sqlbuild-core/src/diagnostic_routing/constants.rs @@ -57,7 +57,6 @@ pub const SAFE_FIELDS: [&str; 7] = [ /// The safe fields a retained SQL diagnostic keeps. pub const SQL_SAFE_FIELDS: [&str; 4] = ["sql_action", "sql_digest", "sql_intent", "sql_query_id"]; /// Python logging level numbers. -pub const LEVEL_DEBUG: i64 = 10; pub const LEVEL_INFO: i64 = 20; pub const LEVEL_WARNING: i64 = 30; pub const LEVEL_ERROR: i64 = 40; diff --git a/crates/sqlbuild-core/src/event_export/constants.rs b/crates/sqlbuild-core/src/event_export/constants.rs index a5fe675243..75feaf7546 100644 --- a/crates/sqlbuild-core/src/event_export/constants.rs +++ b/crates/sqlbuild-core/src/event_export/constants.rs @@ -32,7 +32,6 @@ pub const OUTCOME_EVENT_TYPES: [&str; 6] = [ pub const OUTCOME_RESERVE_FRACTION: f64 = 0.25; pub const RETRY_EVENT_TYPE: &str = "retry_scheduled"; pub const RETRY_EVENT_KIND: &str = "retry"; -pub const RESOURCE_EVENT_PREFIX: &str = "resource"; pub const FAILED_EVENT_SUFFIX: &str = "_failed"; pub const FAILED_EVENT_PRIORITY: u8 = 3; pub const TERMINAL_EVENT_PRIORITY: u8 = 2; diff --git a/crates/sqlbuild-core/src/text/models.rs b/crates/sqlbuild-core/src/text/models.rs index 7ba97cb723..7300f7005c 100644 --- a/crates/sqlbuild-core/src/text/models.rs +++ b/crates/sqlbuild-core/src/text/models.rs @@ -9,13 +9,6 @@ pub struct TextPosition { pub column: usize, } -/// A half-open range of text. -#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)] -pub struct TextSpan { - pub start: TextPosition, - pub end: TextPosition, -} - /// Line starts of one text, converting offsets into Python-compatible lines and columns. #[derive(Clone, Debug, PartialEq, Eq)] pub struct LineIndex<'text> { @@ -64,38 +57,4 @@ impl<'text> LineIndex<'text> { column, }) } - - /// The position at a code-point offset (a Python string index), or `None` past the end. - pub fn position_at_char(&self, char_offset: usize) -> Option { - if char_offset > self.char_len { - return None; - } - let line_index = self - .line_char_starts - .partition_point(|start| *start <= char_offset) - - 1; - let line_start = self.line_byte_starts[line_index]; - let column = char_offset - self.line_char_starts[line_index] + 1; - let byte_offset = self.text[line_start..] - .char_indices() - .nth(column - 1) - .map_or(self.text.len(), |(offset, _)| line_start + offset); - Some(TextPosition { - byte_offset, - char_offset, - line: line_index + 1, - column, - }) - } - - /// The span between two UTF-8 byte offsets, or `None` when either end is not a position. - pub fn span_at_bytes(&self, start: usize, end: usize) -> Option { - if start > end { - return None; - } - Some(TextSpan { - start: self.position_at_byte(start)?, - end: self.position_at_byte(end)?, - }) - } } diff --git a/crates/sqlbuild-core/src/text/tests/test_text.rs b/crates/sqlbuild-core/src/text/tests/test_text.rs index 01ae101f25..0b5c3f7d33 100644 --- a/crates/sqlbuild-core/src/text/tests/test_text.rs +++ b/crates/sqlbuild-core/src/text/tests/test_text.rs @@ -2,9 +2,7 @@ use crate::text::main::decimal_digit_value::decimal_digit_value; use crate::text::main::decode_text::decode_text; use crate::text::main::is_decimal_digit::is_decimal_digit; use crate::text::models::LineIndex; -use crate::text::tests::test_types::{ - DecimalDigitTestCase, DecodeTestCase, PositionTestCase, SpanTestCase, -}; +use crate::text::tests::test_types::{DecimalDigitTestCase, DecodeTestCase, PositionTestCase}; #[test] fn given_offsets_when_indexing_text_then_lines_and_columns_match_python() { @@ -61,45 +59,12 @@ fn given_offsets_when_indexing_text_then_lines_and_columns_match_python() { for test_case in test_cases { let index = LineIndex::new(test_case.text); let position = index.position_at_byte(test_case.byte_offset); - let round_trip = position.and_then(|found| index.position_at_char(found.char_offset)); assert_eq!( position.map(|found| (found.char_offset, found.line, found.column)), test_case.expected_position, "{}", test_case.description ); - assert_eq!(round_trip, position, "{} round trip", test_case.description); - } -} - -#[test] -fn given_byte_ranges_when_building_spans_then_both_ends_are_positions() { - let test_cases = [ - SpanTestCase { - description: "range on the second line", - text: "one\ntwo é three", - byte_range: (8, 10), - expected_ends: Some(((2, 5), (2, 6))), - }, - SpanTestCase { - description: "reversed range is rejected", - text: "one", - byte_range: (2, 1), - expected_ends: None, - }, - ]; - for test_case in test_cases { - let span = LineIndex::new(test_case.text) - .span_at_bytes(test_case.byte_range.0, test_case.byte_range.1); - assert_eq!( - span.map(|found| ( - (found.start.line, found.start.column), - (found.end.line, found.end.column) - )), - test_case.expected_ends, - "{}", - test_case.description - ); } } diff --git a/crates/sqlbuild-core/src/text/tests/test_types.rs b/crates/sqlbuild-core/src/text/tests/test_types.rs index 4d797997b7..38d7aafc02 100644 --- a/crates/sqlbuild-core/src/text/tests/test_types.rs +++ b/crates/sqlbuild-core/src/text/tests/test_types.rs @@ -5,13 +5,6 @@ pub(super) struct PositionTestCase { pub(super) expected_position: Option<(usize, usize, usize)>, } -pub(super) struct SpanTestCase { - pub(super) description: &'static str, - pub(super) text: &'static str, - pub(super) byte_range: (usize, usize), - pub(super) expected_ends: Option<((usize, usize), (usize, usize))>, -} - pub(super) struct DecodeTestCase { pub(super) description: &'static str, pub(super) bytes: &'static [u8], diff --git a/crates/sqlbuild-python/src/bindings/_helpers/analysis/queries.rs b/crates/sqlbuild-python/src/bindings/_helpers/analysis/queries.rs index 2a4e486aae..b69dd10240 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/analysis/queries.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/analysis/queries.rs @@ -14,28 +14,6 @@ fn query_fingerprint(py: Python<'_>, sql: &str, dialect: &str) -> PyResult, request_json: &str) -> PyResult { - py.compiler_detach(|| { - sqlbuild_analysis::semantic_validation::main::validation_json(request_json) - }) - .map_err(value_error) -} - -#[pyfunction] -fn analyze_sql_uses_json(py: Python<'_>, request_json: &str) -> PyResult { - py.compiler_detach(|| sqlbuild_analysis::semantic_usage::main::analyze_json(request_json)) - .map_err(value_error) -} - -#[pyfunction] -fn analyze_column_references_json(py: Python<'_>, request_json: &str) -> PyResult { - py.compiler_detach(|| { - sqlbuild_analysis::column_references::main::analyze::analyze_json(request_json) - }) - .map_err(value_error) -} - #[pyfunction] fn analyze_queries_json(py: Python<'_>, request_json: &str) -> PyResult { py.compiler_detach(|| { @@ -68,9 +46,6 @@ pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { crate::bindings::_helpers::references::explicit_references::register(module)?; crate::bindings::_helpers::analysis::binding_locations::register(module)?; module.add_function(wrap_pyfunction!(query_fingerprint, module)?)?; - module.add_function(wrap_pyfunction!(schema_validation_json, module)?)?; - module.add_function(wrap_pyfunction!(analyze_sql_uses_json, module)?)?; - module.add_function(wrap_pyfunction!(analyze_column_references_json, module)?)?; module.add_function(wrap_pyfunction!(analyze_queries_json, module)?)?; module.add_function(wrap_pyfunction!(analyze_project_queries_json, module)?)?; module.add_function(wrap_pyfunction!( diff --git a/crates/sqlbuild-python/src/bindings/_helpers/dbt_events/stream.rs b/crates/sqlbuild-python/src/bindings/_helpers/dbt_events/stream.rs index 9252d97372..71075a2f02 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/dbt_events/stream.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/dbt_events/stream.rs @@ -10,7 +10,6 @@ use pyo3::types::PyDict; use pyo3::{pyclass, pyfunction, pymethods, wrap_pyfunction}; use sqlbuild_core::cli_text::models::CliStyle; use sqlbuild_core::dbt_events::main::consume_dbt_event::consume_dbt_event; -use sqlbuild_core::dbt_events::main::format_dbt_active_nodes::format_dbt_active_nodes; use sqlbuild_core::dbt_events::main::render_dbt_node_row::render_dbt_node_row; use sqlbuild_core::dbt_events::models::{DbtRowPosition, DbtStreamState, DbtStreamUpdate}; @@ -146,17 +145,9 @@ pub(crate) fn render_dbt_node_result( )) } -/// The progress line listing running dbt nodes by their start time. -#[pyfunction] -#[pyo3(signature = (*, active_nodes, now))] -fn format_dbt_active_node_status(active_nodes: Vec<(String, f64)>, now: f64) -> String { - format_dbt_active_nodes(&active_nodes, now) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_class::()?; module.add_class::()?; module.add_function(wrap_pyfunction!(render_dbt_node_result, module)?)?; - module.add_function(wrap_pyfunction!(format_dbt_active_node_status, module)?)?; Ok(()) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/discovery/snapshot.rs b/crates/sqlbuild-python/src/bindings/_helpers/discovery/snapshot.rs index efa49d21c9..75b1488c2c 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/discovery/snapshot.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/discovery/snapshot.rs @@ -162,20 +162,11 @@ pub(crate) fn directory_snapshot_scope( } } -/// The active snapshot of `project_dir`, or `None` outside its scope. -#[pyfunction] -#[pyo3(signature = (*, project_dir))] -fn active_directory_snapshot<'py>( - project_dir: &Bound<'py, PyAny>, -) -> PyResult>> { - active_snapshot(project_dir) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_class::()?; module.add_class::()?; module.add_function(wrap_pyfunction!(directory_snapshot_scope, module)?)?; - module.add_function(wrap_pyfunction!(active_directory_snapshot, module)?) + Ok(()) } /// `str(project_dir / "_")` without its probe: the text printed before a relative path. diff --git a/crates/sqlbuild-python/src/bindings/_helpers/graph/views.rs b/crates/sqlbuild-python/src/bindings/_helpers/graph/views.rs index dbf1def124..223f8f4bca 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/graph/views.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/graph/views.rs @@ -17,12 +17,6 @@ use crate::bindings::_helpers::records::fields::field as native_field; use crate::bindings::_helpers::records::fields::mapping_items; use crate::bindings::_helpers::records::ids::RecordId; -/// The native graph's `(resource type, name)` pair for `key`. -#[pyfunction] -fn native_graph_key(key: &Bound<'_, PyAny>) -> PyResult { - native_key(key) -} - /// The native graph's pairs for `keys`, in order. #[pyfunction] fn native_graph_keys(keys: &Bound<'_, PyAny>) -> PyResult> { @@ -201,7 +195,6 @@ pub(crate) fn native_graph_from_edges( } pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(native_graph_key, module)?)?; module.add_function(wrap_pyfunction!(native_graph_keys, module)?)?; module.add_function(wrap_pyfunction!(compiled_graph_keys, module)?)?; module.add_function(wrap_pyfunction!(lineage_graph_names, module)?)?; diff --git a/crates/sqlbuild-python/src/bindings/_helpers/model_config/column_migrations.rs b/crates/sqlbuild-python/src/bindings/_helpers/model_config/column_migrations.rs index d7c9eb867a..41a2ea95ec 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/model_config/column_migrations.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/model_config/column_migrations.rs @@ -1,15 +1,11 @@ //! Column renames validated natively, raised by Python as the attachment raises them. -use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyModule, PyModuleMethods, PyResult, Python}; +use pyo3::prelude::{Bound, PyAnyMethods, PyResult}; use pyo3::types::{PyDict, PyDictMethods, PyString, PyStringMethods}; -use pyo3::{IntoPyObject, pyfunction, wrap_pyfunction}; use sqlbuild_model_config::errors::ConfigError; use sqlbuild_model_config::model_validation::main::validate_column_migrations::validate_column_migrations; use sqlbuild_model_config::model_validation::models::ColumnMigration; -use crate::bindings::_helpers::boundary::panics::compiler_guard; -use crate::bindings::_helpers::model_config::config_errors::native_config_error; - const MATERIALIZED_KEY: &str = "materialized"; const MIGRATE_FROM_KEY: &str = "migrate_from"; @@ -38,27 +34,3 @@ pub(crate) fn column_migration_error( .err(), ) } - -/// `None`, or the native error for the model's first column-rename problem. -#[pyfunction] -fn column_migration_problem<'py>( - py: Python<'py>, - model_name: &str, - values: Bound<'py, PyDict>, - columns: Vec<(String, Option)>, -) -> PyResult> { - let columns: Vec = columns - .into_iter() - .map(|(name, migrate_from)| ColumnMigration { name, migrate_from }) - .collect(); - compiler_guard( - || match column_migration_error(model_name, &values, &columns)? { - Some(error) => Ok(native_config_error(py, error)?.into_bound(py).into_any()), - None => Ok(py.None().into_pyobject(py)?.into_any()), - }, - ) -} - -pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(column_migration_problem, module)?) -} diff --git a/crates/sqlbuild-python/src/bindings/_helpers/model_config/registration.rs b/crates/sqlbuild-python/src/bindings/_helpers/model_config/registration.rs index f0cc73ea11..4e9095b798 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/model_config/registration.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/model_config/registration.rs @@ -3,12 +3,11 @@ use pyo3::prelude::{Bound, PyModule, PyResult}; use crate::bindings::_helpers::model_config::{ - column_migrations, config_errors, config_values, header_columns, model_config_builder, - model_validator, template_data, unicode_environment, + config_errors, config_values, header_columns, model_config_builder, model_validator, + template_data, unicode_environment, }; pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - column_migrations::register(module)?; config_errors::register(module)?; config_values::register(module)?; header_columns::register(module)?; diff --git a/crates/sqlbuild-python/src/bindings/_helpers/plan_output/display.rs b/crates/sqlbuild-python/src/bindings/_helpers/plan_output/display.rs index 5ca5664651..b237c93be5 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/plan_output/display.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/plan_output/display.rs @@ -184,14 +184,6 @@ fn model_execution_annotation(entry: &Bound<'_, PyAny>) -> PyResult { Ok(execution_annotation(optional_facts(entry)?.as_ref())) } -/// The left-column resource type for active progress rows. -#[pyfunction] -fn materialization_type_display<'py>( - resource_kind: &Bound<'py, PyAny>, -) -> PyResult> { - native_field(resource_kind, "value") -} - fn names(input_names: &Bound<'_, PyAny>) -> PyResult> { input_names .try_iter()? @@ -276,7 +268,6 @@ pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(model_materialization_label, module)?)?; module.add_function(wrap_pyfunction!(model_resource_type, module)?)?; module.add_function(wrap_pyfunction!(model_execution_annotation, module)?)?; - module.add_function(wrap_pyfunction!(materialization_type_display, module)?)?; module.add_function(wrap_pyfunction!(format_no_input_rows, module)?)?; module.add_function(wrap_pyfunction!(format_waiting_on_empty_inputs, module)?)?; module.add_function(wrap_pyfunction!( diff --git a/crates/sqlbuild-python/src/bindings/_helpers/plan_output/safety.rs b/crates/sqlbuild-python/src/bindings/_helpers/plan_output/safety.rs index 4a89d40637..2e7a6b2a00 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/plan_output/safety.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/plan_output/safety.rs @@ -156,12 +156,6 @@ pub(crate) fn maximum_start_safety<'py>( .into_any()) } -/// Serialize future-cursor safety evidence; `None` stays `None`. -#[pyfunction] -fn serialize_future_cursor_safety<'py>(evidence: Bound<'py, PyAny>) -> PyResult> { - future_cursor_safety(&evidence) -} - /// Serialize maximum automatic-start safety evidence; `None` stays `None`. #[pyfunction] fn serialize_maximum_start_safety<'py>(evidence: Bound<'py, PyAny>) -> PyResult> { @@ -169,6 +163,5 @@ fn serialize_maximum_start_safety<'py>(evidence: Bound<'py, PyAny>) -> PyResult< } pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(serialize_future_cursor_safety, module)?)?; module.add_function(wrap_pyfunction!(serialize_maximum_start_safety, module)?) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/model_entries.rs b/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/model_entries.rs index 81ee6bd601..507b42a24e 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/model_entries.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/model_entries.rs @@ -606,23 +606,6 @@ pub(crate) fn plan_model<'py>( }) } -/// Build a name-to-materialization-type lookup from planned model entries. -#[pyfunction] -#[pyo3(signature = (model_entries, /))] -fn build_model_materializations<'py>( - model_entries: &Bound<'py, PyAny>, -) -> PyResult> { - let lookup = PyDict::new(model_entries.py()); - for entry in model_entries.try_iter()? { - let entry = entry?; - lookup.set_item( - native_field(&entry, "name")?, - native_field(&entry, "materialization_type")?, - )?; - } - Ok(lookup) -} - /// Check if any scope dependency is in the selected keys. #[pyfunction] #[pyo3(signature = (*, scope_deps, selected_keys))] @@ -640,6 +623,5 @@ pub(crate) fn scope_overlaps( pub(super) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(plan_model, module)?)?; - module.add_function(wrap_pyfunction!(build_model_materializations, module)?)?; module.add_function(wrap_pyfunction!(scope_overlaps, module)?) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/plan_output.rs b/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/plan_output.rs index de60957dc4..8010b8aa82 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/plan_output.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/planner_entries/plan_output.rs @@ -749,17 +749,6 @@ pub(crate) fn plan_selected_sql_tests<'py>( planned_sql_tests(project, adapter, selected_keys, sql_test_selection) } -/// Whether a test is named by the selection or covers a selected resource, and not excluded. -#[pyfunction] -#[pyo3(signature = (*, test, selected_keys, sql_test_selection))] -fn sql_test_is_selected( - test: &Bound<'_, PyAny>, - selected_keys: &Bound<'_, PyAny>, - sql_test_selection: &Bound<'_, PyAny>, -) -> PyResult { - test_selected(test, selected_keys, sql_test_selection) -} - /// Selected SQL test entries and warnings, optionally narrowed to one parameterized case. #[pyfunction] #[pyo3(signature = (**kwargs))] @@ -791,7 +780,6 @@ fn build_selected_test_entries<'py>( pub(super) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(plan_function, module)?)?; module.add_function(wrap_pyfunction!(plan_selected_sql_tests, module)?)?; - module.add_function(wrap_pyfunction!(sql_test_is_selected, module)?)?; module.add_function(wrap_pyfunction!(sql_test_model_chain_names_by_key, module)?)?; module.add_function(wrap_pyfunction!(build_selected_test_entries, module)?) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/planner_resolution/cursor_policies.rs b/crates/sqlbuild-python/src/bindings/_helpers/planner_resolution/cursor_policies.rs index a32c19a153..5cc45c0e3b 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/planner_resolution/cursor_policies.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/planner_resolution/cursor_policies.rs @@ -82,16 +82,6 @@ pub(crate) fn start_cursor_config<'py>( resolve_policy(model, project_config, &START_POLICY) } -/// Resolve future-end policy with model config taking precedence. -#[pyfunction] -#[pyo3(signature = (*, model, project_config))] -fn resolve_future_cursor_config<'py>( - model: &Bound<'py, PyAny>, - project_config: &Bound<'py, PyAny>, -) -> PyResult> { - future_cursor_config(model, project_config) -} - /// Resolve automatic-start policy with model config taking precedence. #[pyfunction] #[pyo3(signature = (*, model, project_config))] @@ -103,6 +93,5 @@ pub(crate) fn resolve_start_cursor_config<'py>( } pub(super) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(resolve_future_cursor_config, module)?)?; module.add_function(wrap_pyfunction!(resolve_start_cursor_config, module)?) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/planner_selection/selectors.rs b/crates/sqlbuild-python/src/bindings/_helpers/planner_selection/selectors.rs index 15a0988d55..9aeb74249f 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/planner_selection/selectors.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/planner_selection/selectors.rs @@ -12,7 +12,6 @@ use sqlbuild_analysis::graph::main::parse_selector::parse_selector; use sqlbuild_analysis::graph::main::resolve_selector_tokens::resolve_selector_tokens; use sqlbuild_analysis::graph::main::resolve_selectors::resolve_selectors; use sqlbuild_analysis::graph::models::{ParsedSelector, ProjectGraph}; -use sqlbuild_analysis::planner_selection::main::unit_test_selector_rejection::unit_test_selector_rejection; use crate::bindings::_helpers::boundary::python_calls::KeywordArguments; use crate::bindings::_helpers::graph::algorithms::closure; @@ -247,14 +246,6 @@ pub(crate) fn expand_project_upstream_keys<'py>( PyFrozenSet::new(upstream_deps.py(), visited.iter()) } -/// The error for a unit-test selector given where unit tests never run. -#[pyfunction] -#[pyo3(signature = (*, selector))] -fn unit_test_selector_error<'py>(selector: &Bound<'py, PyString>) -> PyResult> { - let carrier: Carrier<'py> = Carrier::single(selector)?; - carrier.exception(unit_test_selector_rejection(&carrier.send(selector)?)) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(parse_project_selector, module)?)?; module.add_function(wrap_pyfunction!(resolve_graph_selection, module)?)?; @@ -263,5 +254,5 @@ pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(resolve_project_selector_tokens, module)?)?; module.add_function(wrap_pyfunction!(match_project_selector, module)?)?; module.add_function(wrap_pyfunction!(expand_project_upstream_keys, module)?)?; - module.add_function(wrap_pyfunction!(unit_test_selector_error, module)?) + Ok(()) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/planner_strategy/microbatches.rs b/crates/sqlbuild-python/src/bindings/_helpers/planner_strategy/microbatches.rs index eb708964a2..1d25ce8bb8 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/planner_strategy/microbatches.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/planner_strategy/microbatches.rs @@ -284,24 +284,7 @@ pub(crate) fn microbatch_limit_config<'py>( Ok((positive_integer(Some(legacy))?, None)) } -/// `(max_batches, action)` from validated model config values. -#[pyfunction] -#[pyo3(signature = (*, values))] -fn resolve_microbatch_limit_config<'py>( - values: &Bound<'py, PyAny>, -) -> PyResult> { - let py: Python<'py> = values.py(); - let (max_batches, action) = microbatch_limit_config(values)?; - PyTuple::new( - py, - [ - max_batches.unwrap_or_else(|| py.None().into_bound(py)), - action.unwrap_or_else(|| py.None().into_bound(py)), - ], - ) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(microbatch_limit_warning, module)?)?; - module.add_function(wrap_pyfunction!(resolve_microbatch_limit_config, module)?) + Ok(()) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/builtin_catalogue.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/builtin_catalogue.rs index bca5bbdfd0..ad2a9d22ef 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/builtin_catalogue.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/builtin_catalogue.rs @@ -1,12 +1,10 @@ //! The built-in rule catalogue returned as the Python `Rule` models. -use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyModule, PyModuleMethods, PyResult, Python}; +use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyResult, Python}; use pyo3::types::{PyBool, PyDict, PyDictMethods, PyString, PyTuple}; -use pyo3::{pyfunction, wrap_pyfunction}; use sqlbuild_rules::models::RuleMetadata; use sqlbuild_rules::rules::main::builtin_options::builtin_options; use sqlbuild_rules::rules::main::catalogue::catalogue; -use sqlbuild_rules::rules::main::selected_sql_codes::selected_sql_codes; use sqlbuild_rules::rules::models::{BuiltinOption, BuiltinOptionKind}; use crate::bindings::_helpers::boundary::panics::compiler_guard; @@ -144,15 +142,3 @@ pub(crate) fn builtin_rules<'py>( .map(|metadata| rule(py, &subjects, &check, metadata)) .collect() } - -/// The built-in SQL rule codes `select` enables and `ignore` does not, in catalogue order. -#[pyfunction] -#[pyo3(signature = (*, select, ignore))] -fn selected_sql_rule_codes(select: Vec, ignore: Vec) -> PyResult> { - compiler_guard(|| Ok(selected_sql_codes(&select, &ignore))) -} - -pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(selected_sql_rule_codes, module)?)?; - Ok(()) -} diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/fixture_formatting.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/fixture_formatting.rs index 0e03ecccca..a4457947c8 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/fixture_formatting.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/fixture_formatting.rs @@ -5,7 +5,6 @@ use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyModule, PyModuleMethods, PyRes use pyo3::types::{PyDict, PyDictMethods, PyStringMethods}; use pyo3::{pyfunction, wrap_pyfunction}; use sqlbuild_rules::lint_text::main::format_fixture_blocks::format_fixture_blocks; -use sqlbuild_rules::lint_text::main::simplify_fixture_nulls::simplify_fixture_nulls; use sqlbuild_rules::lint_text::models::FixtureFormatBlock; use sqlbuild_sqltext::sql_scan::models::LexicalSyntax; @@ -16,13 +15,6 @@ use crate::bindings::_helpers::rules::constants::MODEL_TEST_MODE; use crate::bindings::_helpers::rules::fixture_schemas; use crate::bindings::_helpers::sqltext::lexical_syntax::LexicalSyntaxInput; -#[pyfunction] -#[pyo3(signature = (*, sql, relation))] -fn simplify_fixture_null_projections(sql: &str, relation: &Bound<'_, PyAny>) -> PyResult { - let columns = fixture_schemas::columns(&native_field(relation, "columns")?)?; - compiler_guard(|| simplify_fixture_nulls(sql, &columns).map_err(value_error)) -} - #[pyfunction] #[pyo3(signature = (*, files, project_dir, discovered_inputs, sql_lexical_syntax))] pub(crate) fn format_redundant_fixture_nulls<'py>( @@ -85,6 +77,5 @@ pub(crate) fn format_redundant_fixture_nulls<'py>( } pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(simplify_fixture_null_projections, module)?)?; module.add_function(wrap_pyfunction!(format_redundant_fixture_nulls, module)?) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/lint.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/lint.rs index 17a656ed28..f0fb419415 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/lint.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/lint.rs @@ -5,7 +5,7 @@ use pyo3::{FromPyObject, pyfunction, wrap_pyfunction}; use sqlbuild_rules::lint_text::models::InterpolationSite; use sqlbuild_rules::sql_lint::types::PreparedSql; -use crate::bindings::_helpers::boundary::panics::{compiler_guard, value_error}; +use crate::bindings::_helpers::boundary::panics::value_error; use crate::bindings::_helpers::compiled_views::relation_keys; use crate::bindings::models::Positional; use crate::bindings::types::CompilerDetach; @@ -53,41 +53,15 @@ fn prepare_lint_sql( })) } -#[pyfunction] -fn lint_backtick_identifiers(dialect: &str) -> PyResult { - compiler_guard(|| { - Ok(sqlbuild_rules::sql_lint::main::backtick_identifiers::backtick_identifiers(dialect)) - }) -} - -#[pyfunction] -fn lint_sql_batch_json(py: Python<'_>, request_json: &str) -> PyResult { - py.compiler_detach(|| { - sqlbuild_rules::sql_lint::main::batch_engine::lint_batch_json(request_json) - }) - .map_err(value_error) -} - #[pyfunction] fn format_sql_json(py: Python<'_>, request_json: &str) -> PyResult { py.compiler_detach(|| sqlbuild_rules::sql_lint::main::formatter::format_json(request_json)) .map_err(value_error) } -#[pyfunction] -fn format_sql_batch_json(py: Python<'_>, request_json: &str) -> PyResult { - py.compiler_detach(|| { - sqlbuild_rules::sql_lint::main::batch_formatter::format_batch_json(request_json) - }) - .map_err(value_error) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(lint_sql_json, module)?)?; module.add_function(wrap_pyfunction!(prepare_lint_sql, module)?)?; - module.add_function(wrap_pyfunction!(lint_backtick_identifiers, module)?)?; - module.add_function(wrap_pyfunction!(lint_sql_batch_json, module)?)?; module.add_function(wrap_pyfunction!(format_sql_json, module)?)?; - module.add_function(wrap_pyfunction!(format_sql_batch_json, module)?)?; relation_keys::register(module) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/lint_text.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/lint_text.rs index a2584b361a..e9df64c5a8 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/lint_text.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/lint_text.rs @@ -8,9 +8,7 @@ use pyo3::types::{PyDict, PyDictMethods, PyFrozenSet, PyString}; use pyo3::{IntoPyObject, pyfunction, wrap_pyfunction}; use sqlbuild_rules::lint_text::errors::LintTextError; use sqlbuild_rules::lint_text::main::format_sql_bodies::format_sql_bodies; -use sqlbuild_rules::lint_text::main::interpolation_text_at::interpolation_text_at; use sqlbuild_rules::lint_text::main::named_declaration_role_kind::named_declaration_role_kind as role_kind; -use sqlbuild_rules::lint_text::main::neutralize_audit_parameters::neutralize_audit_parameters; use sqlbuild_rules::lint_text::main::neutralize_context_interpolation::neutralize_context_interpolation; use sqlbuild_rules::lint_text::main::neutralize_interpolation::neutralize_interpolation; use sqlbuild_rules::lint_text::main::reject_inline_suppressions::reject_inline_suppressions; @@ -60,13 +58,6 @@ fn neutralize_lint_context_interpolation( compiler_guard(|| Ok(site_tuples(neutralize_context_interpolation(body)))) } -#[pyfunction] -fn neutralize_lint_audit_parameters( - body: &str, -) -> PyResult<(String, Vec>)> { - compiler_guard(|| Ok(site_tuples(neutralize_audit_parameters(body)))) -} - /// Restored text, or `(False, reason)` when a sentinel is missing or repeated. #[pyfunction] fn restore_lint_interpolation( @@ -81,11 +72,6 @@ fn restore_lint_interpolation( } } -#[pyfunction] -fn lint_interpolation_text_at(body: &str, start: usize, dialect: &str) -> PyResult> { - compiler_guard(|| Ok(interpolation_text_at(body, start, dialect))) -} - #[pyfunction] #[pyo3(signature = (project_dir, selected_paths = None))] fn scan_fixture_typed_null_candidates<'py>( @@ -249,9 +235,7 @@ pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { neutralize_lint_context_interpolation, module )?)?; - module.add_function(wrap_pyfunction!(neutralize_lint_audit_parameters, module)?)?; module.add_function(wrap_pyfunction!(restore_lint_interpolation, module)?)?; - module.add_function(wrap_pyfunction!(lint_interpolation_text_at, module)?)?; module.add_function(wrap_pyfunction!( scan_fixture_typed_null_candidates, module diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/registration.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/registration.rs index a47b614944..d6685cc3bd 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/registration.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/registration.rs @@ -5,10 +5,9 @@ use pyo3::prelude::{Bound, PyModule, PyResult}; use pyo3::{types::PyModuleMethods, wrap_pyfunction}; use crate::bindings::_helpers::rules::{ - builtin_catalogue, catalogue, custom_rule_cache, custom_rule_evidence, dsl_headers, - early_sql_lint, evaluation, guidance, lint, lint_expansion, lint_sql_bodies, lint_text, - results, rule_api, rule_cache, rule_plan, rule_run, rules_config, run_lint, selection, - sql_rules, + catalogue, custom_rule_cache, custom_rule_evidence, dsl_headers, early_sql_lint, evaluation, + guidance, lint, lint_expansion, lint_sql_bodies, lint_text, results, rule_api, rule_cache, + rule_plan, rule_run, rules_config, run_lint, selection, sql_rules, }; pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { @@ -42,7 +41,6 @@ pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { sql_rules::register(module)?; early_sql_lint::register(module)?; custom_rule_cache::register(module)?; - builtin_catalogue::register(module)?; catalogue::register(module)?; rules_config::register(module)?; run_lint::register(module)?; diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/results.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/results.rs index d64b31bc13..2363561727 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/results.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/results.rs @@ -1,23 +1,14 @@ //! Rules results rendered for the CLI, and SQBRSQL044 help naming files that repeat a literal. -use pyo3::exceptions::PyOSError; -use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyErr, PyModule, PyModuleMethods, PyResult}; -use pyo3::types::{PyString, PyTuple}; +use pyo3::prelude::{Bound, PyAny, PyAnyMethods, PyModule, PyModuleMethods, PyResult}; use pyo3::{pyfunction, wrap_pyfunction}; -use std::path::PathBuf; -use sqlbuild_core::text::main::python_splitlines::python_splitlines; -use sqlbuild_rules::rule_results::main::duplicate_literal_hints::duplicate_literal_hints; use sqlbuild_rules::rule_results::main::format_result::format_result; use sqlbuild_rules::rule_results::main::format_rules_progress::format_rules_progress; use sqlbuild_rules::rule_results::main::format_skipped_rules::format_skipped_rules; use sqlbuild_rules::rule_results::models::{ResultCounts, RuleFinding}; -use crate::bindings::_helpers::boundary::python_calls::call_with; -use crate::bindings::_helpers::records::fields::field as native_field; -use crate::bindings::_helpers::records::fields::{field, path_posix, replaced}; - -const UTF8: &str = "utf-8"; +use crate::bindings::_helpers::records::fields::{field, path_posix}; pub(crate) fn rule_finding(finding: &Bound<'_, PyAny>) -> PyResult { Ok(RuleFinding { @@ -88,62 +79,8 @@ pub(crate) fn format_skipped_type_proof_rules(codes: Vec) -> Option, path: &str) -> PyResult> { - let py = project_dir.py(); - let root: PathBuf = project_dir.extract()?; - let Ok(bytes) = std::fs::read(root.join(path)) else { - return Ok(Vec::new()); - }; - if let Ok(text) = std::str::from_utf8(&bytes) { - return Ok(python_splitlines(text) - .into_iter() - .map(str::to_owned) - .collect()); - } - let file: Bound<'_, PyAny> = project_dir.div(path)?; - let read: PyResult> = call_with( - &native_field(&file, "read_text")?, - &[("encoding", PyString::new(py, UTF8).into_any())], - ); - match read { - Ok(text) => text.call_method0("splitlines")?.extract(), - Err(error) if error.is_instance_of::(py) => Ok(Vec::new()), - Err(error) => Err(error), - } -} - -/// Prefix SQBRSQL044 help with the other files that repeat the identical literal. -#[pyfunction] -#[pyo3(signature = (*, findings, project_dir))] -fn with_duplicate_literal_hints<'py>( - findings: &Bound<'py, PyAny>, - project_dir: &Bound<'py, PyAny>, -) -> PyResult> { - let py = findings.py(); - let originals: Vec> = findings.try_iter()?.collect::>()?; - let rows: Vec = originals - .iter() - .map(rule_finding) - .collect::>()?; - let hinted: Vec> = - duplicate_literal_hints::(&rows, |path| file_lines(project_dir, path))?; - let mut output: Vec> = Vec::with_capacity(originals.len()); - for (finding, remediation) in originals.into_iter().zip(hinted) { - output.push(match remediation { - Some(remediation) => replaced( - &finding, - &[("remediation", PyString::new(py, &remediation).into_any())], - )?, - None => finding, - }); - } - PyTuple::new(py, output) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(format_rules_result, module)?)?; module.add_function(wrap_pyfunction!(format_skipped_type_proof_rules, module)?)?; - module.add_function(wrap_pyfunction!(with_duplicate_literal_hints, module)?)?; Ok(()) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/rule_cache.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/rule_cache.rs index 19b848594c..b1b96ef275 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/rule_cache.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/rule_cache.rs @@ -7,14 +7,13 @@ use pyo3::exceptions::PyValueError; use pyo3::prelude::{ Bound, PyAny, PyAnyMethods, PyErr, PyModule, PyModuleMethods, PyResult, Python, }; -use pyo3::types::{PyDict, PyDictMethods}; +use pyo3::types::PyDict; use pyo3::{pyfunction, wrap_pyfunction}; use serde_json::{Value, json}; use sqlbuild_rules::rule_cache::main::file_rule_key::file_rule_key; use crate::bindings::_helpers::boundary::keyword_request::Request; -use crate::bindings::_helpers::rules::findings::FindingClasses; use sqlbuild_rules::rule_cache::main::lint_key::lint_key; use sqlbuild_rules::rule_cache::main::lookup_rule_cache::lookup_rule_cache; use sqlbuild_rules::rule_cache::main::model_rule_keys::model_rule_keys as parallel_model_rule_keys; @@ -44,13 +43,6 @@ pub(crate) fn settings_lint_key(settings: &LintSettings) -> String { }) } -/// The lint settings part of every SQL rule cache key. -#[pyfunction] -#[pyo3(signature = (*, config))] -fn sql_rule_lint_key(config: &Bound<'_, PyAny>) -> PyResult { - Ok(settings_lint_key(&LintSettings::from_record(config)?)) -} - positional_record! { extract; /// One model's path, authored SQL, query SQL and contract. @@ -62,18 +54,6 @@ positional_record! { } } -/// Each model path's SQL rule cache key from `(path, authored_sql, query_sql, contract)`. -#[pyfunction] -#[pyo3(signature = (*, lint_key, codes, models))] -fn sql_model_rule_keys( - py: Python<'_>, - lint_key: &str, - codes: Vec, - models: Vec, -) -> BTreeMap { - model_rule_keys(py, lint_key, &codes, &models) -} - /// Each model path's SQL rule cache key, hashed in parallel with the GIL released. pub(crate) fn model_rule_keys( py: Python<'_>, @@ -213,29 +193,6 @@ pub(crate) fn encoded_findings(findings: &[&RuleFinding]) -> PyResult { serde_json::to_string(&payloads).map_err(invalid) } -/// The stored findings of each path whose key matches; undecodable stored findings miss. -#[pyfunction] -#[pyo3(signature = (*, entries, keys))] -fn lookup_sql_rule_cache<'py>( - py: Python<'py>, - entries: StoredEntries, - keys: Vec<(String, String)>, -) -> PyResult>>> { - let lookup: CacheLookup = lookup_rule_cache(&cached_entries(&entries)?, &keys); - let classes = FindingClasses::new(py)?; - let mut hits: BTreeMap>> = BTreeMap::new(); - for (path, findings) in lookup.hits { - let decoded: Option>> = findings - .iter() - .map(|finding| classes.finding_of_payload(finding)) - .collect::>()?; - if let Some(decoded) = decoded { - hits.insert(path, decoded); - } - } - Ok(hits) -} - fn finding_payload(finding: &Bound<'_, PyAny>) -> PyResult { let path: String = native_field(finding, "path")? .call_method0("as_posix")? @@ -263,17 +220,6 @@ fn encode_sql_rule_findings(findings: Vec>) -> PyResult serde_json::to_string(&payloads).map_err(invalid) } -/// Replace the cache file at `path` atomically with `entries`. -#[pyfunction] -#[pyo3(signature = (*, path, entries))] -fn write_sql_rule_cache(path: PathBuf, entries: &Bound<'_, PyDict>) -> PyResult<()> { - let mut stored = StoredEntries::new(); - for (key, value) in entries.iter() { - stored.insert(key.extract()?, value.extract()?); - } - write_rule_cache(&path, &stored) -} - /// Replace the cache file at `path` atomically with `entries`. pub(crate) fn write_rule_cache(path: &Path, stored: &StoredEntries) -> PyResult<()> { let text: String = rule_cache_text(&cached_entries(stored)?); @@ -287,12 +233,8 @@ pub(crate) fn write_rule_cache(path: &Path, stored: &StoredEntries) -> PyResult< } pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(sql_rule_lint_key, module)?)?; - module.add_function(wrap_pyfunction!(sql_model_rule_keys, module)?)?; module.add_function(wrap_pyfunction!(sql_file_rule_key, module)?)?; module.add_function(wrap_pyfunction!(load_sql_rule_cache, module)?)?; - module.add_function(wrap_pyfunction!(lookup_sql_rule_cache, module)?)?; module.add_function(wrap_pyfunction!(encode_sql_rule_findings, module)?)?; - module.add_function(wrap_pyfunction!(write_sql_rule_cache, module)?)?; Ok(()) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/rules/rules_config.rs b/crates/sqlbuild-python/src/bindings/_helpers/rules/rules_config.rs index 65e094a21f..c15e583ae7 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/rules/rules_config.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/rules/rules_config.rs @@ -285,19 +285,7 @@ pub(crate) fn rules_config_of( } } -/// The project's rules configuration, or `None` when it is invalid and the rules phase reports it. -#[pyfunction] -#[pyo3(signature = (*, project_dir))] -fn valid_rules_config(py: Python<'_>, project_dir: PathBuf) -> PyResult>> { - match load_rules_config(py, project_dir) { - Ok(config) => Ok(Some(config)), - Err(error) if error.is_instance(py, &error_class(py, ErrorId::Rules)?) => Ok(None), - Err(error) => Err(error), - } -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(load_rules_config, module)?)?; - module.add_function(wrap_pyfunction!(valid_rules_config, module)?)?; Ok(()) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/scopes/relationship_names.rs b/crates/sqlbuild-python/src/bindings/_helpers/scopes/relationship_names.rs index 61e73a50dc..8345733988 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/scopes/relationship_names.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/scopes/relationship_names.rs @@ -1,9 +1,6 @@ //! Expected-model relationship names and top-level CTEs of SQL tests and scenarios, scanned natively. -use pyo3::prelude::{ - Bound, PyAny, PyAnyMethods, PyErr, PyModule, PyModuleMethods, PyResult, Python, -}; -use pyo3::types::{PyDict, PyTuple}; +use pyo3::prelude::{Bound, PyModule, PyModuleMethods, PyResult, Python}; use pyo3::{pyfunction, wrap_pyfunction}; use sqlbuild_scopes::relationship_names::main::expected_model_names::expected_model_names; use sqlbuild_scopes::relationship_names::main::top_level_ctes::scan_top_level_ctes; @@ -13,10 +10,6 @@ use sqlbuild_scopes::relationship_names::models::{ use sqlbuild_sqltext::sql_scan::models::LexicalSyntax; use crate::bindings::_helpers::boundary::panics::compiler_error; -use crate::bindings::_helpers::records::construct::error_class; -use crate::bindings::_helpers::records::construct::new_record; -use crate::bindings::_helpers::records::fields::field as native_field; -use crate::bindings::_helpers::records::ids::{ErrorId, RecordId}; use crate::bindings::_helpers::sqltext::lexical_syntax::LexicalSyntaxInput; use crate::bindings::types::CompilerDetach; @@ -79,53 +72,7 @@ fn scope_test_ctes( .collect()) } -/// One SQL test body's raw top-level CTEs; a scan failure raises `CompileInputError`. -#[pyfunction] -#[pyo3(signature = (*, sql, file_label, syntax))] -fn extract_sql_test_ctes<'py>( - py: Python<'py>, - sql: &str, - file_label: &str, - syntax: &Bound<'py, PyAny>, -) -> PyResult> { - let syntax: LexicalSyntax = native_field(syntax, "native_mapping")? - .extract::()? - .into(); - let outcome: TopLevelCtes = py - .compiler_detach(|| { - Ok(scan_top_level_ctes( - sql, - file_label, - RelationshipSource::Test, - &syntax, - )) - }) - .map_err(compiler_error)?; - let ctes: Vec<(String, String)> = match outcome { - TopLevelCtes::Scanned(ctes) => ctes, - TopLevelCtes::Failed(message) => { - let error: Bound<'py, PyAny> = - error_class(py, ErrorId::CompileInput)?.call1((message,))?; - return Err(PyErr::from_value(error)); - } - }; - let mut built: Vec> = Vec::with_capacity(ctes.len()); - for (name, body) in ctes { - let arguments: Bound<'py, PyDict> = PyDict::new(py); - arguments.set_item("name", name)?; - arguments.set_item("sql_body", body)?; - built.push(new_record( - py, - RecordId::CompileSqlTestCte, - (), - Some(&arguments), - )?); - } - PyTuple::new(py, built) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { - module.add_function(wrap_pyfunction!(extract_sql_test_ctes, module)?)?; module.add_function(wrap_pyfunction!(scope_expected_model_names, module)?)?; module.add_function(wrap_pyfunction!(scope_test_ctes, module)?)?; Ok(()) diff --git a/crates/sqlbuild-python/src/bindings/_helpers/semantic_shapes/shapes.rs b/crates/sqlbuild-python/src/bindings/_helpers/semantic_shapes/shapes.rs index 2f79dfdbe1..4efbf20eb5 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/semantic_shapes/shapes.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/semantic_shapes/shapes.rs @@ -434,18 +434,8 @@ fn published_model_shape<'py>( ) } -/// `{name: shapes.get(name, {})}` for each relation the model's reference rows bind. -#[pyfunction] -fn model_binding_inputs<'py>( - model: &Bound<'py, PyAny>, - shapes: &Bound<'py, PyDict>, -) -> PyResult> { - model_inputs(model, shapes) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(semantic_shapes, module)?)?; module.add_function(wrap_pyfunction!(published_model_shape, module)?)?; - module.add_function(wrap_pyfunction!(model_binding_inputs, module)?)?; module.add_function(wrap_pyfunction!(binding_relation_names, module)?) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/sqltext/model_headers.rs b/crates/sqlbuild-python/src/bindings/_helpers/sqltext/model_headers.rs index 881982dc82..b8dd61632e 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/sqltext/model_headers.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/sqltext/model_headers.rs @@ -35,25 +35,6 @@ pub(crate) fn parse_model_headers( .collect() } -#[pyfunction] -fn match_model_headers( - py: Python<'_>, - contents: Vec, -) -> PyResult>> { - py.compiler_detach(|| { - Ok(sqlbuild_sqltext::compiler::main::model_header_matching::match_batch(&contents)) - }) - .map_err(value_error) -} - -#[pyfunction] -fn tokenize_model_header(header: &str) -> PyResult> { - compiler_guard(|| { - sqlbuild_sqltext::compiler::main::model_header_tokenizing::tokenize_one(header) - .map_err(value_error) - }) -} - positional_record! { into; /// A column name and its authored line, column, end line and end column. @@ -136,22 +117,9 @@ pub(crate) fn header_failure( } } -/// A header syntax error's detail, help and file line (when `header_line` is known). -#[pyfunction] -fn model_header_failure( - error: &str, - header: &str, - header_line: Option, -) -> (String, Option, Option) { - header_failure(error, header, header_line) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(parse_model_headers, module)?)?; - module.add_function(wrap_pyfunction!(match_model_headers, module)?)?; - module.add_function(wrap_pyfunction!(tokenize_model_header, module)?)?; module.add_function(wrap_pyfunction!(model_output_columns, module)?)?; module.add_function(wrap_pyfunction!(model_header_column_locations, module)?)?; - module.add_function(wrap_pyfunction!(model_header_failure, module)?)?; Ok(()) } diff --git a/crates/sqlbuild-python/src/bindings/_helpers/state_rows/migration_projections.rs b/crates/sqlbuild-python/src/bindings/_helpers/state_rows/migration_projections.rs index cc1bbf7d52..9378cd8311 100644 --- a/crates/sqlbuild-python/src/bindings/_helpers/state_rows/migration_projections.rs +++ b/crates/sqlbuild-python/src/bindings/_helpers/state_rows/migration_projections.rs @@ -173,19 +173,9 @@ fn old_name_views_binding<'py>( old_name_views(moves, facts) } -#[pyfunction(name = "resolve_old_name_view_retention")] -#[pyo3(signature = (*, config_values, project_retention))] -fn retention_binding<'py>( - config_values: &Bound<'py, PyAny>, - project_retention: &Bound<'py, PyAny>, -) -> PyResult> { - old_name_retention(config_values, project_retention) -} - pub(crate) fn register(module: &Bound<'_, PyModule>) -> PyResult<()> { module.add_function(wrap_pyfunction!(newest_move_binding, module)?)?; module.add_function(wrap_pyfunction!(newest_column_binding, module)?)?; module.add_function(wrap_pyfunction!(old_name_views_binding, module)?)?; - module.add_function(wrap_pyfunction!(retention_binding, module)?)?; Ok(()) } diff --git a/crates/sqlbuild-recall/src/records/constants.rs b/crates/sqlbuild-recall/src/records/constants.rs index 733d77ae5f..a1a4494ff7 100644 --- a/crates/sqlbuild-recall/src/records/constants.rs +++ b/crates/sqlbuild-recall/src/records/constants.rs @@ -2,8 +2,6 @@ /// The largest output chunk, in bytes. pub const MAX_OUTPUT_CHUNK_BYTES: usize = 64 * 1024; -/// The largest external context, in bytes of JSON. -pub const MAX_EXTERNAL_CONTEXT_BYTES: usize = 16 * 1024; /// The output record ID infix, shared with command-output sink records. pub const OUTPUT_RECORD_ID_INFIX: &str = "command-output"; pub const DIAGNOSTIC_RECORD_ID_INFIX: &str = "diagnostic"; @@ -12,9 +10,6 @@ pub const ARTIFACT_DIGEST_PREFIX: &str = "sha256:"; pub const SQL_ARTIFACT_KIND: &str = "sql"; pub const SQL_MEDIA_TYPE: &str = "text/x-sql"; pub const EXECUTED_SQL_ROLE: &str = "executed_sql"; -/// Delivery stream names, one `recall_delivery` row each. -pub const DELIVERY_STREAMS: [&str; 5] = - ["invocation", "output", "events", "diagnostics", "artifacts"]; /// Diagnostic severities, least severe first. pub const SEVERITY_ORDER: [&str; 6] = ["trace", "debug", "info", "warning", "error", "critical"]; /// Event payload fields promoted to their own `recall_events` columns. diff --git a/crates/sqlbuild-recall/src/writer/_helpers/session.rs b/crates/sqlbuild-recall/src/writer/_helpers/session.rs index 955cd027fa..e36d47770b 100644 --- a/crates/sqlbuild-recall/src/writer/_helpers/session.rs +++ b/crates/sqlbuild-recall/src/writer/_helpers/session.rs @@ -190,14 +190,6 @@ impl RecallSession { counts.filtered += count; } - /// Count records a replacement sink failed on in `stream`. - pub fn record_failed(&self, stream: DeliveryStream, count: u64) { - let mut state = locked(&self.shared.state); - let counts = state.counts_mut(stream); - counts.accepted += count; - counts.failed += count; - } - /// The accounting so far. #[must_use] pub fn summary(&self) -> DeliverySummary { diff --git a/crates/sqlbuild-recall/src/writer/constants.rs b/crates/sqlbuild-recall/src/writer/constants.rs index 4d013df6c3..db4e1d877c 100644 --- a/crates/sqlbuild-recall/src/writer/constants.rs +++ b/crates/sqlbuild-recall/src/writer/constants.rs @@ -11,8 +11,6 @@ pub const OUTPUT_COALESCE_MS: u64 = 250; pub const DEFAULT_HEARTBEAT_INTERVAL_MS: u64 = 30_000; /// An invocation is abandoned once its last heartbeat is this many intervals old. pub const HEARTBEAT_STALE_INTERVALS: u32 = 3; -/// Table setup may delay the command by at most this long. -pub const SETUP_BUDGET_MS: u64 = 2_000; /// Longest single backoff between retries of a busy write. pub const MAX_RETRY_BACKOFF_MS: u64 = 500; /// A batch that stays busy this long while the command runs is counted as failed. diff --git a/crates/sqlbuild-refactor/src/refactoring/constants.rs b/crates/sqlbuild-refactor/src/refactoring/constants.rs index f540140c7c..85ed832b7d 100644 --- a/crates/sqlbuild-refactor/src/refactoring/constants.rs +++ b/crates/sqlbuild-refactor/src/refactoring/constants.rs @@ -73,8 +73,6 @@ pub const UNIT_TEST_ROOT: &str = "tests/unit"; pub const MODELS_ROOT: &str = "models"; pub const MODEL_MANUAL_HELP: &str = "Pass the model into the macro as an argument, or edit the listed locations, then run the command again."; pub const COLUMN_MANUAL_HELP: &str = "Edit the listed locations, then run the command again."; -/// `RefactorInputError`'s default code. -pub const INPUT_ERROR_CODE: &str = "C950"; /// `RefactorEditError`'s code: two planned edits overlap. pub const EDIT_ERROR_CODE: &str = "C957"; /// `RefactorWriteError`'s code: project files changed between planning and writing. diff --git a/crates/sqlbuild-refactor/src/refactoring/models.rs b/crates/sqlbuild-refactor/src/refactoring/models.rs index 04d4d523d7..dd7f71d15e 100644 --- a/crates/sqlbuild-refactor/src/refactoring/models.rs +++ b/crates/sqlbuild-refactor/src/refactoring/models.rs @@ -148,11 +148,6 @@ impl RefactorPlan { &self.batch } } - - /// The number of text edits the plan writes, over every changed file. - pub fn edit_count(&self) -> usize { - self.changes.iter().map(|change| change.edits.len()).sum() - } } /// One rendered region of an expansion pass, pairing its source range with its output range. diff --git a/crates/sqlbuild-rules/src/lint_text/_helpers/sql_diagnostics.rs b/crates/sqlbuild-rules/src/lint_text/_helpers/sql_diagnostics.rs index 43cb230326..8f046f1c6a 100644 --- a/crates/sqlbuild-rules/src/lint_text/_helpers/sql_diagnostics.rs +++ b/crates/sqlbuild-rules/src/lint_text/_helpers/sql_diagnostics.rs @@ -5,7 +5,7 @@ use std::sync::LazyLock; use regex::Regex; use serde_json::{Map, Value}; -use crate::lint_text::_helpers::sites::compiled; +use crate::lint_text::_helpers::sites::{byte_offset, compiled, lint_policy, site_end}; use crate::lint_text::constants::{ GENERATED_FIX, GENERATED_SQL_SUFFIX, HARNESS_CTE_PREFIXES, INVALID_DIAGNOSTIC, INVALID_FIX_EDIT, INVALID_FIX_OBJECT, INVALID_FIX_REASON, LINT_API_VERSION, LONG_LITERAL_CODE, @@ -13,8 +13,8 @@ use crate::lint_text::constants::{ NOT_AN_OBJECT, PARSE_ERROR_POSITION_PATTERN, PARSE_FAILURE_PREFIX, PARSE_FAILURE_REMEDIATION, UNSUPPORTED_VERSION, UNUSED_CTE_CODE, }; -use crate::lint_text::main::interpolation_text_at::interpolation_text_at; use crate::lint_text::models::{AuthoredDiagnostic, AuthoredEdit, ExpansionSpan, LintSqlBody}; +use crate::sql_lint::main::backtick_identifiers::backtick_identifiers; static PARSE_ERROR_POSITION: LazyLock> = LazyLock::new(|| Regex::new(PARSE_ERROR_POSITION_PATTERN)); @@ -394,3 +394,10 @@ fn overlaps(span: &ExpansionSpan, start: i64, end: i64) -> bool { && start <= span.output_start && span.output_start < end } + +/// Return the interpolation token starting at character position `start`, if there is one. +pub(crate) fn interpolation_text_at(body: &str, start: usize, dialect: &str) -> Option { + let byte_start: usize = byte_offset(body, start)?; + let end: usize = site_end(body, byte_start, lint_policy(backtick_identifiers(dialect)))?; + Some(body[byte_start..end].to_string()) +} diff --git a/crates/sqlbuild-rules/src/lint_text/main/interpolation_text_at.rs b/crates/sqlbuild-rules/src/lint_text/main/interpolation_text_at.rs deleted file mode 100644 index 30a49ebd5b..0000000000 --- a/crates/sqlbuild-rules/src/lint_text/main/interpolation_text_at.rs +++ /dev/null @@ -1,11 +0,0 @@ -//! `interpolation_text_at`: the interpolation token beginning at one character offset. - -use crate::lint_text::_helpers::sites::{byte_offset, lint_policy, site_end}; -use crate::sql_lint::main::backtick_identifiers::backtick_identifiers; - -/// Return the interpolation token starting at character position `start`, if there is one. -pub fn interpolation_text_at(body: &str, start: usize, dialect: &str) -> Option { - let byte_start: usize = byte_offset(body, start)?; - let end: usize = site_end(body, byte_start, lint_policy(backtick_identifiers(dialect)))?; - Some(body[byte_start..end].to_string()) -} diff --git a/crates/sqlbuild-rules/src/lint_text/main/mod.rs b/crates/sqlbuild-rules/src/lint_text/main/mod.rs index 2ff3fab536..90660de7f3 100644 --- a/crates/sqlbuild-rules/src/lint_text/main/mod.rs +++ b/crates/sqlbuild-rules/src/lint_text/main/mod.rs @@ -2,7 +2,6 @@ pub mod dependency_sites; pub mod first_header_only; pub mod format_fixture_blocks; pub mod format_sql_bodies; -pub mod interpolation_text_at; pub mod lint_sql_bodies; pub mod named_declaration_role_kind; pub mod neutralize_audit_parameters; @@ -12,4 +11,3 @@ pub mod reject_inline_suppressions; pub mod resolve_format_settings; pub mod restore_interpolation; pub mod scan_fixture_null_candidates; -pub mod simplify_fixture_nulls; diff --git a/crates/sqlbuild-rules/src/lint_text/main/simplify_fixture_nulls.rs b/crates/sqlbuild-rules/src/lint_text/main/simplify_fixture_nulls.rs deleted file mode 100644 index baaa7c5478..0000000000 --- a/crates/sqlbuild-rules/src/lint_text/main/simplify_fixture_nulls.rs +++ /dev/null @@ -1,9 +0,0 @@ -//! Contract-aware fixture projection formatting. - -/// Remove typed nulls only when fixture completion restores the authored schema order. -pub fn simplify_fixture_nulls( - sql: &str, - columns: &[(String, Option, Option)], -) -> Result { - crate::lint_text::_helpers::fixture_formatting::simplify_fixture_nulls(sql, columns) -} diff --git a/crates/sqlbuild-rules/src/lint_text/tests/test_fixture_formatting.rs b/crates/sqlbuild-rules/src/lint_text/tests/test_fixture_formatting.rs index 045836b2ba..b8f1c0f63c 100644 --- a/crates/sqlbuild-rules/src/lint_text/tests/test_fixture_formatting.rs +++ b/crates/sqlbuild-rules/src/lint_text/tests/test_fixture_formatting.rs @@ -1,5 +1,5 @@ +use crate::lint_text::_helpers::fixture_formatting::simplify_fixture_nulls; use crate::lint_text::main::format_fixture_blocks::format_fixture_blocks; -use crate::lint_text::main::simplify_fixture_nulls::simplify_fixture_nulls; use crate::lint_text::models::{FixtureFormatBlock, FixtureFormatRelation}; use crate::lint_text::tests::test_types::FixtureBlockTestCase; use crate::lint_text::tests::test_types::FixtureFormattingTestCase; diff --git a/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs b/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs index 7e0c27a01c..964260e603 100644 --- a/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs +++ b/crates/sqlbuild-rules/src/lint_text/tests/test_lint_text.rs @@ -1,8 +1,8 @@ use crate::lint_text::_helpers::sites::site_pattern; +use crate::lint_text::_helpers::sql_diagnostics::interpolation_text_at; use crate::lint_text::constants::SITE_START_BYTES; use crate::lint_text::errors::LintTextError; use crate::lint_text::main::format_sql_bodies::format_sql_bodies; -use crate::lint_text::main::interpolation_text_at::interpolation_text_at; use crate::lint_text::main::lint_sql_bodies::lint_sql_bodies; use crate::lint_text::main::neutralize_audit_parameters::neutralize_audit_parameters; use crate::lint_text::main::neutralize_context_interpolation::neutralize_context_interpolation; diff --git a/crates/sqlbuild-rules/src/sql_lint/_helpers/formatter.rs b/crates/sqlbuild-rules/src/sql_lint/_helpers/formatter.rs index 9e0072c389..88ddd0a4e1 100644 --- a/crates/sqlbuild-rules/src/sql_lint/_helpers/formatter.rs +++ b/crates/sqlbuild-rules/src/sql_lint/_helpers/formatter.rs @@ -34,14 +34,6 @@ pub(crate) fn format_json_impl(request_json: &str) -> Result { serde_json::to_string(&response).map_err(|error| error.to_string()) } -pub(crate) fn format_batch_json_impl(request_json: &str) -> Result { - let requests: Vec = - serde_json::from_str(request_json).map_err(|error| error.to_string())?; - let responses: Result, String> = - requests.into_par_iter().map(format_sql).collect(); - serde_json::to_string(&responses?).map_err(|error| error.to_string()) -} - /// Format requests in parallel, in order; a request that fails is declined with its reason. pub(crate) fn format_requests(requests: Vec) -> Vec { requests diff --git a/crates/sqlbuild-rules/src/sql_lint/main/batch_formatter.rs b/crates/sqlbuild-rules/src/sql_lint/main/batch_formatter.rs deleted file mode 100644 index d3920372af..0000000000 --- a/crates/sqlbuild-rules/src/sql_lint/main/batch_formatter.rs +++ /dev/null @@ -1,5 +0,0 @@ -use crate::sql_lint::_helpers::formatter::format_batch_json_impl; - -pub fn format_batch_json(request_json: &str) -> Result { - format_batch_json_impl(request_json) -} diff --git a/crates/sqlbuild-rules/src/sql_lint/main/mod.rs b/crates/sqlbuild-rules/src/sql_lint/main/mod.rs index 6fdc141f76..fdc751309d 100644 --- a/crates/sqlbuild-rules/src/sql_lint/main/mod.rs +++ b/crates/sqlbuild-rules/src/sql_lint/main/mod.rs @@ -1,6 +1,5 @@ pub mod backtick_identifiers; pub mod batch_engine; -pub mod batch_formatter; pub mod catalogue; pub mod cross_join_subject; pub mod engine; diff --git a/crates/sqlbuild-rules/src/sql_lint/tests/helpers.rs b/crates/sqlbuild-rules/src/sql_lint/tests/helpers.rs index 830abb4d14..7201b18958 100644 --- a/crates/sqlbuild-rules/src/sql_lint/tests/helpers.rs +++ b/crates/sqlbuild-rules/src/sql_lint/tests/helpers.rs @@ -3,9 +3,10 @@ use std::str::FromStr; use polyglot_sql::{Dialect, DialectType}; use serde_json::{Map, Value, json}; -use crate::sql_lint::main::batch_formatter::format_batch_json; +use crate::sql_lint::_helpers::formatter::format_requests; use crate::sql_lint::main::engine::lint_json; use crate::sql_lint::main::formatter::format_json; +use crate::sql_lint::models::FormatRequest; use crate::sql_lint::tests::test_types::CrossJoinTestCase; use sqlbuild_analysis::sql_tokens::constants::CALL_SYNTAX_FUNCTIONS; use sqlbuild_analysis::sql_tokens::main::builtin_function_names::builtin_function_names; @@ -15,6 +16,13 @@ use sqlbuild_analysis::sql_tokens::main::query_fingerprint::query_fingerprint; /// The dependency sentinel the cross join cases name `order_policy`. pub(crate) const POLICY_SENTINEL: &str = "__sqb_lint_7__"; +/// Format a JSON array of format requests in parallel, as a JSON array of responses. +pub(crate) fn format_batch_json(request_json: &str) -> Result { + let requests: Vec = + serde_json::from_str(request_json).map_err(|error| error.to_string())?; + serde_json::to_string(&format_requests(requests)).map_err(|error| error.to_string()) +} + pub(crate) fn nested_function_sql(depth: usize) -> String { format!("SELECT {}1{}", "F(".repeat(depth), ")".repeat(depth)) } diff --git a/crates/sqlbuild-rules/src/sql_lint/tests/test_sql_lint.rs b/crates/sqlbuild-rules/src/sql_lint/tests/test_sql_lint.rs index ab2d111445..35f1297fbb 100644 --- a/crates/sqlbuild-rules/src/sql_lint/tests/test_sql_lint.rs +++ b/crates/sqlbuild-rules/src/sql_lint/tests/test_sql_lint.rs @@ -1,8 +1,8 @@ use serde_json::{Value, json}; -use crate::sql_lint::main::batch_formatter::format_batch_json; use crate::sql_lint::main::engine::lint_json; use crate::sql_lint::main::formatter::format_json; +use crate::sql_lint::tests::helpers::format_batch_json; use crate::sql_lint::tests::{helpers, test_types}; #[test] diff --git a/fensu.toml b/fensu.toml index 5680636ba3..7acee3cbaf 100644 --- a/fensu.toml +++ b/fensu.toml @@ -2146,7 +2146,6 @@ pending_budgets = [ "crates/sqlbuild-python/src/bindings/_helpers/rules/lint_preparation.rs=1", "crates/sqlbuild-python/src/bindings/_helpers/rules/native_header_parser.rs=1", "crates/sqlbuild-python/src/bindings/_helpers/rules/project_tree_queries.rs=8", - "crates/sqlbuild-python/src/bindings/_helpers/rules/results.rs=1", "crates/sqlbuild-python/src/bindings/_helpers/rules/rows.rs=6", "crates/sqlbuild-python/src/bindings/_helpers/rules/rule_api.rs=4", "crates/sqlbuild-python/src/bindings/_helpers/rules/rule_cache.rs=1", @@ -2166,7 +2165,6 @@ pending_budgets = [ "crates/sqlbuild-python/src/bindings/_helpers/scopes/compile_usages.rs=4", "crates/sqlbuild-python/src/bindings/_helpers/scopes/declaration_contexts.rs=6", "crates/sqlbuild-python/src/bindings/_helpers/scopes/declaration_resolution.rs=15", - "crates/sqlbuild-python/src/bindings/_helpers/scopes/relationship_names.rs=1", "crates/sqlbuild-python/src/bindings/_helpers/scopes/scope_cache.rs=2", "crates/sqlbuild-python/src/bindings/_helpers/scopes/scope_command.rs=8", "crates/sqlbuild-python/src/bindings/_helpers/scopes/scope_errors.rs=3", diff --git a/pyproject.toml b/pyproject.toml index aaa099b459..b53e3e6ba9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,7 +18,6 @@ dependencies = [ "polyglot-sql-chio==0.13.9", "pydantic-settings>=2,<3", "PyYAML>=6.0.2", - "rich>=15.0.0", "sqlbuild-cli==0.167.2", # x-release-please-version ] diff --git a/scripts/check_native_stub.py b/scripts/check_native_stub.py new file mode 100644 index 0000000000..68d4e906ae --- /dev/null +++ b/scripts/check_native_stub.py @@ -0,0 +1,14 @@ +"""Direct wrapper for the native stub drift check.""" + +from __future__ import annotations + +from scripts.native_stub.main.check import run_native_stub_check + + +def main(argv: list[str] | None = None) -> int: + """Check the native stub declares only registered names.""" + return run_native_stub_check(argv) + + +if __name__ == "__main__": + raise SystemExit(main()) diff --git a/scripts/native_stub/__init__.py b/scripts/native_stub/__init__.py new file mode 100644 index 0000000000..65d345924e --- /dev/null +++ b/scripts/native_stub/__init__.py @@ -0,0 +1 @@ +"""Checks that the native extension stub declares only registered names.""" diff --git a/scripts/native_stub/_helpers/__init__.py b/scripts/native_stub/_helpers/__init__.py new file mode 100644 index 0000000000..745233f86e --- /dev/null +++ b/scripts/native_stub/_helpers/__init__.py @@ -0,0 +1 @@ +"""Native stub check helpers.""" diff --git a/scripts/native_stub/_helpers/declarations.py b/scripts/native_stub/_helpers/declarations.py new file mode 100644 index 0000000000..458688408e --- /dev/null +++ b/scripts/native_stub/_helpers/declarations.py @@ -0,0 +1,38 @@ +"""Names a native stub promises exist at runtime.""" + +from __future__ import annotations + +import ast + +from scripts.native_stub.constants import PRIVATE_PREFIX, TYPING_ONLY_BASES + + +def runtime_declarations(stub_text: str) -> tuple[str, ...]: + """Top-level stub names that exist at runtime, excluding typing-only declarations, sorted.""" + names: set[str] = set() + for node in ast.parse(stub_text).body: + names.update(_declared_names(node)) + return tuple(sorted(names)) + + +def stub_drift(*, stub_text: str, registered: frozenset[str]) -> tuple[str, ...]: + """Runtime declarations in the stub that the extension does not register, sorted.""" + return tuple(name for name in runtime_declarations(stub_text) if name not in registered) + + +def _declared_names(node: ast.stmt) -> tuple[str, ...]: + if isinstance(node, ast.FunctionDef): + return (node.name,) + if isinstance(node, ast.ClassDef): + return () if _typing_only_class(node) else (node.name,) + if isinstance(node, ast.AnnAssign) and isinstance(node.target, ast.Name): + return (node.target.id,) + if isinstance(node, ast.Assign): + return tuple(target.id for target in node.targets if isinstance(target, ast.Name)) + return () + + +def _typing_only_class(node: ast.ClassDef) -> bool: + if node.name.startswith(PRIVATE_PREFIX): + return True + return any(ast.unparse(base).rsplit(".", 1)[-1] in TYPING_ONLY_BASES for base in node.bases) diff --git a/scripts/native_stub/constants.py b/scripts/native_stub/constants.py new file mode 100644 index 0000000000..c820348a97 --- /dev/null +++ b/scripts/native_stub/constants.py @@ -0,0 +1,6 @@ +"""Stable native stub check constants.""" + +NATIVE_MODULE: str = "sqlbuild._native" +STUB_PATH: str = "src/sqlbuild/_native.pyi" +TYPING_ONLY_BASES: frozenset[str] = frozenset({"Protocol", "TypedDict"}) +PRIVATE_PREFIX: str = "_" diff --git a/scripts/native_stub/main/__init__.py b/scripts/native_stub/main/__init__.py new file mode 100644 index 0000000000..b4f2d4c70a --- /dev/null +++ b/scripts/native_stub/main/__init__.py @@ -0,0 +1 @@ +"""Native stub check entrypoints.""" diff --git a/scripts/native_stub/main/check.py b/scripts/native_stub/main/check.py new file mode 100644 index 0000000000..17af5ff84c --- /dev/null +++ b/scripts/native_stub/main/check.py @@ -0,0 +1,28 @@ +"""Native stub check command entrypoint.""" + +from __future__ import annotations + +import argparse +import importlib +import sys +from pathlib import Path + +from scripts.native_stub._helpers.declarations import stub_drift +from scripts.native_stub.constants import NATIVE_MODULE, STUB_PATH + + +def run_native_stub_check(argv: list[str] | None = None) -> int: + """Fail when the stub declares a runtime name the built native extension does not register.""" + parser: argparse.ArgumentParser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--root", type=Path, default=Path.cwd()) + arguments: argparse.Namespace = parser.parse_args(argv) + registered: frozenset[str] = frozenset(dir(importlib.import_module(NATIVE_MODULE))) + stub_text: str = (arguments.root / STUB_PATH).read_text(encoding="utf-8") + missing: tuple[str, ...] = stub_drift(stub_text=stub_text, registered=registered) + if missing: + print(f"{STUB_PATH} declares names {NATIVE_MODULE} does not register:", file=sys.stderr) + for name in missing: + print(f"- {name}", file=sys.stderr) + return 1 + print(f"{STUB_PATH} declares only registered names.") + return 0 diff --git a/src/sqlbuild/_native.pyi b/src/sqlbuild/_native.pyi index fb65575531..fb3786b731 100644 --- a/src/sqlbuild/_native.pyi +++ b/src/sqlbuild/_native.pyi @@ -37,7 +37,6 @@ from sqlbuild.adapter.contract.types import ( TypeDialect, ) from sqlbuild.adapter.relations.models import InspectionQueryRecord, StatementMetadataEffect -from sqlbuild.cli.compile_reuse.models import CompileReuseRequest from sqlbuild.compiler.auditing.types import ( AuditAttachmentKind, AuditEvaluationMode, @@ -100,10 +99,6 @@ from sqlbuild.executor.run.models import ( MicrobatchBatchProgress, ModelExecutionResult, ) -from sqlbuild.executor.scenario.models import ( - ScenarioRunResult, - ScenarioSnapshotCaptureRunResult, -) from sqlbuild.executor.testing.models import ( SqlTestExecutionResult, StepResult, @@ -282,9 +277,6 @@ class LintPreparationRequest(TypedDict): prior_sites: list[int] dialect: str -def analyze_column_references_json(request_json: str) -> str: ... -def selected_sql_rule_codes(*, select: list[str], ignore: list[str]) -> list[str]: ... - class NativeRulesRequest: """A natively built rules request held until it is evaluated once.""" @@ -301,7 +293,6 @@ def build_rules_request( include_type_proof: bool, cache_directory: str | None = None, ) -> NativeRulesRequest: ... -def evaluate_rules_request(request: NativeRulesRequest) -> NativeRulesEvaluation: ... def emit_orjson_report(report: object) -> str: ... def emit_json_report(report: object) -> str: ... @@ -419,32 +410,6 @@ class NativeResourceFailure: @property def error(self) -> Exception: ... -class NativeModelFacts: - @property - def deps(self) -> list[tuple[str, str]]: ... - @property - def dynamic_contract( - self, - ) -> ( - tuple[ - bool, - list[tuple[str, str | None, str]], - list[tuple[str, str | None]], - list[str], - str | None, - bool, - ] - | None - ): ... - @property - def syntax_valid(self) -> bool: ... - -class NativeProjectFacts: - @property - def models(self) -> tuple[NativeModelFacts, ...]: ... - @property - def resources(self) -> NativeProjectResources: ... - type FixtureKey = tuple[CompiledResourceType, str] type InputColumns = Callable[[str, str], frozenset[str] | None] type FixtureGroups = tuple[tuple[CompiledResourceType, dict[str, str]], ...] @@ -1139,22 +1104,6 @@ class QueryShape(NativeRecord): ) -> None: ... def __replace__(self, **changes: Any) -> QueryShape: ... -class PlanOutputExtras(NativeRecord): - """Optional supplemental seed fingerprints and precomputed SQL tests for plan assembly.""" - - seed_version_hashes: dict[str, str] | None - seed_metadata_jsons: dict[str, str] | None - seed_plan_reasons: dict[str, PlanReason] | None - planned_sql_tests: PlannedSqlTests | None - def __init__( - self, - seed_version_hashes: dict[str, str] | None = ..., - seed_metadata_jsons: dict[str, str] | None = ..., - seed_plan_reasons: dict[str, PlanReason] | None = ..., - planned_sql_tests: PlannedSqlTests | None = ..., - ) -> None: ... - def __replace__(self, **changes: Any) -> PlanOutputExtras: ... - class PlannedSqlTests(NativeRecord): """SQL test entries planned for one selection; reusable only for the same selection.""" @@ -1957,9 +1906,6 @@ def apply_typed_cursor_replay_policy( backfill_duration: Duration | str | None, has_start_override: bool, ) -> CursorScalar: ... -def cursor_inputs_without_rows( - *, cursor_snapshot: ModelCursorSnapshot -) -> EmptyCursorInputDecision: ... def decide_empty_cursor_inputs( *, empty_input_names: tuple[str, ...], @@ -1975,13 +1921,6 @@ def empty_input_rebuild_refusal( input_names: tuple[str, ...], cursor_type: str | None, ) -> tuple[str, str]: ... -def unreadable_cursor_inputs_error( - *, - model_name: str, - cursor_type: str | None, - input_names: tuple[str, ...], -) -> PlannerInputError: ... -def without_destination_cursor(*, cursor_snapshot: ModelCursorSnapshot) -> ModelCursorSnapshot: ... def resolve_effective_timestamp_grain( *, cursor_type: str | None, @@ -2041,90 +1980,18 @@ def compiled_seed_record(seed: CompiledSeedView) -> CompiledSeed: ... def compiled_project_record( project: CompiledProjectView, *, include_sql_expansions: bool = True ) -> CompiledProject: ... -def with_binding_diagnostics( - *, model: CompiledModelView, diagnostics: tuple[CompilerDiagnostic, ...] -) -> CompiledModelView: ... -def with_type_recovery( - *, - model: CompiledModelView, - diagnostics: tuple[CompilerDiagnostic, ...], - poisoned: frozenset[tuple[str, str]], -) -> CompiledModelView: ... def project_with(*, project: CompiledProjectView, **changes: Any) -> CompiledProjectView: ... def inputs_with(*, inputs: CompileInputsView, **changes: Any) -> CompileInputsView: ... -def compile_inputs_view( - *, fields: dict[str, Any], native_project: NativeCompiledProject | None -) -> CompileInputsView: ... -def plain_typed_value(value: SqlValue) -> object: ... def declaration_rows( *, enums: Sequence[EnumDeclaration], constants: Sequence[ConstantDeclaration] ) -> tuple[list[tuple[object, ...]], list[tuple[object, ...]]]: ... -def record_model_analyses( - *, project: NativeCompiledProject, models: Sequence[CompiledModelView] -) -> int: ... def compiled_project_facts(project: CompiledProjectView) -> NativeCompiledProject: ... -def attach_resources( - *, - discovered_inputs: DiscoveredProjectInputs, - native_project: NativeCompiledProject, - settings: tuple[SettingsConfig, TargetConfig | None, str], - no_sql_validation: bool, - python_functions_inherit_default_namespace: bool, -) -> tuple[tuple[SeedInput, ...], tuple[FunctionInput, ...], tuple[SourceInput, ...]]: ... -def attach_checks( - *, - discovered_inputs: DiscoveredProjectInputs, - native_project: NativeCompiledProject, - settings: tuple[SettingsConfig, TypedSqlValueRenderer, SqlLexicalSyntax], - scan_cache: SqlTestScanCache, - source_inputs: tuple[SourceInput, ...], -) -> tuple[ - tuple[CompileSqlTestInput, ...], - tuple[CompileSqlScenarioInput, ...], - tuple[AuditInput, ...], - tuple[CompilerDiagnostic, ...], -]: ... -def build_effective_connection( - *, - project_config: ProjectConfig, - local_config: LocalConfig, - target_config: TargetConfig | None, - effective_vars: dict[str, object], -) -> dict[str, object]: ... -def build_effective_settings( - *, project_config: ProjectConfig, local_config: LocalConfig -) -> SettingsConfig: ... -def build_effective_vars( - *, - project_config: ProjectConfig, - local_config: LocalConfig, - target_config: TargetConfig | None, - cli_vars: dict[str, object], -) -> dict[str, object]: ... def native_model_config_session( *, inputs: NativeModelConfigInputs, validator: NativeModelValidator ) -> NativeModelConfigSession: ... -def build_model_inputs( - *, - discovered_inputs: DiscoveredProjectInputs, - context: ModelInputBuildContext, - no_sql_validation: bool = False, - defer_model_sql_validation: bool = False, - external_sql_reference_resolver: ExternalSqlReferenceResolver | None = None, - native_project: NativeCompiledProject, -) -> tuple[ModelInput, ...]: ... def build_compile_target_context( *, discovered_inputs: DiscoveredProjectInputs, selected_target: str | None, no_cache: bool ) -> tuple[str | None, TargetConfig | None, Path | None]: ... -def build_effective_target_namespace( - *, - discovered_inputs: DiscoveredProjectInputs, - selected_target: str | None, - connection_database: object | None, - connection_schema: object | None, - default_database: str | None, - default_schema: str | None, -) -> tuple[str | None, TargetConfig | None, str | None, str | None]: ... def build_declaration_scope( *, discovered_inputs: DiscoveredProjectInputs, @@ -2160,21 +2027,6 @@ class NativeMacroExpansion: def declaration_read(self, kind: str, name: str) -> None: ... def block_memo(self) -> None: ... -class NativeModelLoop: - def __init__( - self, - checks: tuple[object, dict[str, object], dict[str, object]], - syntax: dict[str, object], - reserved_markers: list[str], - settings: tuple[tuple[bool, bool, bool, bool], str], - ) -> None: ... - def run( - self, - project: NativeCompiledProject, - host: object, - model_files: list[DiscoveredSqlModelFile], - ) -> list[NativeModelInput]: ... - def relation_key_row( kind: str, name: str, values: dict[str, object], entry: object ) -> RelationKeyRow: ... @@ -2198,15 +2050,6 @@ def prepare_lint_body( context: SqlExpansionContext, dialect: str, ) -> LintBody: ... -def plan_rule_fixes( - *, - project_dir: Path, - files: dict[Path, str], - config: LintConfig, - adapter: TypedSqlValueRenderer | None, - discovered_inputs: DiscoveredProjectInputs | None, - enabled: bool, -) -> tuple[dict[Path, str], tuple[RuleFixResult, ...], list[LintViolation]]: ... def fix_verdict( *, before: CompileFacts, after: CompileFacts, edited: frozenset[Path] ) -> FixVerdict: ... @@ -2218,7 +2061,6 @@ def build_lint_expansion_context( declaration_scope: DeclarationScopeBuild | None = None, static_declaration_scope: DeclarationScopeBuild | None = None, ) -> SqlExpansionContext: ... -def write_atomically(*, path: Path, contents: str) -> None: ... def build_dag_json( *, graph: ProjectGraph, project_name: str, python_graph: PythonNodeGraph | None = None ) -> str: ... @@ -2262,12 +2104,6 @@ class NativeProjectGraph: ) -> list[_GraphKey]: ... def parse_project_selector(raw: str) -> ParsedSelector | PathSelector: ... -def resolve_graph_selection( - *, graph: NativeProjectGraph, select: Sequence[str], exclude: Sequence[str] -) -> frozenset[CompiledObjectKey]: ... -def select_project_graph( - *, graph: ProjectGraph, select: Sequence[str], exclude: Sequence[str] -) -> frozenset[CompiledObjectKey]: ... def resolve_project_selectors( *, select: Sequence[str], @@ -2278,28 +2114,6 @@ def resolve_project_selectors( tag_index: Mapping[str, Iterable[CompiledObjectKey]], path_index: Mapping[CompiledObjectKey, str], ) -> frozenset[CompiledObjectKey]: ... -def resolve_project_selector_tokens( - *, - selectors: Sequence[str], - all_keys: Mapping[str, CompiledObjectKey], - upstream_deps: Mapping[CompiledObjectKey, tuple[CompiledObjectKey, ...]], - downstream_deps: Mapping[CompiledObjectKey, tuple[CompiledObjectKey, ...]], - tag_index: Mapping[str, Iterable[CompiledObjectKey]], - path_index: Mapping[CompiledObjectKey, str], -) -> frozenset[CompiledObjectKey]: ... -def match_project_selector( - *, - parsed: ParsedSelector, - all_keys: Mapping[str, CompiledObjectKey], - tag_index: Mapping[str, Iterable[CompiledObjectKey]], - path_index: Mapping[CompiledObjectKey, str], -) -> frozenset[CompiledObjectKey]: ... -def expand_project_upstream_keys( - *, - key: CompiledObjectKey, - upstream_deps: Mapping[CompiledObjectKey, tuple[CompiledObjectKey, ...]], -) -> frozenset[CompiledObjectKey]: ... -def unit_test_selector_error(*, selector: str) -> PlannerInputError: ... def split_project_unit_test_selectors( *, select: Sequence[str], @@ -2307,81 +2121,15 @@ def split_project_unit_test_selectors( discovered_inputs: DiscoveredProjectInputs, accepts_unit_tests: bool, ) -> UnitTestSelectorSplit: ... -def split_unit_test_selectors( - *, - select: Sequence[str], - exclude: Sequence[str], - discovered_inputs: DiscoveredProjectInputs, -) -> UnitTestSelectorSplit: ... -def reject_unit_test_selectors( - *, - select: Sequence[str], - exclude: Sequence[str], - discovered_inputs: DiscoveredProjectInputs, -) -> UnitTestSelectorSplit: ... def split_selector_expansion(raw: str) -> SelectorExpansion: ... def resolve_sqlbuild_model_selector_names( *, project: CompiledProjectView, term: str ) -> tuple[tuple[str, ...], str | None]: ... - -class NativeReuseAttempt: - def outcome(self) -> str: ... - def store_path(self) -> str: ... - def replay_failed(self) -> bool: ... - def snapshot_paths(self) -> int: ... - def pending_digest_bytes(self) -> int: ... - def replay(self, timings: list[tuple[str, int]]) -> tuple[str, list[str], int] | None: ... - def digested_files(self) -> int: ... - def launch_identity(self) -> tuple[str, dict[str, str], list[str]]: ... - def record(self, record: dict[str, object]) -> tuple[str, int]: ... - -def check_compile_reuse(check: dict[str, object]) -> NativeReuseAttempt: ... def run_compile(request: CompileCommandRequest) -> int: ... -class CompileReuseAttempt: - """Result of checking for a reusable compile, carried into a full compile on a miss.""" - - outcome: str - project_dir: Path - started: float - check_ms: int - exit_code: int | None - entry_path: Path | None - native: NativeReuseAttempt | None - selected_target: str | None - json_output: bool - def __init__( - self, - *, - outcome: str, - project_dir: Path, - started: float, - check_ms: int = 0, - exit_code: int | None = None, - entry_path: Path | None = None, - native: NativeReuseAttempt | None = None, - selected_target: str | None = None, - json_output: bool = False, - ) -> None: ... - COMPILE_REUSE_RACY_WINDOW_NS: int COMPILE_REUSE_EXCLUDED_ROOT_DIRECTORIES: frozenset[str] -def attempt_compile_reuse(*, request: CompileReuseRequest) -> CompileReuseAttempt: ... - -class CompileArtifactWrites: - @property - def artifacts(self) -> dict[str, tuple[str | None, int | None, int | None]]: ... - -class RecordedCompileOutput: - def print_stderr_line(self, line: str) -> None: ... - def record_stdout(self, text: str) -> None: ... - def print_stdout(self) -> None: ... - @property - def stderr_lines(self) -> list[str]: ... - @property - def stdout(self) -> str | None: ... - def format_plan( *, plan: PlanOutput, @@ -2484,7 +2232,6 @@ def write_cost_run(*, project_dir: Path, record: CostRunRecord) -> Path: ... def read_cost_run(*, project_dir: Path, run_id: str) -> CostRunRecord | None: ... def list_cost_runs(*, project_dir: Path) -> tuple[CostRunRecord, ...]: ... def resolve_cost_run(*, project_dir: Path, selector: str) -> CostRunRecord | None: ... -def format_cost_json(record: CostRunRecord) -> str: ... def resolve_defer_clone_selection(*, scope: PlannerScope) -> tuple[list[str], list[str], int]: ... def run_check_read_side_dependencies( *, @@ -2500,16 +2247,6 @@ def run_check_read_side_dependencies( providers: ProviderContainer | None = None, ) -> tuple[PythonNodeExecutionResult, ...]: ... def finalize_build_cost(finalization: BuildCostFinalization) -> CostRunRecord | None: ... -def persist_cost_run( - *, project_dir: Path, record: CostRunRecord, output_stream: TextIO, stage: str -) -> None: ... -def write_build_cost_breakdown( - *, record: CostRunRecord, output_stream: TextIO, use_color: bool -) -> None: ... -def format_cost_history_json( - *, records: tuple[CostRunRecord, ...], matching_count: int | None = None -) -> str: ... -def cost_output_payload(*, record: CostRunRecord) -> dict[str, object]: ... def format_cost_breakdown( *, record: CostRunRecord, @@ -2518,32 +2255,10 @@ def format_cost_breakdown( terminal_width: int | None = None, show_run_id: bool = True, ) -> str: ... -def format_cost_history( - *, records: tuple[CostRunRecord, ...], matching_count: int, use_color: bool -) -> str: ... def format_summary_footer( *, counts: tuple[tuple[str, int], ...], use_color: bool, elapsed: str | None = None ) -> str: ... def format_count_noun(*, count: int, singular: str, plural: str | None = None) -> str: ... -def format_completion_line( - *, style: CliStyle, state: CompletionState, label: str, summary: str | None = None -) -> str: ... -def format_status_cell(*, style: CliStyle, status: str, width: int = 6) -> str: ... -def format_aligned_name_value( - *, - plain_name: str, - styled_name: str, - value: str, - name_column_width: int, - prefix: str = " ", -) -> str: ... -def resolve_name_column_width( - *, names: list[str] | tuple[str, ...], min_width: int = 20 -) -> int: ... -def append_overflow_line( - *, lines: list[str], total_count: int, visible_count: int, indent: str, options: DisplayOptions -) -> list[str]: ... -def visible_entries[T](*, entries: Sequence[T], options: DisplayOptions) -> Sequence[T]: ... class CountHeaderStyle: def __call__(self, text: str) -> str: ... @@ -2580,32 +2295,7 @@ def update_sqlbuild_skills( ) -> SkillUpdateResult: ... def maintain_sqlbuild_skills(*, project_dir: Path) -> SkillMaintenanceResult: ... def load_packaged_skill_files() -> dict[str, str]: ... -def run_skills_command( - *, - project_dir: Path | None, - global_install: bool = False, - targets: tuple[str, ...] = (), - force: bool = False, -) -> int: ... def run_playground_command(request: PlaygroundCommandRequest) -> int: ... -def validate_cli_warehouse(*, cli_warehouse: str | None, project_dir: Path) -> None: ... -def resolve_command_warehouse( - *, - discovered_inputs: DiscoveredProjectInputs | None, - selected_target: str | None, - group: WarehouseGroup | None, - cli_warehouse: str | None, - connection_config: dict[str, object], - cli_vars: dict[str, object] | None = None, -) -> ResolvedWarehouse: ... -def apply_command_warehouse( - *, - config: dict[str, object], - adapter_name: str, - project_dir: Path | None, - discovered_inputs: DiscoveredProjectInputs | None, - selected_target: str | None, -) -> dict[str, object]: ... def describe_connection_warehouse( *, discovered_inputs: DiscoveredProjectInputs, @@ -2636,49 +2326,15 @@ def resolve_target_connection_config( target_name: str, cli_vars: dict[str, object] | None = None, ) -> dict[str, object]: ... -def validate_preview_target( - *, discovered_inputs: DiscoveredProjectInputs, as_target: str | None, command_name: str -) -> None: ... def normalize_dbt_profile_connection( *, resolved: ResolvedDbtProfileOutput ) -> NormalizedDbtProfileConnection: ... def coerce_dbt_profile_bool(value: object) -> bool: ... def coerce_dbt_profile_number(value: object) -> int | float: ... -def build_dbt_init_project_toml( - *, - project_name: str, - adapter: str, - target_name: str, - profile_name: str, - dbt_project_dir: str, - profiles_dir: str, - target_path: str, - target_schema: str | None, - target_database: str | None, -) -> str: ... -def load_dbt_manifest_index(*, manifest_path: Path) -> DbtManifestIndex: ... -def build_compile_dbt_manifest_index( - *, manifest_contents: str | None -) -> DbtManifestIndex | None: ... def build_dbt_manifest_index(*, raw_data: object) -> DbtManifestIndex: ... def resolve_dbt_manifest_model( *, manifest: DbtManifestIndex, name: str, package_name: str | None = None ) -> DbtManifestModel: ... -def validate_compile_dbt_model_names( - *, known_model_names: Iterable[str], dbt_manifest: DbtManifestIndex | None -) -> None: ... -def validate_compile_dbt_model_reference( - *, - reference: CompileSqlReference, - model_relative_path: Path, - dbt_manifest: DbtManifestIndex | None, -) -> None: ... -def resolve_sqlbuild_model_dbt_refs( - *, - project: CompiledProjectView, - manifest: DbtManifestIndex, - selected_model_names: Iterable[str] | None = None, -) -> tuple[tuple[CompiledModelView, DbtManifestModel], ...]: ... class DbtCombinedGraph: @property @@ -2709,16 +2365,12 @@ def build_merged_dbt_execution_argv( routed_args: Sequence[str], plan: DbtInteropPlan, ) -> tuple[str, ...] | None: ... -def dbt_execution_ls_argv(*, argv: Sequence[str]) -> list[str] | None: ... def build_failed_sqlbuild_model_names( *, graph: DbtCombinedGraph, manifest: DbtManifestIndex, node_results: Sequence[DbtNodeExecutionResult], ) -> tuple[str, ...]: ... -def render_dbt_execution_summary_footer( - *, node_results: Sequence[DbtNodeExecutionResult], use_color: bool -) -> str | None: ... def plan_dbt_interop_command( *, command: DbtInteropCommand | str, @@ -2729,7 +2381,6 @@ def plan_dbt_interop_command( dbt_options: DbtCliOptions, command_args: DbtInteropCommandArgs, ) -> DbtInteropPlan: ... -def resolve_dbt_executable() -> str: ... class DbtRunner: dbt_executable: str @@ -2765,7 +2416,6 @@ def execute_dbt_json_event_stream( enable_status: bool = True, ) -> tuple[int, tuple[DbtNodeExecutionResult, ...]]: ... def build_dbt_init_project(*, request: DbtInitRequest) -> DbtInitResult: ... -def validate_dbt_init_project(*, request: DbtInitRequest) -> None: ... def build_dbt_compile_argv( *, dbt_executable: str, options: DbtCliOptions, full_refresh: bool = False ) -> tuple[str, ...]: ... @@ -2773,13 +2423,6 @@ def build_dbt_deps_argv(*, dbt_executable: str, options: DbtCliOptions) -> tuple def build_dbt_debug_argv( *, dbt_executable: str, options: DbtCliOptions, args: Sequence[str] | None = None ) -> tuple[str, ...]: ... -def build_dbt_command_argv( - *, - dbt_executable: str, - command: str, - options: DbtCliOptions, - args: Sequence[str] | None = None, -) -> tuple[str, ...]: ... def build_dbt_ls_argv( *, dbt_executable: str, @@ -2814,12 +2457,6 @@ def debug_dbt_from_project( stdout_stream: TextIO, stderr_stream: TextIO, ) -> int: ... -def resolve_dbt_connection_config( - *, - request: DbtInteropExecutionRequest, - invocation: DbtInteropInvocation, - compiled: DbtInteropCompiledProject, -) -> dict[str, object]: ... def write_dbt_execution_plan_text( *, request: DbtInteropExecutionRequest, @@ -2848,35 +2485,12 @@ def resolve_sqlbuild_execution_plan_output( plan: DbtInteropPlan, failed_sqlbuild_model_names: tuple[str, ...], ) -> PlanOutput | None: ... -def run_dbt_sqlbuild_work( - *, - request: DbtInteropExecutionRequest, - invocation: DbtInteropInvocation, - compiled: DbtInteropCompiledProject, - plan_output: PlanOutput, - connection_config: dict[str, object], -) -> int: ... def write_sqlbuild_skip_notice( *, request: DbtInteropExecutionRequest, invocation: DbtInteropInvocation, message: str, ) -> None: ... -def execute_dbt_sqlbuild_work( - *, - context: DbtSqlbuildWorkContext, - command: DbtInteropCommand, - project: CompiledProjectView, - project_dir: Path, - fail_fast: bool, - verbose: bool, -) -> int: ... -def build_sqlbuild_plan_output( - *, - environment: DbtPlanEnvironment, - request: DbtSqlbuildPlanRequest, - hooks: ConnectionHooks, -) -> PlanOutput | None: ... def attach_sqlbuild_plan_output( *, plan: DbtInteropPlan, @@ -2887,7 +2501,6 @@ def attach_sqlbuild_plan_output( connection_progress: Any | None, on_progress: Callable[[str], None] | None, ) -> DbtInteropPlan: ... -def dbt_failure_detail(result: DbtCommandResult) -> str | None: ... def load_compiled_dbt_manifest( *, runner: DbtRunner, @@ -2966,9 +2579,6 @@ class DbtCompileReferenceResolver: def build_compile_reference_resolver( *, manifest_contents: str | None ) -> ExternalSqlReferenceResolver | None: ... -def resolve_external_sql_reference_resolver( - *, project_dir: Path, discovered_inputs: DiscoveredProjectInputs -) -> ExternalSqlReferenceResolver | None: ... def resolve_dbt_config( *, project_root: Path, @@ -2977,13 +2587,6 @@ def resolve_dbt_config( require_project_dir: bool, local_config: LocalDbtConfig | None = None, ) -> ResolvedDbtConfig: ... -def resolve_dbt_reference_relation( - *, - manifest: DbtManifestIndex | None, - ref_kind: str, - ref_name: str, - ref_package: str | None, -) -> str | None: ... def build_dbt_interop_plan( *, command: DbtInteropCommand | str, @@ -3084,19 +2687,9 @@ def render_diff_output( suppress_example_values: bool = ..., outcome: str | None = ..., ) -> str: ... -def render_diff_error_json( - *, - status: str, - code: str, - message: str, - help_text: str | None = ..., - size_guard: dict[str, object] | None = ..., -) -> str: ... -def run_diff_command(*, request: DiffCommandRequest) -> int: ... def execute_query_diff( *, request: DiffCommandRequest, preparation: QueryDiffPreparation ) -> DiffExecutionResult: ... -def machine_output_mode(args: CliNamespace, /) -> bool: ... class CliObservabilityScope: def __enter__(self) -> EventDispatcher: ... @@ -3211,11 +2804,6 @@ class EventExporterDispatcher: def finalize_when_idle(self, finalizer: Callable[[], object], /) -> None: ... def summary(self) -> EventExportSummary: ... -class DispatcherWorker: - def __call__(self) -> None: ... - -def stop_event_exporter_threads() -> None: ... - class EventExporterCommandScope: """Bind discovered typed sinks and own their command-scoped provider session.""" @@ -3254,16 +2842,6 @@ class EventExporterCommandScope: def close(self) -> EventExportSummary: ... def export_output(self, records: tuple[CommandOutputRecord, ...]) -> None: ... -class ProviderSessionCloser: - def __call__(self) -> None: ... - -class EventExporterScopeContext: - def __enter__(self) -> EventExporterCommandScope: ... - def __exit__(self, *exc_info: object) -> bool: ... - -def event_exporter_command_scope( - scope: EventExporterCommandScope, / -) -> EventExporterScopeContext: ... def current_event_exporter_command_scope() -> EventExporterCommandScope | None: ... def cached_event_exporter_extensions( *, project_dir: Path @@ -3303,11 +2881,6 @@ class OutputCaptureDispatcher: def append(self, *, stream: CommandOutputStream, text: str) -> None: ... def close(self) -> CommandOutputCaptureSummary: ... -class OutputDeliveryWorker: - def __call__(self) -> None: ... - -def stop_output_capture_threads() -> None: ... - class CommandOutputContext: def __enter__(self) -> None: ... def __exit__(self, *exc_info: object) -> bool: ... @@ -3508,18 +3081,6 @@ class DbtEventStream: ) -> None: ... def consume(self, line: str) -> DbtEventStreamUpdate | None: ... -def render_dbt_node_result( - *, - result: DbtNodeExecutionResult, - use_color: bool, - display_index: int | None = None, - display_total: int | None = None, - detail: str = "", -) -> str: ... -def format_dbt_active_node_status( - *, active_nodes: Sequence[tuple[str, float]], now: float -) -> str: ... - class CliNamespace: command: str | None project_dir: str | None @@ -3700,11 +3261,6 @@ class CliNamespace: def __init__(self) -> None: ... -class DbtInitProgressReporter: - def __init__(self, *, stream: TextIO, use_color: bool) -> None: ... - def start(self, message: str) -> None: ... - def complete(self, message: str) -> None: ... - class PlanningProgressReporter: def __init__(self, *, stream: TextIO, use_color: bool = False) -> None: ... def on_progress(self, message: str) -> None: ... @@ -3722,11 +3278,9 @@ class VerboseInspectionWriter: @staticmethod def format_record(*, record: InspectionQueryRecord) -> str: ... -def format_execution_header(*, command: str, target: str | None, concurrency: int) -> str: ... def write_execution_header( *, stream: TextIO, command: str, target: str | None, concurrency: int, use_color: bool ) -> None: ... -def format_expectation_name(model_name: str) -> str: ... def format_expectation_detail(step_result: StepResult) -> str: ... def format_build_footer( *, @@ -3781,21 +3335,6 @@ def format_audit_execution_json( configured_concurrency: int = 1, worker_count: int | None = None, ) -> str: ... -def format_scenario_execution_json( - *, - results: tuple[ScenarioRunResult, ...], - local: bool = False, - run_namespace: str | None = None, - namespace_source: str = "unset", - duration_ms: float | None = None, -) -> str: ... -def format_scenario_snapshot_execution_json( - *, - results: tuple[ScenarioSnapshotCaptureRunResult, ...], - refresh: bool = False, - run_namespace: str | None = None, - namespace_source: str = "unset", -) -> str: ... def format_degradable_build_execution_json( *, result: BuildExecutionResult, @@ -3807,30 +3346,12 @@ def format_degradable_build_execution_json( run_id: str | None = None, cost: dict[str, object] | None = None, ) -> str: ... -def write_execution_json_output( - *, payload: str, json_output: bool, json_output_path: Path | None -) -> None: ... def format_plan_json( *, plan: PlanOutput, python_plan_entries: tuple[PythonPlanEntry, ...] = () ) -> str: ... -def serialize_future_cursor_safety( - evidence: FutureCursorSafetyEvidence | None, -) -> dict[str, object] | None: ... def serialize_maximum_start_safety( evidence: MaximumStartSafetyEvidence | None, ) -> dict[str, object] | None: ... -def write_reusable_compile( - *, - attempt: CompileReuseAttempt, - output: RecordedCompileOutput, - exit_code: int, - input_reads: CompileInputReads, - artifact_writes: CompileArtifactWrites, - compile_cache_enabled: bool, - artifacts_written: bool, - dag_artifact_path: Path | None, - json_output: bool, -) -> None: ... def format_compile_text( *, graph: ProjectGraph, @@ -3855,12 +3376,6 @@ def format_compile_json( selected_keys: frozenset[CompiledObjectKey] | None = None, sql_validation_enabled: bool = True, ) -> str: ... -def format_compile_error_json( - *, code: str, message: str, help_text: str | None, location: SourceLocation | None = None -) -> str: ... - -class PlannedStaticSqlTests: ... - def write_static_compile_target( *, target_dir: Path, @@ -3875,12 +3390,6 @@ def write_compile_target( plan_output: PlanOutput, manifest: NativeManifest | None = None, ) -> WrittenTarget: ... -def static_sql_test_planning_diagnostics( - *, target_dir: Path, adapter: BaseAdapter, project: CompiledProjectView -) -> tuple[CompilerDiagnostic, ...]: ... -def plan_static_sql_tests( - *, target_dir: Path, adapter: BaseAdapter, project: CompiledProjectView -) -> PlannedStaticSqlTests: ... class PreparedCompileArtifacts: min_prepared_models: int @@ -3905,41 +3414,18 @@ class PreparedCompileArtifacts: ) -> WrittenTarget | None: ... def planning_diagnostics(self) -> tuple[CompilerDiagnostic, ...] | None: ... -def finalize_rule_findings_rows( - *, - config: RulesConfig, - project_dir: Path, - evaluated_codes: Sequence[str], - findings: Sequence[Finding], -) -> tuple[Finding, ...]: ... -def run_custom_host_json(spec_json: str) -> str: ... def format_sql_json(request_json: str) -> str: ... -def format_sql_batch_json(request_json: str) -> str: ... def query_fingerprint(sql: str, dialect: str) -> str: ... def lint_sql_json(request_json: str) -> str: ... -def lint_sql_batch_json(request_json: str) -> str: ... def prepare_lint_sql( request: LintPreparationRequest, ) -> tuple[str, list[tuple[str, int, int, int, int, str]], list[str]] | None: ... -def lint_backtick_identifiers(dialect: str) -> bool: ... def neutralize_lint_interpolation( body: str, dialect: str, for_formatting: bool = False ) -> tuple[str, list[tuple[str, int, int, int, int, str]]]: ... -def neutralize_lint_context_interpolation( - body: str, -) -> tuple[str, list[tuple[str, int, int, int, int, str]]]: ... -def neutralize_lint_audit_parameters( - body: str, -) -> tuple[str, list[tuple[str, int, int, int, int, str]]]: ... def restore_lint_interpolation( fixed: str, sites: list[tuple[str, int, int, int, int, str]] ) -> tuple[bool, str]: ... -def lint_interpolation_text_at(body: str, start: int, dialect: str) -> str | None: ... -def scan_fixture_typed_null_candidates( - project_dir: Path, selected_paths: frozenset[Path] | None = None -) -> tuple[frozenset[Path], frozenset[str]]: ... -def simplify_fixture_null_projections(*, sql: str, relation: Any) -> str: ... -def is_empty_fixture_query(sql: str) -> bool: ... def fixture_read_cache_info(*, reset: bool = False) -> tuple[int, int]: ... def fixture_planning_work_info(*, reset: bool = False) -> tuple[int, int]: ... def planner_identity_work_info(*, reset: bool = False) -> tuple[int, dict[str, int]]: ... @@ -3974,11 +3460,6 @@ def reject_lint_suppressions( project_dir: Path, ) -> list[LintViolation]: ... def load_rules_config(*, project_dir: Path) -> RulesConfig: ... -def valid_rules_config(*, project_dir: Path) -> RulesConfig | None: ... -def selected_rule_codes( - *, config: RulesConfig, custom_payloads: list[dict[str, object]] -) -> list[str]: ... -def rule_selected(*, config: RulesConfig, code: str) -> bool: ... def build_rule_catalogue( *, config: RulesConfig, project_dir: Path, include_custom: bool | None = None ) -> tuple[Rule, ...]: ... @@ -3989,25 +3470,11 @@ def select_catalogue_rules( project_dir: Path, custom_payloads: list[dict[str, object]] | None = None, ) -> tuple[Rule, ...]: ... -def resolve_rule_ignore_selectors( - *, config: RulesConfig, project: CompiledProjectView -) -> RulesConfig: ... def format_rule(*, rule: Rule, config: RulesConfig | None = None) -> str: ... def install_rules_skills(*, config: RulesConfig, project_dir: Path, check: bool) -> bool: ... -def match_model_headers(contents: list[str]) -> list[tuple[int, int, int] | None]: ... -def parse_model_headers( - headers: list[str], -) -> list[tuple[dict[str, object] | None, list[tuple[str, int, int]] | None, str | None]]: ... -def tokenize_model_header(header: str) -> list[tuple[int, str, int]]: ... -def model_output_columns( - contents: str, implicit_aliases: bool -) -> list[tuple[str, int, int, int, int]]: ... def model_header_column_locations( contents: str, header: str, header_start: int ) -> tuple[list[tuple[str, int, int, int, int]] | None, str | None]: ... -def model_header_failure( - error: str, header: str, header_line: int | None -) -> tuple[str, str | None, int | None]: ... class NativeProjectTree: def __init__(self, project_dir: str) -> None: ... @@ -4023,7 +3490,6 @@ class NativeDirectorySnapshotScope: def __exit__(self, *exc_info: object) -> bool: ... def directory_snapshot_scope(*, project_dir: Path) -> NativeDirectorySnapshotScope: ... -def active_directory_snapshot(*, project_dir: Path) -> NativeDirectorySnapshot | None: ... class DiscoveredSqlModelFile: """A discovered SQL model file and its raw contents.""" @@ -4065,18 +3531,6 @@ class DiscoveredSqlModelFile: def parse_schema_document(loaded: object, path: str, /) -> tuple[SchemaSeedEntry, ...]: ... def parse_sources_document(loaded: object, path: str, /) -> tuple[SourceEntry, ...]: ... -def analyze_compile_project( - *, - project_dir: Path, - no_sql_validation: bool, - selected_target: str | None, - lineage_mode: CompileLineageMode, - cli_vars: dict[str, object] | None, - profile_flags: CompileProfileFlags, - analysis_selection: CompileAnalysisSelection, - status: TransientStatusReporter | None, - prepared_artifacts: PreparedCompileArtifacts | None = None, -) -> CompileAnalysis: ... def build_compiled_project( *, discovered_inputs: DiscoveredProjectInputs, @@ -4129,19 +3583,6 @@ def assembly_stage_inputs( analysis_cache_dir: Path | None = None, analysis_model_names: frozenset[str] | None = None, ) -> dict[str, Any] | None: ... -def build_project_graph_with_analysis_selection( - *, - discovered_inputs: DiscoveredProjectInputs, - adapter: BaseAdapter, - analysis_selection: CompileAnalysisSelection, - selected_target: str | None = None, - no_sql_validation: bool = False, - skip_column_inference: bool = False, - column_lineage_mode: ColumnLineageMode = ..., - cli_vars: dict[str, object] | None = None, - external_sql_reference_resolver: ExternalSqlReferenceResolver | None = None, - on_progress: Callable[[str], None] | None = None, -) -> ProjectGraph: ... def build_project_graph( *, discovered_inputs: DiscoveredProjectInputs, @@ -4182,34 +3623,10 @@ def validate_project_targets(*, adapter_name: str, project: CompiledProjectView) def validate_managed_write_schemas( *, adapter: BaseAdapter, project: CompiledProjectView ) -> None: ... -def resolve_cursor_input_roles(*, model: CompiledModelView) -> CursorInputRoles: ... def model_placeholders(model_input: ModelInput, /) -> dict[str, str] | None: ... -def model_syntax_checks( - *, - model_inputs: tuple[ModelInput, ...], - analysis_model_names: frozenset[str] | None, - analysis_succeeded: frozenset[str], -) -> tuple[tuple[tuple[str, dict[str, str] | None], ...], ...]: ... -def standalone_pivot_models( - *, model_inputs: tuple[ModelInput, ...], analysed: Mapping[str, int] -) -> dict[int, tuple[str, tuple[SchemaDynamicColumnFamily, ...]]]: ... -def resolve_compile_analysis_selection( - *, options: CompilePipelineOptions, discovered_inputs: DiscoveredProjectInputs -) -> CompileAnalysisSelection | None: ... -def build_project_graph_from_compiled_project(*, project: CompiledProjectView) -> ProjectGraph: ... def plan_has_executable_work( *, plan: PlanOutput, python_plan_entries: tuple[PythonPlanEntry, ...] = () ) -> bool: ... -def build_static_pipeline_result( - *, context: StaticCommandContext, plan_output: PlanOutput -) -> CompilePipelineResult: ... -def run_compile_only_pipeline( - *, - discovered_inputs: DiscoveredProjectInputs, - adapter: BaseAdapter, - options: CompilePipelineOptions, - on_progress: Callable[[str], None] | None = None, -) -> CompilePipelineResult: ... def build_deferred_locations( *, project: CompiledProjectView, @@ -4219,72 +3636,22 @@ def build_deferred_locations( default_database: str | None, render_qualified_name: Callable[..., str | None], ) -> dict[str, CompiledRelationLocation]: ... -def resolve_deferred_target_config( - *, discovered_inputs: DiscoveredProjectInputs, defer_to: str, current_target_name: str | None -) -> TargetConfig: ... -def gather_deferred_relations( - *, - adapter: BaseAdapter, - connection: Any, - deferred_locations: dict[str, CompiledRelationLocation], -) -> dict[str, RelationInfo]: ... -def resolve_model_deferral_inputs( - *, - project: CompiledProjectView, - discovered_inputs: DiscoveredProjectInputs, - adapter: BaseAdapter, - connection: Any, - defer_to: str | None, -) -> DeferralInputs: ... -def build_python_relation_targets( +def build_python_relation_targets( *, adapter: BaseAdapter, project: CompiledProjectView, plan_output: PlanOutput, required_refs: frozenset[SqlResourceRef] | None = None, ) -> dict[SqlResourceRef, str]: ... -def build_project_relation_targets( - *, adapter: BaseAdapter, plan_output: PlanOutput -) -> dict[SqlResourceRef, str] | None: ... def resolve_diff_model_names( *, project: CompiledProjectView, select: tuple[str, ...], exclude: tuple[str, ...] ) -> tuple[str, ...]: ... -def run_diff_pipeline( - *, - discovered_inputs: DiscoveredProjectInputs, - adapter: BaseAdapter, - from_target: str, - to_target: str, - resolved_connection: dict[str, object], - no_sql_validation: bool, - select: tuple[str, ...], - exclude: tuple[str, ...], - cli_vars: dict[str, object] | None = None, - external_sql_reference_resolver: ExternalSqlReferenceResolver | None = None, -) -> tuple[CompiledProjectView, CompiledProjectView, tuple[str, ...]]: ... -def python_read_source_names_for( - *, discovered_inputs: DiscoveredProjectInputs, python_node_names: frozenset[str] -) -> frozenset[str]: ... -def build_python_run_plan_outputs( - *, - discovered_inputs: DiscoveredProjectInputs, - plan_output: PlanOutput, - run_selection: PythonSqlRunSelection | None, - selected_python_node_names: frozenset[str], -) -> PythonRunPlanOutputs: ... def build_python_plan_entries( *, lifecycle_plan: PythonSqlRunLifecyclePlan, python_graph: PythonNodeGraph, previous_identities: dict[tuple[str, str], Fingerprint] | None = None, ) -> tuple[PythonPlanEntry, ...]: ... -def compile_project_phase( - *, - discovered_inputs: DiscoveredProjectInputs, - adapter: BaseAdapter, - options: CompilePipelineOptions | None = None, - on_progress: Callable[[str], None] | None = None, -) -> CompiledProjectPhaseResult: ... def run_compile_pipeline( *, discovered_inputs: DiscoveredProjectInputs, @@ -4306,14 +3673,6 @@ def build_compile_inputs( no_cache: bool = False, ) -> CompileInputsView: ... def defer_compile_teardown_to_exit() -> None: ... -def run_compile_command( - request: CompileCommandRequest, reuse_attempt: CompileReuseAttempt | None = None -) -> int: ... -def validate_authored_sql_test_ctes( - test_files: tuple[DiscoveredSqlTestFile, ...], - scenario_files: tuple[DiscoveredSqlScenarioFile, ...], - syntax: dict[str, object], -) -> None: ... def validate_hook_sql_syntax( value: object, hook_name: str, @@ -4325,43 +3684,15 @@ def validate_sql_syntax( model: tuple[str, Path], parsing: tuple[dict[str, str] | None, str | None] = (None, None), ) -> None: ... -def hook_sql_statements(value: object) -> list[str]: ... def analyze_resolved_column_reads( *, query_sql: str, references: Sequence[CompileSqlReference], dialect: str | None ) -> tuple[CompiledLineageSourceFact, ...]: ... -def build_effective_target_config( - *, discovered_inputs: DiscoveredProjectInputs, selected_target: str | None = None -) -> TargetConfig | None: ... -def build_effective_connection_config( - *, - discovered_inputs: DiscoveredProjectInputs, - selected_target: str | None = None, - cli_vars: dict[str, object] | None = None, -) -> dict[str, object]: ... def build_effective_runtime_config( *, discovered_inputs: DiscoveredProjectInputs, selected_target: str | None = None, cli_vars: dict[str, object] | None = None, ) -> tuple[str | None, dict[str, object], str]: ... -def build_sql_expansion_context( - *, - project_dir: Path, - value_renderer: TypedSqlValueRenderer, - cli_vars: dict[str, object] | None = None, - discovered_inputs: DiscoveredProjectInputs | None = None, - declaration_scope: DeclarationScopeBuild | None = None, - static_declaration_scope: DeclarationScopeBuild | None = None, -) -> SqlExpansionContext: ... -def build_effective_settings_config( - *, discovered_inputs: DiscoveredProjectInputs -) -> SettingsConfig: ... -def public_declaration_indexes( - inputs: DiscoveredProjectInputs, -) -> tuple[dict[str, EnumDeclaration], dict[str, ConstantDeclaration]]: ... -def public_model_schema_index( - inputs: DiscoveredProjectInputs, -) -> dict[str, ModelSchemaDeclaration]: ... def validate_discovered_project_inputs( inputs: DiscoveredProjectInputs, nodes: list[dict[str, object]], / ) -> None: ... @@ -4427,13 +3758,10 @@ def discover_macro_files( *, project_dir: Path, isolate_declaration_kind: bool = False ) -> tuple[DiscoveredMacroFile, ...]: ... def discover_seed_files(*, project_dir: Path) -> tuple[DiscoveredSeedFile, ...]: ... -def discover_adapter_file(*, project_dir: Path) -> DiscoveredAdapterFile | None: ... -def retained_discovery_session(*, project_dir: Path) -> NativeDiscoverySession | None: ... def discover_scope_snapshot(*, project_dir: Path) -> TolerantScopeDiscovery: ... def discover_python_module_files( *, project_dir: Path, root: str, public_only: bool ) -> tuple[Path, ...]: ... -def discover_python_hook_files(*, project_dir: Path) -> tuple[dict[str, Any], ...]: ... def discover_python_function_files( *, project_dir: Path ) -> tuple[DiscoveredPythonFunctionFile, ...]: ... @@ -4459,26 +3787,6 @@ class NativeDeclarationContexts: self, resolver: object, file_path: object, resource: object | None = None ) -> tuple[Any, bool]: ... -class NativeScopeIndex: - @property - def index(self) -> ScopeIndex: ... - @property - def has_scoped_relationship_declarations(self) -> bool: ... - def grant_relationships( - self, - *, - discovered_inputs: DiscoveredProjectInputs, - syntax: SqlLexicalSyntax, - scan_store: tuple[SqlTestScanStore | None, str], - ) -> tuple[tuple[Path, str], ...]: ... - def index_with_relationships(self) -> ScopeIndex: ... - -def open_native_scope_index( - *, - discovered_inputs: DiscoveredProjectInputs, - loaded_macros: Mapping[str, LoadedMacro], - static_macros: tuple[StaticMacroExport, ...] = (), -) -> NativeScopeIndex: ... def build_scope_index( *, discovered_inputs: DiscoveredProjectInputs, @@ -4495,9 +3803,6 @@ def relocate_declarations_for_move( *, index: ScopeIndex, resource: ResourceIdentity, destination: str ) -> tuple[DeclarationRecord, ...] | None: ... def validate_scope_index(*, index: ScopeIndex) -> None: ... - -class NativeScopeLookup: ... - def query_scope_target(*, lookup: ScopeLookup, target: ScopeQueryTarget) -> ScopeTargetQuery: ... def resolve_scope_visibility( *, lookup: ScopeLookup, target: ResourceIdentity | str | PurePath @@ -4557,21 +3862,6 @@ def render_scope_result( use_color: bool = False, ) -> str: ... def scope_metadata_projection(*, index: ScopeIndex) -> dict[str, JsonValue]: ... -def effective_config_target_name( - project_config: object, local_config: object, selected: str | None, / -) -> tuple[str | None, str | None]: ... -def effective_config_target_fields( - configs: tuple[object, object], target_name: str, default_target: object, / -) -> tuple[list[tuple[str | None, str, object]] | None, str | None]: ... -def effective_config_vars( - configs: tuple[object, object], target_config: object | None, cli_vars: dict[str, object], / -) -> dict[str, object]: ... -def effective_config_connection( - project_config: object, local_config: object, target_config: object | None, / -) -> tuple[dict[str, object] | None, str | None]: ... -def effective_config_settings( - settings: tuple[object, object], overrides: frozenset[str], names: list[str], / -) -> dict[str, object]: ... def yaml_entry_line(*, contents: str, name: str) -> int | None: ... class CollectedCompileDiagnostics: @@ -4656,27 +3946,14 @@ def snippet_help(*, purpose: str, target: str, lines: tuple[str, ...]) -> str: . def open_connection_with_hooks( *, adapter: BaseAdapter, connection_config: dict[str, object], hooks: ConnectionHooks ) -> Any: ... -def build_analysis_cache_context( - *, - root: Path | None, - inference_profile: ExpressionInferenceProfile, - allow_compact_analysis: bool, - rich_type_inference: bool = True, - signature_namespace: object = None, -) -> AnalysisCacheContext | None: ... class CompileInputRecording: def __enter__(self) -> CompileInputReads: ... def __exit__(self, *exception: object) -> bool: ... def record_compile_input_reads() -> CompileInputRecording: ... -def record_settings_class_read(settings_class: type) -> None: ... -def report_compile_diagnostic(*, key: tuple[str, ...], diagnostic: CompilerDiagnostic) -> None: ... def compiler_cache_directory(project_dir: Path, /) -> Path: ... def project_relative_path(*, path: Path, project_dir: Path) -> Path: ... -def resolve_target_name( - *, project_config: ProjectConfig, local_config: LocalConfig, selected_target: str | None -) -> str | None: ... def resolve_target_config( *, project_config: ProjectConfig, local_config: LocalConfig, target_name: str ) -> TargetConfig: ... @@ -4705,30 +3982,6 @@ def resolve_effective_scenario_config( def scenario_local_type_overrides_for_dialect( *, scenario_config: ScenarioConfig, sql_analysis_dialect: str | None ) -> dict[str, str]: ... -def apply_unit_test_selectors( - *, options: CompilePipelineOptions | None, discovered_inputs: DiscoveredProjectInputs -) -> CompilePipelineOptions: ... -def resolve_configured_rule_selection( - *, - options: CompilePipelineOptions, - discovered_inputs: DiscoveredProjectInputs, - project: CompiledProjectView, -) -> frozenset[CompiledObjectKey] | None: ... -def resolve_analysis_model_names( - *, - compile_inputs: CompileInputsView, - inference_profile: ExpressionInferenceProfile, - selection: CompileAnalysisSelection | None, -) -> frozenset[str] | None: ... -def compile_static_command_context( - *, - discovered_inputs: DiscoveredProjectInputs, - adapter: BaseAdapter, - options: CompilePipelineOptions, - selected_keys: frozenset[CompiledObjectKey] | None = None, - relation_keys: frozenset[CompiledObjectKey] | None = None, - on_progress: Callable[[str], None] | None = None, -) -> StaticCommandContext: ... def run_clone_pipeline_with_options( *, discovered_inputs: DiscoveredProjectInputs, @@ -4813,11 +4066,8 @@ def build_microbatch_create_index_sqls( CURRENT_LIFECYCLE_EVENT_SCHEMA_VERSION: int CURRENT_DIAGNOSTIC_LOG_SCHEMA_VERSION: int LIFECYCLE_EVENT_SCHEMA_VERSIONS: frozenset[int] -HOOK_PHASES: frozenset[str] -HOOK_TYPES: frozenset[str] OPERATION_ADAPTERS: frozenset[str] OPERATION_KINDS: frozenset[str] -OPERATION_METADATA_FIELDS: frozenset[str] OPERATION_NAMES: frozenset[str] OPERATION_PHASES: frozenset[str] OPERATION_SCOPES: frozenset[str] @@ -4832,8 +4082,6 @@ def validate_lifecycle_schema_version(*, value: object) -> None: ... def freeze_lifecycle_json(*, value: object, path: str) -> JSONValue: ... def validate_lifecycle_required_text(*, value: object, field_name: str) -> None: ... def validate_lifecycle_optional_text(*, value: object, field_name: str) -> None: ... -def validate_lifecycle_timestamp(*, value: object) -> None: ... -def validate_known_lifecycle_event(*, event: LifecycleEvent) -> None: ... def validate_lifecycle_event(*, event: LifecycleEvent) -> None: ... def validate_lifecycle_invocation_sequence(*, value: object) -> None: ... def validate_diagnostic_log(*, record: DiagnosticLog) -> None: ... @@ -4867,18 +4115,7 @@ def render_insert_source_freshness_records_sql( def model_header_declarations( header: tuple[object | None, object | None], model_name: str, relative_path: Path, / ) -> tuple[tuple[object, ...], tuple[object, ...]]: ... -def unknown_mapping_keys( - keys: list[tuple[str, bool]], allowed: list[str], / -) -> tuple[str, str] | None: ... -def unsupported_keys_help(keys: list[str], supported_keys: list[str], /) -> str: ... def semantic_help_catalogue() -> list[tuple[str, str]]: ... -def resource_sql_diagnostics_of( - catalog: object, - project: Any, - shapes: dict[str, dict[str, str]], - profile: ExpressionInferenceProfile, - /, -) -> tuple[CompilerDiagnostic, ...]: ... def compute_query_hash(*, query_sql: str, dialect: str | None) -> str: ... def compute_function_definition_hash( *, fingerprint_sql: str, language: str, dialect: str | None @@ -4938,30 +4175,15 @@ def select_latest_fingerprints( node_names: tuple[str, ...], filtered_node_types: tuple[str, ...] = (), ) -> FingerprintSet: ... -def find_python_string_locations( - *, - project_dir: Path, - discovered: DiscoveredProjectInputs, - names: tuple[str, ...], - reason: str, - context: str | None = None, -) -> tuple[ManualLocation, ...]: ... def validate_resource_identity( *, name: str, kind: str, path: Path, private_identity: bool = False ) -> None: ... def function_node_type(*, return_columns: tuple[object, ...]) -> str: ... def load_project_config_file(project_dir: Path, /) -> ProjectConfig: ... def load_local_config_file(project_dir: Path, /) -> LocalConfig: ... -def resolve_config_file_path(project_dir: Path, local: bool, /) -> Path: ... -def validate_local_sql_analysis(project_dir: Path, flags: tuple[bool, bool, bool], /) -> None: ... def normalize_scope_path(*, path: str | PurePath) -> str: ... def scope_index_fingerprint(*, project_dir: Path) -> str | None: ... def load_or_build_scope_index(*, project_dir: Path, no_cache: bool = False) -> ScopeIndex: ... -def model_schema_scope_usages( - schema_files: Sequence[DiscoveredModelSchemaFile], - resolver: DeclarationScopeResolver | None, - /, -) -> tuple[UsageRecord, ...]: ... class NativeConfigError: class_name: str @@ -4977,9 +4199,6 @@ def parse_schema_columns( options: tuple[bool, bool, bool], column_locations: dict[str, SourceLocation], ) -> tuple[SchemaColumn, ...]: ... -def column_migration_problem( - model_name: str, values: dict[str, object], columns: list[tuple[str, str | None]] -) -> NativeConfigError | None: ... def expand_template_data( *, value: object, @@ -5061,9 +4280,6 @@ def scope_expected_model_names( def supports_color() -> bool: ... def parse_cli_invocation(argv: Sequence[str], *, use_color: bool) -> ParsedCliInvocation: ... def run_cli(argv: Sequence[str] | None = None, handlers: object | None = None) -> int: ... -def extract_sql_test_ctes( - *, sql: str, file_label: str, syntax: SqlLexicalSyntax -) -> tuple[CompileSqlTestCte, ...]: ... def scope_test_ctes( texts: list[tuple[str, str]], syntax: dict[str, object] ) -> list[tuple[str | None, list[tuple[str, str]]]]: ... @@ -5163,7 +4379,6 @@ def cursor_intrinsics_analysis_sql(*, sql: str, cursor_type: object) -> str: ... def resolve_cursor_intrinsics( *, sql: str, start_sql: str | None = None, end_sql: str | None = None ) -> tuple[str, bool]: ... -def parse_macro_arguments(text: str, nested: list[tuple[int, int]]) -> tuple[object, ...]: ... def scan_macro_call_sites( sql: str, ) -> tuple[ @@ -5255,14 +4470,6 @@ def build_native_declaration_contexts( lookup: ScopeLookup, declarations: Mapping[DeclarationIdentity, EnumDeclaration | ConstantDeclaration | LoadedMacro], ) -> NativeDeclarationContexts: ... -def render_constant_declaration( - *, - declaration: ConstantDeclaration, - value_renderer: TypedSqlValueRenderer, - collection_rendering: CollectionRendering, - file_path: Path | None = None, -) -> str: ... -def render_enum_member_value(*, value: str | int) -> str: ... def resolve_declaration_context( *, resolver: DeclarationScopeResolver, @@ -5313,9 +4520,6 @@ def inventory_macro_modules( list[tuple[int, str]], list[tuple[int, str, list[str]]] | None, ]: ... -def splice_macro_calls( - sql: str, sites: list[tuple[int, int]], outputs: list[str] -) -> tuple[str, list[tuple[int, int, int, int]]]: ... class MacroCallMemo: def __init__(self) -> None: ... @@ -5386,14 +4590,6 @@ type _PivotContractRow = tuple[ | None, ] -def locate_model_binding_diagnostics( - rows: list[_AnalysisDiagnosticRow], - texts: tuple[str, str, str], - expansion: tuple[str, list[list[tuple[int, int, int, int]]]] | None, -) -> list[ - tuple[str, str, str, int | None, int | None, tuple[int, int, int | None, int | None] | None] -]: ... - class NativeModelAnalysisSession: @property def fact_models(self) -> list[str]: ... @@ -5411,12 +4607,6 @@ def session_outcome_analysis( *, session: Any, position: int, placeholders: dict[str, str] | None ) -> Any: ... def dynamic_contract_proof(row: Any, /) -> Any: ... -def infer_native_query_column_rows( - *, - queries: Sequence[Any], - profile: Any, - column_nullability_by_table: Mapping[str, Mapping[str, Any]] | None = None, -) -> list[tuple[bool, list[tuple[str, str | None, str]] | None, bool]]: ... def infer_native_query_columns( *, queries: Sequence[Any], @@ -5449,14 +4639,6 @@ def _oracle_cte_fact_recovery( # Native analysis: semantic completion. def semantic_shapes(*, project: Any, profile: Any | None = None) -> dict[str, dict[str, str]]: ... -def published_model_shape( - *, model: Any, columns: dict[str, str], inputs: dict[str, dict[str, str]], profile: Any -) -> dict[str, str]: ... -def model_binding_inputs( - model: Any, shapes: dict[str, dict[str, str]], / -) -> dict[str, dict[str, str]]: ... -def binding_relation_names(references: Sequence[Any], /) -> frozenset[str]: ... -def semantic_coverage(project: Any, /) -> dict[str, tuple[str, ...]]: ... def source_binding_diagnostics( *, project: Any, columns: Mapping[str, Any], profile: Any, selected_keys: frozenset[Any] ) -> tuple[Any, ...]: ... @@ -5538,14 +4720,6 @@ def optional_named_bool[D: (bool, None)]( error_class: type[Exception], default: D, ) -> bool | D: ... -def render_project_var_text(*, value: object, label: str) -> str: ... -def compare_contracts( - *, - adapter: BaseAdapter, - connection: object, - models: tuple[CompiledModelView, ...], - sources: tuple[CompiledSourceView, ...], -) -> tuple[ContractEvidence, ...]: ... def compare_contract_evidence( *, item: ContractEvidence, @@ -5555,16 +4729,6 @@ def compare_contract_evidence( def edit_contract_model( *, model: CompiledModelView, physical_columns: tuple[ColumnInfo, ...], overwrite: bool ) -> tuple[str | None, str | None]: ... -def edit_contract_source( - *, - source: CompiledSourceView, - physical_columns: tuple[ColumnInfo, ...], - overwrite: bool, - contents: str | None = None, -) -> tuple[str | None, str | None]: ... -def remaining_contract_findings( - *, findings: tuple[ContractFinding, ...], overwrite: bool, conflict: str | None -) -> tuple[ContractFinding, ...]: ... def evaluate_model_contracts( *, project: CompiledProjectView, dialect: TypeDialect | str | None = None ) -> ContractValidationResult: ... @@ -5578,12 +4742,6 @@ def build_project_column_lineage( model_names: frozenset[str] | None, /, ) -> ProjectColumnLineage | None: ... -def build_direct_semantic_uses( - project: CompiledProjectView, - dialect: str | None, - model_names: frozenset[str], - /, -) -> tuple[DirectSemanticColumnUse, ...]: ... class ProjectColumnLineage: """Project-level column lineage graph with lazily materialized public views.""" @@ -5615,19 +4773,11 @@ class ProjectColumnLineage: self, *, resource_name: str, column_name: str ) -> tuple[ColumnLineageEdge, ...]: ... -def relation_lineage_fingerprint( - project_dir: Path, prefix: bytes, interrupted_listing_uncacheable: bool, / -) -> str | None: ... def lineage_cache_fingerprint( *, project_dir: Path, cli_vars: dict[str, object] | None ) -> str | None: ... -def run_lineage_command(*, request: LineageCommandRequest) -> int: ... def run_refactor_command(*, request: RefactorCommandRequest) -> int: ... -def run_janitor_command(*, request: JanitorCommandRequest) -> int: ... -def run_freshness_command(*, request: FreshnessCommandRequest) -> int: ... -def run_clone_command(*, request: CloneCommandRequest) -> int: ... def run_load_command(*, request: LoadCommandRequest) -> int: ... -def run_check_command(*, request: CheckCommandRequest) -> int: ... def write_check_results( *, stream: TextIO, @@ -5638,7 +4788,6 @@ def write_check_results( ) -> None: ... def format_check_json(*, results: tuple[PythonCheckExecutionResult, ...]) -> str: ... def run_test_command(*, request: TestCommandRequest) -> int: ... -def run_seed_command(*, request: SeedCommandRequest) -> int: ... def run_build_command(*, request: BuildCommandRequest) -> int: ... def enforce_plan_safety_policies( *, @@ -5657,7 +4806,6 @@ def enforce_model_execution_limit( refusal_note: str, ) -> None: ... def run_audit_command(*, request: AuditCommandRequest) -> int: ... -def run_contract_command(*, request: ContractCommandRequest) -> int: ... def run_init_command(project_dir: Path | None = None) -> int: ... def run_cost_command(request: CostCommandRequest) -> int: ... def run_dbt_command( @@ -5725,12 +4873,6 @@ def build_scenario_hash_index( def build_scenario_artifact_name( *, hash_prefix: str, kind: str, logical_name: str, identifier_limit: int = 63 ) -> str: ... -def build_scenario_artifact_physical_name( - *, hash_prefix: str, kind: str, logical_name: str, identifier_limit: int -) -> str: ... -def fit_scenario_artifact_logical_name( - *, logical_name: str, fixed_prefix: str, identifier_limit: int -) -> str: ... def parse_scenario_artifact_physical_name(name: str) -> ParsedScenarioArtifactName | None: ... def is_scenario_artifact_physical_name(name: str) -> bool: ... def build_scenario_relation_map( @@ -5758,12 +4900,6 @@ def build_scenario_fixture_plans( source_lexical_syntax: SqlLexicalSyntax, fixture_sql_overrides: dict[tuple[CompiledResourceType, str], str] | None = None, ) -> tuple[ScenarioFixturePlan, ...]: ... -def build_scenario_seed_entries( - *, - project: CompiledProjectView, - graph_plan: ScenarioGraphPlan, - relation_plan: ScenarioRelationPlan, -) -> tuple[SeedPlanEntry, ...]: ... def build_scenario_execution_plan( *, scenario: CompiledSqlScenario, @@ -5776,34 +4912,16 @@ def build_scenario_execution_plan( source_warehouse_columns: dict[str, tuple[ColumnInfo, ...]] | None = None, sql_analysis_enabled: bool = True, ) -> tuple[ScenarioExecutionPlan, tuple[PlanWarning, ...]]: ... -def run_scenario_capture_command(*, request: ScenarioCaptureCommandRequest) -> int: ... -def sql_analysis_off_guidance( - *, discovered_inputs: DiscoveredProjectInputs, purpose: str -) -> tuple[str, str] | None: ... def serialize_hook_entries( *, value: object, sql_fields: tuple[str, ...], python_hook_fields: Mapping[str, Mapping[str, object]] | None = None, ) -> list[dict[str, object]]: ... -def named_declaration_role_kind(*, relative_path: PurePath) -> DeclarationKind | None: ... def discover_model_description_inputs(*, project_dir: Path) -> DiscoveredProjectInputs: ... def microbatch_guidance() -> tuple[str, str]: ... def sql_analysis_opt_out_help(*, model_owned: bool = True) -> str: ... def explicit_references_help(*, allowed: str) -> str: ... -def run_format_command( - *, - project_dir: Path | None, - select: tuple[str, ...] = (), - exclude: tuple[str, ...] = (), - check: bool = False, - diff: bool = False, - fixtures_only: bool = False, - fix: bool = False, - json_output: bool = False, - no_color: bool = False, - no_cache: bool = False, -) -> int: ... def format_parameterized_test_label( *, name: str, @@ -5843,8 +4961,6 @@ def write_runtime_target( *, target_dir: Path, plan_output: PlanOutput, result: BuildExecutionResult ) -> None: ... def run_plan_command(*, request: PlanCommandRequest) -> int: ... -def run_rules_command(*, request: RulesCommandRequest) -> int: ... -def stop_progress_spinners() -> None: ... class TransientStatusReporter: def __init__( @@ -6061,33 +5177,18 @@ def assemble_native_sql_tests( ) -> tuple[NativeSqlTestAssembly, ...]: ... # Native analysis: compiled project assembly. -def sql_syntax_error( - sql: str, - placeholders: Mapping[str, str] | None, - dialect: str | None, - parse_one: bool = False, -) -> str | None: ... def assemble_native_project_resources( *, inputs: CompileInputsView, dialect: str | None, syntax_checks: tuple[tuple[tuple[str, dict[str, str] | None], ...], ...], ) -> NativeProjectResources: ... -def explicit_reference_report( - *, - project: CompiledProjectView, - discovered_inputs: DiscoveredProjectInputs, - enforce_explicit: bool, -) -> PythonSqlReferenceReport: ... def hard_coded_relation_remedy( *, owner_kind: HardCodedRelationOwnerKind, ref: SqlResourceRef, upstream_loader_by_source: Mapping[str, str] | None = None, ) -> str: ... -def old_name_reference_message( - *, owner_label: str, written: str, method: str, model_name: str -) -> str: ... def transitive_closure[K]( *, start: K, edges: Mapping[K, Iterable[K]], max_depth: int | None = None ) -> frozenset[K]: ... @@ -6104,17 +5205,9 @@ def invert_edges[K]( def path_nodes[K]( *, start: K, end: K, downstream: Mapping[K, Iterable[K]] ) -> frozenset[K] | None: ... -def attached_audit_gate_edges( - *, project: CompiledProjectView -) -> tuple[AttachedAuditGateEdge, ...]: ... -def hook_read_edges(*, project: CompiledProjectView) -> tuple[HookReadEdge, ...]: ... -def model_python_hook_names(*, model: CompiledModelView) -> tuple[str, ...]: ... def resolve_python_node_selection( *, graph: PythonNodeGraph, select: Sequence[str], exclude: Sequence[str] ) -> frozenset[str]: ... -def resolve_python_check_excludes( - *, graph: PythonNodeGraph, exclude: Sequence[str] -) -> frozenset[str]: ... def resolve_python_sql_run_selection( *, project_graph: ProjectGraph, @@ -6122,21 +5215,7 @@ def resolve_python_sql_run_selection( select: Sequence[str], exclude: Sequence[str], ) -> tuple[list[tuple[str, str]], list[str]]: ... -def python_node_graph_indexes( - nodes: list[tuple[str, tuple[str, ...], str, list[str]]], / -) -> tuple[ - list[tuple[str, str]], - list[tuple[str, list[str]]], - list[tuple[str, list[str]]], - list[tuple[str, list[str]]], - list[tuple[str, str]], -]: ... -def sql_ref_key(reference: SqlResourceRef, /) -> CompiledObjectKey: ... -def native_graph_key(key: CompiledObjectKey, /) -> tuple[str, str]: ... -def native_graph_keys(keys: Iterable[CompiledObjectKey], /) -> list[tuple[str, str]]: ... def compiled_graph_keys(keys: Iterable[tuple[str, str]], /) -> frozenset[CompiledObjectKey]: ... -def lineage_graph_names(graph: NativeProjectGraph, /) -> dict[str, CompiledObjectKey]: ... -def lineage_graph_views(graph: NativeProjectGraph, /) -> LineageGraphViews: ... def project_lineage_views(project: CompiledProjectView, /) -> LineageGraphViews: ... def native_graph_from_views( *, @@ -6146,11 +5225,6 @@ def native_graph_from_views( tag_index: Mapping[str, Iterable[CompiledObjectKey]], path_index: Mapping[CompiledObjectKey, str], ) -> NativeProjectGraph: ... -def native_graph_from_edges( - *, - upstream: Mapping[CompiledObjectKey, Iterable[CompiledObjectKey]], - downstream: Mapping[CompiledObjectKey, Iterable[CompiledObjectKey]], -) -> NativeProjectGraph: ... class BindingCatalog: schemas: dict[str, Mapping[str, str]] @@ -6182,7 +5256,6 @@ class BindingCatalog: def schema_validations( *, requests: Sequence[SqlSchemaValidationRequest] ) -> tuple[SqlBindingResult, ...]: ... -def ignores_quoted_case(*, connection: Mapping[str, object], dialect: str | None) -> bool: ... def _oracle_json_dumps(dialect_json: str, value_json: str) -> str: ... def _oracle_text_positions( data: bytes, byte_offsets: list[int] @@ -6227,15 +5300,6 @@ def read_migration_state_events( render_qualified_name: Callable[..., str | None], stored_columns: Iterable[str] | None = None, ) -> tuple[Any, ...]: ... -def read_old_name_view_histories( - *, - connection: Any, - execute: AdapterExecute[Any, Any], - database: str | None, - schema: str, - stored_columns: Iterable[str], - render_qualified_name: Callable[..., str | None], -) -> tuple[OldNameViewHistory, ...]: ... def read_recorded_column_renames( *, connection: Any, @@ -6305,9 +5369,6 @@ def newest_column_migration_event_mentioning( def project_old_name_views( *, moves: Iterable[MigrationEvent], facts: Iterable[OldNameViewEvent] ) -> tuple[OldNameViewHistory, ...]: ... -def resolve_old_name_view_retention( - *, config_values: Mapping[str, object], project_retention: str | None -) -> str | None: ... def source_freshness_data_version_hash( *, source_name: str, @@ -6330,7 +5391,6 @@ def evaluate_source_freshness_age_policy( data_version: object, observed_at: datetime, ) -> SourceFreshnessAgeStatus | None: ... -def require_aware_utc_datetime(*, value: datetime, field_name: str) -> datetime: ... def build_source_freshness_read_latest_sql( *, database: str | None, schema: str, render_qualified_name: Callable[..., str | None] ) -> str: ... @@ -6379,9 +5439,6 @@ def observe_adapter_sources_freshness( sources: tuple[SourceEntry, ...], observed_at: datetime, ) -> AdapterSourceFreshnessBatch: ... -def source_freshness_record_from_observation( - *, observation: SourceFreshnessObservation, source: SourceEntry, run_id: str -) -> SourceFreshnessRecord: ... def build_direct_source_freshness_planning_result( *, adapter: StrictAdapter, @@ -6428,21 +5485,9 @@ def safe_diagnostic_extra_fields(record: logging.LogRecord) -> dict[str, object] def compute_diagnostic_log_fields( *, record: logging.LogRecord, invocation_id: str, include_sql_text: bool ) -> dict[str, object] | None: ... -def sql_rule_lint_key(*, config: LintConfig) -> str: ... -def sql_model_rule_keys( - *, lint_key: str, codes: list[str], models: list[tuple[str, str, str, str | None]] -) -> dict[str, str]: ... -def sql_file_rule_key( - *, lint_key: str, codes: list[str], relative_path: str, contents: str, expanded: bool -) -> str | None: ... def load_sql_rule_cache(*, path: Path) -> dict[str, tuple[str, str]]: ... -def lookup_sql_rule_cache( - *, entries: dict[str, tuple[str, str]], keys: list[tuple[str, str]] -) -> dict[str, list[Finding]]: ... def encode_sql_rule_findings(*, findings: list[Finding]) -> str: ... -def write_sql_rule_cache(*, path: Path, entries: dict[str, tuple[str, str]]) -> None: ... def cursor_parse(*, raw: object, cursor_type: str) -> CursorScalar: ... -def cursor_try_parse(*, raw: object, cursor_type: str) -> CursorScalar | None: ... def cursor_render(*, value: CursorScalar) -> str: ... def cursor_sentinel_to_token(*, sentinel: Bound) -> str: ... def cursor_sentinel_from_token(*, token: str) -> BoundSentinel | None: ... @@ -6465,28 +5510,6 @@ def apply_maximum_start_policy( policy: MaximumStartPolicyInputs, has_start_override: bool, ) -> CursorBounds: ... -def plan_function( - *, - function: CompiledFunctionView, - adapter: BaseAdapter, - relations: PlannerRelationsContext, - fingerprint_query_sql: str, - previous_query_sql: str | None = None, - reason: PlanReason = ..., -) -> FunctionPlanEntry: ... -def plan_selected_sql_tests( - *, - project: CompiledProjectView, - adapter: BaseAdapter, - selected_keys: frozenset[CompiledObjectKey], - sql_test_selection: SqlTestSelection, -) -> PlannedSqlTests: ... -def sql_test_is_selected( - *, - test: CompiledSqlTest, - selected_keys: frozenset[CompiledObjectKey], - sql_test_selection: SqlTestSelection, -) -> bool: ... def build_selected_test_entries( *, project: CompiledProjectView, @@ -6530,32 +5553,9 @@ def build_seed_command_plan( relations: PlannerRelationsContext, fingerprints: dict[str, Fingerprint] | None = None, ) -> PlanOutput: ... -def build_relation_command_plan( - *, project: CompiledProjectView, scope: PlannerScope, relations: PlannerRelationsContext -) -> PlanOutput: ... def read_selected_seed_fingerprints( *, adapter: BaseAdapter, connection: Any, seeds: tuple[CompiledSeedView, ...] ) -> dict[str, Fingerprint]: ... -def run_clone_planning( - *, - project: CompiledProjectView, - select: tuple[str, ...], - exclude: tuple[str, ...], - adapter: BaseAdapter, - connection: Any, - origin_project: CompiledProjectView, - origin_source_project: CompiledProjectView, - destination_source_project: CompiledProjectView, -) -> tuple[ - PlanOutput, - tuple[CloneSourcePlanEntry, ...], - tuple[ModelPlanEntry, ...], - tuple[SeedPlanEntry, ...], - tuple[FunctionPlanEntry, ...], - tuple[ModelPlanEntry, ...], - tuple[SeedPlanEntry, ...], - tuple[CloneSourcePlanEntry, ...], -]: ... def resolve_clone_boundary[K]( *, selected: frozenset[K], @@ -6600,19 +5600,12 @@ def start_sql_test_planning( sql_test_selection: SqlTestSelection, enabled: bool, ) -> SqlTestPlanning: ... -def join_sql_test_planning_threads() -> None: ... def build_display_only_sqlbuild_plan( *, project: CompiledProjectView, selected_model_names: tuple[str, ...], full_refresh: bool ) -> PlanOutput: ... def format_pre_build_work( *, lines: list[str], plan: PlanOutput, display_options: DisplayOptions ) -> list[str]: ... -def resolve_future_cursor_config( - *, model: CompiledModelView, project_config: FutureCursorsConfig | None -) -> FutureCursorsConfig | None: ... -def resolve_start_cursor_config( - *, model: CompiledModelView, project_config: StartCursorsConfig | None -) -> StartCursorsConfig | None: ... def future_cursor_cap_warning(bounds: CursorBounds | None, /) -> str | None: ... def maximum_start_cap_warning(bounds: CursorBounds | None, /) -> str | None: ... def compute_plan_cursor_bounds( @@ -6645,15 +5638,6 @@ def compute_microbatch_range( replaces_relation: bool = False, cursor_input_relations: tuple[CursorInputRelation, ...] = (), ) -> CursorBounds | None: ... -def resolve_empty_cursor_inputs( - *, - model: CompiledModelView, - snapshot: WarehouseSnapshot, - full_refresh: bool, - runtime_owned_cursor_bounds: bool, - start_cursor_override: str | None, - end_cursor_override: str | None, -) -> tuple[tuple[str, ...], bool]: ... def resolve_cursor_overrides( *, model: CompiledModelView, @@ -6673,9 +5657,6 @@ def build_planner_relations_context( known_source_columns: dict[str, tuple[ColumnInfo, ...]] | None = None, relation_keys: frozenset[CompiledObjectKey] | None = None, ) -> PlannerRelationsContext: ... -def build_model_materializations( - model_entries: tuple[ModelPlanEntry, ...], / -) -> dict[str, str]: ... def scope_overlaps( *, scope_deps: tuple[CompiledObjectKey, ...], selected_keys: frozenset[CompiledObjectKey] ) -> bool: ... @@ -6689,7 +5670,6 @@ def resolve_future_cursor_safety( has_complete_override: bool, input_evidence: tuple[CursorInputEvidence, ...] = (), ) -> CursorBounds: ... -def cursor_sort_key(*, raw: object, cursor_type: str) -> datetime | int: ... def cursor_max_bound[T](*, values: tuple[T, ...] | list[T], cursor_type: str) -> T: ... def cursor_min_bound[T](*, values: tuple[T, ...] | list[T], cursor_type: str) -> T: ... def cursor_floor_to_grain(*, value: CursorScalar, grain: CursorGrain) -> CursorScalar: ... @@ -6715,11 +5695,6 @@ def cursor_split_into_batches( ) -> tuple[AlignedInterval, ...]: ... def cursor_cap_from_start[T](*, intervals: tuple[T, ...], count: int) -> tuple[T, ...]: ... def cursor_cap_from_end[T](*, intervals: tuple[T, ...], count: int) -> tuple[T, ...]: ... -def validate_cursor_interval( - *, start: CursorScalar, end: CursorScalar, grain: CursorGrain | None -) -> None: ... -def parse_cursor_duration(value: str) -> tuple[int, int, int, int, int, int] | None: ... -def shift_by_cursor_duration[M: date](*, moment: M, duration: Duration, direction: int) -> M: ... def get_config_str(*, values: Mapping[str, object], key: str) -> str | None: ... def get_config_bool(*, values: Mapping[str, object], key: str) -> bool | None: ... def get_config_int(*, values: Mapping[str, object], key: str) -> int | None: ... @@ -6734,7 +5709,6 @@ def finding_position( *, path: Path, line: int | None, column: int | None, node: object ) -> tuple[int, int]: ... def rule_option_toml_value(value: object) -> str: ... -def validate_project_relative(path: str) -> None: ... def project_tree_paths(root: Path) -> tuple[ProjectPath, ...]: ... def project_tree_read_text(root: Path, path: str) -> str: ... def fact_value_digest(value: object) -> str | None: ... @@ -6757,21 +5731,6 @@ def startup_input_stamps( def custom_rule_implementation_fingerprint( *, rule: Rule, project_dir: Path, import_closure: tuple[Path, ...] | None = None ) -> str: ... -def custom_rule_identity( - *, - code_identity: str, - runtime_version: str, - code: str, - family: str, - slug: str, - message: str, - remediation: str, - subject: str | None, - implementation_fingerprint: str, - config: RulesConfig, - dialect: str, - project_dir: str, -) -> str: ... def evaluate_project_rules( *, project: CompiledProjectView, @@ -6819,25 +5778,10 @@ class CustomHostObserver: custom_host_observer: CustomHostObserver | None -def evaluate_rules( - *, - graph: ProjectGraph, - discovered_inputs: DiscoveredProjectInputs, - config: RulesConfig, - project_dir: Path, - dialect: str, - selected_keys: frozenset[CompiledObjectKey] | None = None, - early_lint: EarlySqlLint | None = None, - no_sql_analysis: bool = False, -) -> RulesRunResult: ... def custom_rule_test_evidence( *, rule: Rule, project_dir: Path ) -> list[tuple[str, int, int, str]]: ... def format_rules_result(*, result: RulesResult, json_output: bool) -> str: ... -def format_skipped_type_proof_rules(*, codes: tuple[str, ...]) -> str | None: ... -def finish_rule_run( - *, plan: RuleRunPlan, sql_result: SqlRulesEvaluation, result: RulesResult -) -> RulesRunResult: ... def run_rules( *, graph: ProjectGraph, @@ -6850,14 +5794,6 @@ def run_rules( no_sql_analysis: bool = False, ) -> RulesRunResult: ... def rules_bulk_cache_path(*, project_dir: Path, file_name: str) -> Path: ... -def plan_rule_run( - *, - graph: ProjectGraph, - config: RulesConfig, - project_dir: Path, - selected_keys: frozenset[CompiledObjectKey] | None, - no_sql_analysis: bool, -) -> RuleRunPlan: ... def run_planned_sql_rules( *, plan: RuleRunPlan, @@ -6878,17 +5814,10 @@ class EarlySqlLint: def start(self, *, inputs: CompileInputsView, dialect: str) -> None: ... def stop(self) -> int: ... -class PreparedSqlLint: - """One early SQL lint running on a native thread, for one project and SQL rule codes.""" - -def with_duplicate_literal_hints( - *, findings: tuple[Finding, ...], project_dir: Path -) -> tuple[Finding, ...]: ... def scan_headers(*, contents: str, first_only: bool = False) -> tuple[HeaderSpan, ...]: ... def sql_body_ranges( *, contents: str, headers: tuple[HeaderSpan, ...] ) -> tuple[tuple[int, int], ...]: ... -def measurement_body_ranges(*, contents: str) -> tuple[tuple[int, int], ...]: ... def run_lint( *, project_dir: Path, @@ -6911,13 +5840,6 @@ def lint_native_headers( def format_native_headers( *, contents: str, file_path: Path, config: LintConfig ) -> tuple[str, tuple[LintViolation, ...]]: ... -def safe_format_files( - *, files: dict[Path, str], config: LintConfig -) -> tuple[dict[Path, str], dict[Path, str]]: ... -def reject_unparseable_header_rewrites( - *, updated: dict[Path, str], config: LintConfig, faults: list[LintViolation] -) -> tuple[dict[Path, str], list[LintViolation]]: ... -def prepare_model_header_tokens(headers: Sequence[str], /) -> None: ... def parse_header_values( *, header: str, @@ -6930,17 +5852,9 @@ def model_output_column_locations( *, contents: str, relative_path: object, extract_implicit_alias_columns: bool = True ) -> dict[str, Any]: ... def inclusive_cursor_end(*, end: str, cursor_type: str | None, cursor_grain: str | None) -> str: ... -def resolve_bounded_cursor_override( - *, - start_cursor_override: str | None, - end_cursor_override: str | None, - cursor_type: str | None, - cursor_grain: str | None, -) -> CursorBounds | None: ... def cursor_bound_display( *, value: str, cursor_type: str | None, cursor_grain: str | None ) -> str: ... -def model_materialization_label(entry: ModelPlanEntry) -> str: ... def detect_changes( *, project: CompiledProjectView, @@ -6950,15 +5864,6 @@ def detect_changes( expected_version_hashes: dict[str, str] | None = None, expected_metadata_jsons: dict[str, str] | None = None, ) -> PlannerChangeResults: ... -def detect_model_changes_in_scope( - *, - project: CompiledProjectView, - scope: PlannerScope, - snapshot: WarehouseSnapshot, - query_change_tracking: bool | None = None, - expected_version_hashes: dict[str, str] | None = None, - expected_metadata_jsons: dict[str, str] | None = None, -) -> dict[str, ChangeDetectionResult]: ... def parse_query_shape(*, query_sql: str, dialect: str | None) -> QueryShape | None: ... def renames_explain_change( *, @@ -6970,21 +5875,6 @@ def renames_explain_change( def build_migration_fingerprint( *, query_sql: str, metadata_json: str, ref_identities: Mapping[str, str], dialect: str | None ) -> str | None: ... -def migration_fingerprint_ref_names(*, query_sql: str, metadata_json: str) -> frozenset[str]: ... -def migration_incremental_blocking_findings( - *, - model: CompiledModelView, - findings: tuple[SchemaFinding, ...], - dialect: str | None, -) -> tuple[str, ...]: ... -def migration_snapshot_blocking_findings( - *, - model: CompiledModelView, - findings: tuple[SchemaFinding, ...], - dialect: str | None, - snapshots_config: SnapshotsConfig, -) -> tuple[str, ...]: ... -def declared_column_aliases(model: CompiledModelView) -> tuple[tuple[str, str], ...]: ... def plan_column_migrations( *, runtime: PlannerRuntime, @@ -6996,30 +5886,6 @@ def plan_column_migrations( deferral: DeferralInputs, source_columns: Mapping[str, tuple[ColumnInfo, ...]], ) -> None: ... -def old_name_schemas_to_read(*, snapshot: WarehouseSnapshot, needed: set[str]) -> set[str]: ... -def old_name_claim_message(*, model_name: str, view: OldNameView, now: datetime) -> str: ... -def old_name_claim_errors( - *, - selected: Iterable[CompiledModelView], - snapshot: WarehouseSnapshot, - views: tuple[OldNameView, ...], - now: datetime, -) -> tuple[PlanWarning, ...]: ... -def old_name_view_skip_reason( - *, - origin: CompiledRelationLocation, - origin_tracked: bool | None, - retention: str | None, - models: Iterable[CompiledModelView], - views: tuple[OldNameView, ...], -) -> str | None: ... -def with_migration_fingerprints( - *, - entries: tuple[ModelPlanEntry, ...], - models_by_name: Mapping[str, CompiledModelView], - fingerprints: MigrationFingerprintCache, - dialect: str | None, -) -> tuple[ModelPlanEntry, ...]: ... def identical_renames( *, previous: QueryShape, @@ -7048,18 +5914,6 @@ def detect_model_changes( expected_version_hash: str | None = None, expected_metadata_json: str | None = None, ) -> ChangeDetectionResult: ... -def resolve_model_actions( - *, scope: PlannerScope, changes: PlannerChangeResults -) -> PlannerResolvedActions: ... -def plan_reference_renames( - *, - runtime: PlannerRuntime, - scope: PlannerScope, - snapshot: WarehouseSnapshot, - state: MigrationStateInspection, - schemas: set[str], - planned: dict[str, str], -) -> tuple[ReferenceRename, ...]: ... def replaces_incremental_relation( *, materialization_type: MaterializationType, action: PlanAction ) -> bool: ... @@ -7107,7 +5961,6 @@ def runtime_cursor_producer_names( def resolve_microbatch_lookback( *, model: CompiledModelView, effective_grain: str | None = None ) -> str | None: ... -def extract_seed_columns(seed: CompiledSeedView) -> tuple[ColumnInfo, ...]: ... def plan_audit( *, audit: CompiledAuditView, @@ -7119,17 +5972,6 @@ def plan_audit( lineage_downstream_deps: dict[CompiledObjectKey, tuple[CompiledObjectKey, ...]], model_materializations: dict[str, str], ) -> AuditPlanEntry: ... -def audit_is_selected( - *, audit: CompiledAuditView, selected_keys: frozenset[CompiledObjectKey] -) -> bool: ... -def build_selected_audit_entries( - *, - project: CompiledProjectView, - adapter: BaseAdapter, - scope: PlannerScope, - relations: PlannerRelationsContext, - model_materializations: dict[str, str], -) -> list[AuditPlanEntry]: ... def resolve_attachment_kind( *, audit: CompiledAuditView, @@ -7143,7 +5985,6 @@ def reads_outside_target_lineage( def resolve_effective_run_scope( *, requested_run_scope: AuditRunScope, attached_model_materialization: str | None ) -> AuditRunScope: ... -def classify_cursor_sql_type(sql_type: str) -> CursorType | None: ... def check_cursor_type_consistency( *, model_name: str, @@ -7161,22 +6002,6 @@ def apply_configured_microbatch_limits( def microbatch_limit_warning( *, model_name: str, max_batches: int | None, batch_count: int, action: MicrobatchLimitAction ) -> str | None: ... -def resolve_microbatch_limit_config( - *, values: Mapping[str, object] -) -> tuple[int | None, MicrobatchLimitAction | None]: ... -def resolve_lineage_reference( - *, - model: CompiledModelView, - input_name: str, - models_by_name: Mapping[str, CompiledModelView], - functions_by_name: Mapping[str, CompiledFunctionView], -) -> CompileSqlReference: ... -def validate_capped_watermark_inputs( - *, - model: CompiledModelView, - models_by_name: Mapping[str, CompiledModelView], - functions_by_name: Mapping[str, CompiledFunctionView] | None = None, -) -> None: ... def detect_schema_changes( *, yml_columns: tuple[ColumnInfo, ...], @@ -7225,14 +6050,6 @@ def build_direct_model_version_identities( source_version_hashes: Mapping[str, str] | None = None, hook_functions: Iterable[DiscoveredHookFunction] = (), ) -> DirectModelVersionIdentities: ... -def with_honest_model_write_hashes( - *, - scope: PlannerScope, - snapshot: WarehouseSnapshot, - changes: PlannerChangeResults, - version_identities: DirectModelVersionIdentities, - available_model_hashes: Mapping[str, str] | None = None, -) -> PlannerChangeResults: ... def merge_recomputed_model_changes( *, resolved_actions: PlannerResolvedActions, changes: PlannerChangeResults ) -> PlannerResolvedActions: ... @@ -7282,31 +6099,11 @@ def missing_upstream_message( missing: tuple[MissingUpstream, ...], edge_origins: Mapping[tuple[CompiledObjectKey, CompiledObjectKey], str], ) -> str: ... -def model_resource_type(entry: ModelPlanEntry | None) -> str: ... -def model_execution_annotation(entry: ModelPlanEntry | None) -> str: ... -def materialization_type_display(resource_kind: ExecutionResourceKind) -> str: ... -def format_no_input_rows(input_names: tuple[str, ...]) -> str: ... def format_waiting_on_empty_inputs(input_names: tuple[str, ...]) -> str: ... def resolve_effective_microbatch_batch_size(*, batch_size: str, effective_grain: str) -> str: ... def aligned_timestamp_bounds( *, start: DateValue | TimestampValue, end: DateValue | TimestampValue ) -> tuple[datetime, datetime]: ... -def build_planner_scope( - *, - project: CompiledProjectView, - select: tuple[str, ...] = (), - exclude: tuple[str, ...] = (), - auto_load_sources: bool = False, - selected_keys: frozenset[CompiledObjectKey] | None = None, - python_read_source_names: frozenset[str] = frozenset(), - sql_test_selection: SqlTestSelection | None = None, -) -> PlannerScope: ... -def managed_source_upstream_keys( - *, - selected_keys: frozenset[CompiledObjectKey], - upstream_deps: dict[CompiledObjectKey, tuple[CompiledObjectKey, ...]], - project: CompiledProjectView, -) -> frozenset[CompiledObjectKey]: ... def expand_selected_loader_dependencies( *, project: CompiledProjectView, @@ -7321,21 +6118,11 @@ def upstream_loader_dependency_names( loader_function: DiscoveredLoaderFunction, loader_functions: tuple[DiscoveredLoaderFunction, ...], ) -> tuple[str, ...]: ... -def loader_to_source_entry( - *, - project: CompiledProjectView, - loader: DiscoveredLoaderFunction, -) -> SourceEntry: ... def build_intermediate_source_map( *, project: CompiledProjectView, selected_keys: frozenset[CompiledObjectKey], ) -> dict[str, SourceEntry]: ... -def build_upstream_intermediate_source_map( - *, - project: CompiledProjectView, - selected_keys: frozenset[CompiledObjectKey], -) -> dict[str, SourceEntry]: ... def build_source_load_map( *, project: CompiledProjectView, @@ -7349,9 +6136,6 @@ def build_source_load_entries( source_map: dict[str, SourceEntry], is_reload: bool, ) -> tuple[SourceLoadPlanEntry, ...]: ... -def format_model_migrations( - *, lines: list[str], plan: PlanOutput, display_options: DisplayOptions -) -> list[str]: ... def old_name_rows(*, entry: OldNameViewPlanEntry, style: CliStyle) -> list[str]: ... class MigrationFingerprintCache: @@ -7379,19 +6163,6 @@ def gather_warehouse_snapshot( deferred_locations: dict[str, CompiledRelationLocation] | None = None, cursor_scope: CursorSnapshotScope | None = None, ) -> WarehouseSnapshot: ... -def gather_redirected_cursor_snapshots( - *, - project: CompiledProjectView, - adapter: BaseAdapter, - connection: Any, - existing_relations: dict[str, RelationInfo], - target_relations: dict[str, str], - cursor_scope: CursorSnapshotScope, - full_refresh_model_names: frozenset[str], - deferred_locations: dict[str, CompiledRelationLocation] | None = None, - on_progress: Callable[[str], None] | None = None, - origin_cursor_columns: dict[str, str] | None = None, -) -> dict[str, ModelCursorSnapshot]: ... def watermark_type_is_compatible(*, declared_type: str, cursor_type: str | None) -> bool: ... def gather_source_columns( *, @@ -7400,14 +6171,7 @@ def gather_source_columns( connection: Any, source_entries: tuple[SourceEntry, ...] | None = None, ) -> dict[str, tuple[ColumnInfo, ...]]: ... -def gather_source_inspection( - *, - project: CompiledProjectView, - adapter: BaseAdapter, - connection: Any, - source_entries: tuple[SourceEntry, ...] | None, -) -> tuple[dict[str, tuple[ColumnInfo, ...]], frozenset[str]]: ... -def get_semantic_source_columns( +def get_semantic_source_columns( *, project: CompiledProjectView, adapter: BaseAdapter, @@ -7424,25 +6188,6 @@ def check_selected_source_tables_exist( scope: PlannerScope, relations: PlannerRelationsContext, ) -> None: ... -def build_source_read_map( - *, - project: CompiledProjectView, - source_map: dict[str, SourceEntry], - selected_keys: frozenset[CompiledObjectKey], - project_config: ProjectConfig | None, - local_config: LocalConfig | None, - defer_sources_to: str | None, - read_source_names: frozenset[str] | None = None, -) -> dict[str, SourceEntry]: ... -def with_declared_source_reads( - *, - project: CompiledProjectView, - source_map: dict[str, SourceEntry], - source_names: frozenset[str], -) -> dict[str, SourceEntry]: ... -def build_source_freshness_unknown_warnings( - *, source_freshness: DirectSourceFreshnessPlanningResult -) -> tuple[PlanWarning, ...]: ... def build_planner_source_freshness_result( *, project: CompiledProjectView, @@ -7458,12 +6203,6 @@ def resolve_planner_scopes( selection: PlannerSelection, policies: PlannerPolicies, ) -> PlannerScopeResolution: ... -def build_planner_identity_context( - *, - project: CompiledProjectView, - scopes: PlannerScopeResolution, - include_stale_warning_identities: bool = True, -) -> PlannerIdentityContext: ... def detect_stale_warning_changes( *, project: CompiledProjectView, @@ -7472,24 +6211,12 @@ def detect_stale_warning_changes( identities: PlannerIdentityContext, execution_changes: PlannerChangeResults, ) -> PlannerChangeResults: ... -def check_selected_scope_buildability( - *, - runtime: PlannerRuntime, - scopes: PlannerScopeResolution, - warehouse: PlannerWarehouseState, - deferral: DeferralInputs, -) -> None: ... -def resolve_model_full_refresh(*, model: CompiledModelView, cli_full_refresh: bool) -> bool: ... -def effectively_full_refreshed_model_names( - *, project: CompiledProjectView, cli_full_refresh: bool -) -> frozenset[str]: ... def describe_full_rebuild_cause( *, change_result: ChangeDetectionResult, full_refresh: bool ) -> str: ... def check_full_rebuild_allowed( *, model: CompiledModelView, change_result: ChangeDetectionResult, full_rebuild_cause: str ) -> None: ... -def effective_target_config(*, runtime: PlannerRuntime) -> TargetConfig: ... def table_type_copy_name(*, target_name: str, identifier_limit: int) -> str: ... def plan_table_types( *, runtime: PlannerRuntime, warehouse: PlannerWarehouseState, scope: PlannerScope @@ -7497,16 +6224,6 @@ def plan_table_types( def plan_retention( *, runtime: PlannerRuntime, warehouse: PlannerWarehouseState, scope: PlannerScope ) -> tuple[RetentionPlanEntry, ...]: ... -def with_column_rename_hints( - *, entries: tuple[ModelPlanEntry, ...], hints: tuple[ColumnRenameHint, ...] -) -> tuple[ModelPlanEntry, ...]: ... -def gather_planner_warehouse_state( - *, - runtime: PlannerRuntime, - scopes: PlannerScopeResolution, - overrides: PlannerOverrides, - deferral: DeferralInputs, -) -> PlannerWarehouseState: ... def planner_metadata_name_filter( *, project: CompiledProjectView, selected_keys: frozenset[CompiledObjectKey] | None = None ) -> tuple[str, ...] | None: ... @@ -7657,31 +6374,6 @@ class AuditCommandRequest(NativeRecord): json_output_path: Path | None = None, ) -> None: ... -class AuditInvocation(NativeRecord): - """Resolved project, adapter, and reporter context for the audit command.""" - - effective_project_dir: Path - discovered_inputs: DiscoveredProjectInputs - adapter_name: str - adapter: BaseAdapter - connection_config: dict[str, object] - use_color: bool - progress_stream: TextIO - connection_progress: ConnectionProgressReporter - planning_progress: PlanningProgressReporter - def __init__( - self, - effective_project_dir: Path, - discovered_inputs: DiscoveredProjectInputs, - adapter_name: str, - adapter: BaseAdapter, - connection_config: dict[str, object], - use_color: bool, - progress_stream: TextIO, - connection_progress: ConnectionProgressReporter, - planning_progress: PlanningProgressReporter, - ) -> None: ... - class BuildCommandRequest(NativeRecord): """CLI inputs for one build command invocation.""" @@ -7759,89 +6451,6 @@ class BuildCommandRequest(NativeRecord): test_timeout: str | None = None, ) -> None: ... -class BuildInvocation(NativeRecord): - """Resolved project, adapter, and reporter context for the build command.""" - - effective_project_dir: Path - discovered_inputs: DiscoveredProjectInputs - effective_defer_clone_from: str | None - adapter_name: str - adapter: BaseAdapter - connection_config: dict[str, object] - use_color: bool - progress_stream: TextIO - connection_progress: ConnectionProgressReporter - planning_progress: PlanningProgressReporter - should_load_sources: bool - effective_target_name: str | None - execution_limits: ExecutionLimitsConfig - def __init__( - self, - effective_project_dir: Path, - discovered_inputs: DiscoveredProjectInputs, - effective_defer_clone_from: str | None, - adapter_name: str, - adapter: BaseAdapter, - connection_config: dict[str, object], - use_color: bool, - progress_stream: TextIO, - connection_progress: ConnectionProgressReporter, - planning_progress: PlanningProgressReporter, - should_load_sources: bool, - effective_target_name: str | None = None, - execution_limits: ExecutionLimitsConfig = ..., - ) -> None: ... - -class CheckCommandRequest(NativeRecord): - """CLI inputs for one check command invocation.""" - - project_dir: Path | None - no_sql_validation: bool - no_color: bool - selected_target: str | None - select: tuple[str, ...] - exclude: tuple[str, ...] - cli_vars: dict[str, object] | None - json_output: bool - json_output_path: Path | None - def __init__( - self, - project_dir: Path | None = None, - no_sql_validation: bool = False, - no_color: bool = False, - selected_target: str | None = None, - select: tuple[str, ...] = (), - exclude: tuple[str, ...] = (), - cli_vars: dict[str, object] | None = None, - json_output: bool = False, - json_output_path: Path | None = None, - ) -> None: ... - -class CheckInvocation(NativeRecord): - """Resolved project, adapter, and reporter context for the check command.""" - - effective_project_dir: Path - discovered_inputs: DiscoveredProjectInputs - adapter_name: str - adapter: BaseAdapter - connection_config: dict[str, object] - use_color: bool - progress_stream: TextIO - connection_progress: ConnectionProgressReporter - planning_progress: PlanningProgressReporter - def __init__( - self, - effective_project_dir: Path, - discovered_inputs: DiscoveredProjectInputs, - adapter_name: str, - adapter: BaseAdapter, - connection_config: dict[str, object], - use_color: bool, - progress_stream: TextIO, - connection_progress: ConnectionProgressReporter, - planning_progress: PlanningProgressReporter, - ) -> None: ... - class CloneCommandRequest(NativeRecord): """CLI inputs for one clone command invocation.""" @@ -7873,31 +6482,6 @@ class CloneCommandRequest(NativeRecord): event_output_path: Path | None = None, ) -> None: ... -class DbtSqlbuildWorkContext(NativeRecord): - """Shared execution context for one dbt interop SQLBuild work run.""" - - plan_output: PlanOutput - connection_config: dict[str, object] - adapter: BaseAdapter - adapter_name: str - output_stream: TextIO - use_color: bool - snapshots_config: SnapshotsConfig - execution_limits: ExecutionLimitsConfig - concurrency: int - def __init__( - self, - plan_output: PlanOutput, - connection_config: dict[str, object], - adapter: BaseAdapter, - adapter_name: str, - output_stream: TextIO, - use_color: bool, - snapshots_config: SnapshotsConfig, - execution_limits: ExecutionLimitsConfig, - concurrency: int, - ) -> None: ... - class PlanSafetyGates(NativeRecord): """Pre-confirmed plan safety gates and the guidance shown when one needs a terminal.""" @@ -8112,40 +6696,6 @@ class JanitorCommandRequest(NativeRecord): as_target: str | None = None, ) -> None: ... -class JanitorInvocation(NativeRecord): - """Resolved project discovery and output context for janitor.""" - - effective_project_dir: Path - discovered_inputs: DiscoveredProjectInputs - use_color: bool - selected_target: str | None - active_target_name: str | None - as_target: str | None - def __init__( - self, - effective_project_dir: Path, - discovered_inputs: DiscoveredProjectInputs, - use_color: bool, - selected_target: str | None = None, - active_target_name: str | None = None, - as_target: str | None = None, - ) -> None: ... - -class JanitorSettings(NativeRecord): - """Validated effective janitor settings.""" - - retention_days: int - direct_state_history_versions: int - archive_retention_days: int - drop_old_name_views: tuple[str, ...] - def __init__( - self, - retention_days: int, - direct_state_history_versions: int, - archive_retention_days: int = 14, - drop_old_name_views: tuple[str, ...] = (), - ) -> None: ... - class LoadCommandRequest(NativeRecord): """CLI inputs for one load command invocation.""" @@ -8233,19 +6783,6 @@ class PlaygroundCommandRequest(NativeRecord): template: str = ..., ) -> None: ... -class AdapterConnectionContext(NativeRecord): - """Resolved adapter and connection configuration for one CLI command.""" - - adapter_name: str - adapter: BaseAdapter - connection_config: dict[str, object] - def __init__( - self, - adapter_name: str, - adapter: BaseAdapter, - connection_config: dict[str, object], - ) -> None: ... - class ScenarioSnapshotLimitInputs(NativeRecord): """CLI snapshot capture-limit overrides for one scenario run.""" @@ -8325,52 +6862,6 @@ class ScenarioCaptureCommandRequest(NativeRecord): limit_inputs: ScenarioSnapshotLimitInputs = ..., ) -> None: ... -class SeedCommandRequest(NativeRecord): - """CLI inputs for one seed command invocation.""" - - project_dir: Path | None - no_color: bool - selected_target: str | None - select: tuple[str, ...] - exclude: tuple[str, ...] - concurrency: int | None - cli_vars: dict[str, object] | None - json_output: bool - json_output_path: Path | None - def __init__( - self, - project_dir: Path | None, - no_color: bool = False, - selected_target: str | None = None, - select: tuple[str, ...] = (), - exclude: tuple[str, ...] = (), - concurrency: int | None = None, - cli_vars: dict[str, object] | None = None, - json_output: bool = False, - json_output_path: Path | None = None, - ) -> None: ... - -class SeedInvocation(NativeRecord): - """Resolved project, adapter, connection, and output context for seed.""" - - effective_project_dir: Path - discovered_inputs: DiscoveredProjectInputs - adapter_name: str - adapter: BaseAdapter - connection_config: dict[str, object] - use_color: bool - progress_stream: TextIO - def __init__( - self, - effective_project_dir: Path, - discovered_inputs: DiscoveredProjectInputs, - adapter_name: str, - adapter: BaseAdapter, - connection_config: dict[str, object], - use_color: bool, - progress_stream: TextIO, - ) -> None: ... - class TestCommandRequest(NativeRecord): """CLI inputs for one test command invocation.""" @@ -8484,31 +6975,6 @@ class ScopeCommandRequest(NativeRecord): no_color: bool = False, ) -> None: ... -class TestInvocation(NativeRecord): - """Resolved project, adapter, and reporter context for the test command.""" - - effective_project_dir: Path - discovered_inputs: DiscoveredProjectInputs - adapter_name: str - adapter: BaseAdapter - connection_config: dict[str, object] - use_color: bool - progress_stream: TextIO - connection_progress: ConnectionProgressReporter - planning_progress: PlanningProgressReporter - def __init__( - self, - effective_project_dir: Path, - discovered_inputs: DiscoveredProjectInputs, - adapter_name: str, - adapter: BaseAdapter, - connection_config: dict[str, object], - use_color: bool, - progress_stream: TextIO, - connection_progress: ConnectionProgressReporter, - planning_progress: PlanningProgressReporter, - ) -> None: ... - class RulesCommandRequest(NativeRecord): """Inputs for focused rule execution, inspection, or skill generation.""" @@ -8602,33 +7068,6 @@ class BuildCostFinalization(NativeRecord): had_executable_work: bool | None = True, ) -> None: ... -class ContractCommandRequest(NativeRecord): - """CLI inputs for physical contract comparison and repository adoption.""" - - action: str - from_target: str - project_dir: Path | None - select: tuple[str, ...] - exclude: tuple[str, ...] - write: bool - overwrite: bool - json_output: bool - no_color: bool - cli_vars: dict[str, object] | None - def __init__( - self, - action: str, - from_target: str, - project_dir: Path | None = None, - select: tuple[str, ...] = (), - exclude: tuple[str, ...] = (), - write: bool = False, - overwrite: bool = False, - json_output: bool = False, - no_color: bool = False, - cli_vars: dict[str, object] | None = None, - ) -> None: ... - class LineageCommandRequest(NativeRecord): """CLI inputs for dependency and column lineage inspection.""" @@ -8868,49 +7307,6 @@ class SkillUpdateResult(NativeRecord): written_paths: tuple[Path, ...], ) -> None: ... -class CompileAnalysis(NativeRecord): - """Compiled project analysis shared by compile output phases.""" - - discovered_inputs: DiscoveredProjectInputs - adapter: BaseAdapter - graph: ProjectGraph - selected_keys: frozenset[CompiledObjectKey] - lineage: ProjectColumnLineage | None - diagnostics: tuple[CompilerDiagnostic, ...] - discover_ms: int - graph_ms: int - lineage_ms: int - contract_ms: int - contract_cpu_ms: int - built_in_rules_ms: int - custom_rules_ms: int - custom_rules_cpu_ms: int - early_lint_wait_ms: int - rule_cache_hits: int - rule_cache_misses: int - skipped_type_proof_rules: tuple[str, ...] - def __init__( - self, - discovered_inputs: DiscoveredProjectInputs, - adapter: BaseAdapter, - graph: ProjectGraph, - selected_keys: frozenset[CompiledObjectKey], - lineage: ProjectColumnLineage | None, - diagnostics: tuple[CompilerDiagnostic, ...], - discover_ms: int, - graph_ms: int, - lineage_ms: int, - contract_ms: int, - contract_cpu_ms: int, - built_in_rules_ms: int = 0, - custom_rules_ms: int = 0, - custom_rules_cpu_ms: int = 0, - early_lint_wait_ms: int = 0, - rule_cache_hits: int = 0, - rule_cache_misses: int = 0, - skipped_type_proof_rules: tuple[str, ...] = (), - ) -> None: ... - class DbtManifestModel(NativeRecord): """One dbt model node needed for SQLBuild dbt_ref resolution.""" @@ -9301,36 +7697,6 @@ class DbtInteropCommandArgs(NativeRecord): sqlbuild_executable: str = "sqb", ) -> None: ... -class DbtPlanEnvironment(NativeRecord): - """Compiled project and adapter environment for dbt plan-output builds.""" - - project_dir: Path - discovered_inputs: DiscoveredProjectInputs - project: CompiledProjectView - adapter: BaseAdapter - adapter_name: str - def __init__( - self, - project_dir: Path, - discovered_inputs: DiscoveredProjectInputs, - project: CompiledProjectView, - adapter: BaseAdapter, - adapter_name: str, - ) -> None: ... - -class DbtSqlbuildPlanRequest(NativeRecord): - """Selection and native planner inputs for a SQLBuild plan-output build.""" - - selected_model_names: tuple[str, ...] - sqlbuild_args: tuple[str, ...] - external_blocked_model_names: tuple[str, ...] - def __init__( - self, - selected_model_names: tuple[str, ...], - sqlbuild_args: tuple[str, ...], - external_blocked_model_names: tuple[str, ...] = (), - ) -> None: ... - class SourceFreshnessComparableRecord(Protocol): @property def data_version_hash(self) -> str: ... @@ -9725,101 +8091,32 @@ class SqlValueLimits(NativeRecord): max_size: int = ..., ) -> None: ... -class SqlValueValidationError(ValueError): - """An authored value cannot be represented by the typed SQL value domain.""" - -class CompletionState(StrEnum): - """Overall outcome state for a completion summary line.""" - - OK = "ok" - WARN = "warn" - FAIL = "fail" - -class PartialBuildPhaseTimings(NativeRecord): - """Available disjoint phase durations after an exceptional build.""" - - compile_seconds: float | None - planning_seconds: float | None - connection_preparation_seconds: float | None - schema_preparation_seconds: float | None - execution_seconds: float | None - cost_collection_seconds: float | None - total_seconds: float | None - def __init__( - self, - compile_seconds: float | None = None, - planning_seconds: float | None = None, - connection_preparation_seconds: float | None = None, - schema_preparation_seconds: float | None = None, - execution_seconds: float | None = None, - cost_collection_seconds: float | None = None, - total_seconds: float | None = None, - ) -> None: ... - -class CliUserError(Exception): - """Expected CLI-facing error that should be rendered without a traceback.""" - - code: str - message: str - help: str | None - def __init__( - self, message: str, *, code: str | None = None, help: str | None = None - ) -> None: ... - -class StagedArtifactsChangedError(CliUserError): - """Staged compile artifacts changed before publication, so nothing stale is deleted.""" - -class QueryExecutionError(CliUserError): - """The warehouse rejected or failed an ad hoc query.""" - - exit_code: int - -class QueryDiffOutcomeError(CliUserError): - """Expected query-diff failure with an explicit outcome and exit code.""" - - status: str - exit_code: int - def __init__( - self, - message: str, - *, - status: str, - exit_code: int, - code: str | None = None, - help: str | None = None, - ) -> None: ... - -class QueryDiffIncompleteError(QueryDiffOutcomeError): - """Safety or preflight prevented complete value evidence.""" - - def __init__( - self, message: str, *, code: str | None = None, help: str | None = None - ) -> None: ... - -class QueryDiffExecutionError(QueryDiffOutcomeError): - """Setup, execution, ownership publication, or cleanup failed.""" - - def __init__( - self, message: str, *, code: str | None = None, help: str | None = None - ) -> None: ... - -class DiffSizeGuardError(CliUserError): - """A default full model diff stopped before reading data because of table sizes.""" +class SqlValueValidationError(ValueError): + """An authored value cannot be represented by the typed SQL value domain.""" - status: str - exit_code: int - details: dict[str, object] +class PartialBuildPhaseTimings(NativeRecord): + """Available disjoint phase durations after an exceptional build.""" + + compile_seconds: float | None + planning_seconds: float | None + connection_preparation_seconds: float | None + schema_preparation_seconds: float | None + execution_seconds: float | None + cost_collection_seconds: float | None + total_seconds: float | None def __init__( self, - message: str, - *, - details: dict[str, object], - code: str | None = None, - help: str | None = None, + compile_seconds: float | None = None, + planning_seconds: float | None = None, + connection_preparation_seconds: float | None = None, + schema_preparation_seconds: float | None = None, + execution_seconds: float | None = None, + cost_collection_seconds: float | None = None, + total_seconds: float | None = None, ) -> None: ... -class MigrationStateError(ValueError): - """Raised when model migration state inputs or rows are invalid.""" +class CliUserError(Exception): + """Expected CLI-facing error that should be rendered without a traceback.""" code: str message: str @@ -9828,6 +8125,14 @@ class MigrationStateError(ValueError): self, message: str, *, code: str | None = None, help: str | None = None ) -> None: ... +class StagedArtifactsChangedError(CliUserError): + """Staged compile artifacts changed before publication, so nothing stale is deleted.""" + +class QueryExecutionError(CliUserError): + """The warehouse rejected or failed an ad hoc query.""" + + exit_code: int + class ContractFindingKind(StrEnum): """Stable physical-to-authored contract difference categories.""" @@ -9845,13 +8150,6 @@ class CompilerStage(StrEnum): COMPILE_PROJECT_INPUTS = "compile_project_inputs" COMPILED_PROJECT = "compiled_project" -class HookReadType(StrEnum): - """Kind of model hook that declares or writes a read.""" - - PYTHON = "Python" - SQL = "SQL" - INLINE_SQL = "inline SQL" - class LintSeverity(StrEnum): """Severity assigned to one lint violation.""" @@ -9919,12 +8217,6 @@ class ProjectPathError(DiscoveryError): class ResourceIdentityError(DiscoveryError): """Raised when an authored resource identity is not canonical snake_case.""" -class MeasurementAuditError(ValueError): - """Raised when a measurement audit contract or value is invalid.""" - -class ContractAdoptionError(RuntimeError): - """Raised when safe contract source editing cannot continue.""" - class FingerprintInputError(ValueError): """Raised when fingerprint storage inputs or rows are invalid.""" @@ -9941,15 +8233,6 @@ class QueryFingerprintError(ValueError): class NativeStageMismatchError(RuntimeError): """Raised when native state the compiler replays is inconsistent with its inputs.""" -class UnknownLineageDialectError(ValueError): - """Raised, as Python's parser raised `ValueError`, for a dialect Polyglot does not know.""" - -class RefactorValueError(ValueError): - """An unhandled value failure the Python planner also leaves to the caller.""" - -class RefactorIOError(OSError): - """A file read or write failure the Python planner also leaves to the caller.""" - class ScopeError(ValueError): """Base error for invalid scope-domain input.""" @@ -9966,17 +8249,11 @@ class InvalidScopePathError(ScopeError): class InvalidQualifiedIdentityError(ScopeError): """Raised when a qualified scope identity cannot be parsed.""" -class UnindexableScopeError(ScopeError): - """Raised when the native scope index cannot place a discovered path or resource kind.""" - class ScopeValidationError(ScopeError): """Aggregate error raised only when strict scope validation is requested.""" diagnostics: Any -class UnsupportedLexicalSyntaxError(ValueError): - """Raised when an adapter declares lexical rules the native SQL scanners do not support.""" - class LintError(Exception): """A lint or format run could not proceed.""" @@ -9987,15 +8264,9 @@ class LintError(Exception): self, message: str, *, code: str | None = None, help: str | None = None ) -> None: ... -class NativeLintError(LintError): - """The SQLBuild-owned native lint engine rejected a request or response.""" - class ProjectCompileError(LintError): """The project could not be compiled, so its SQL cannot be linted.""" -class LintStoppedError(Exception): - """A speculative lint run was stopped because its result is no longer needed.""" - class SpecConfigError(RuntimeError): """Raised when project specification configuration is invalid.""" @@ -10103,17 +8374,6 @@ class ContractEvidence(NativeRecord): findings: tuple[ContractFinding, ...] = ..., ) -> None: ... -class ContractAdoptionResult(NativeRecord): - from_target: str - evidence: tuple[ContractEvidence, ...] - written_paths: tuple[Path, ...] - def __init__( - self, - from_target: str, - evidence: tuple[ContractEvidence, ...], - written_paths: tuple[Path, ...] = ..., - ) -> None: ... - class ContractValidationResult(NativeRecord): """Diagnostics emitted by model contract validation.""" @@ -10140,38 +8400,6 @@ class LineageGraphViews(NativeRecord): all_keys: dict[str, CompiledObjectKey], ) -> None: ... -class AttachedAuditGateEdge(NativeRecord): - """One ordering edge: the gated node waits for a resource its attached audit reads.""" - - audit_name: str - target: CompiledObjectKey - gated: CompiledObjectKey - read: CompiledObjectKey - def __init__( - self, - audit_name: str, - target: CompiledObjectKey, - gated: CompiledObjectKey, - read: CompiledObjectKey, - ) -> None: ... - -class HookReadEdge(NativeRecord): - """One ordering edge: a model waits for a resource one of its hooks reads.""" - - hook_name: str - gated: CompiledObjectKey - read: CompiledObjectKey - hook_type: HookReadType - hook_path: Path | None - def __init__( - self, - hook_name: str, - gated: CompiledObjectKey, - read: CompiledObjectKey, - hook_type: HookReadType = ..., - hook_path: Path | None = ..., - ) -> None: ... - class QualifiedLineageColumn(NativeRecord): """A resource-qualified column in the collapsed SQLBuild lineage graph.""" @@ -10213,27 +8441,6 @@ class ColumnLineageEdge(NativeRecord): confidence: ColumnLineageConfidence = ..., ) -> None: ... -class DirectSemanticColumnUse(NativeRecord): - """One direct non-projection use of a resolved resource column.""" - - consumer_model: str - context: str - expression_sql: str - source: QualifiedLineageColumn - confidence: ColumnLineageConfidence - line: int | None - column: int | None - def __init__( - self, - consumer_model: str, - context: str, - expression_sql: str, - source: QualifiedLineageColumn, - confidence: ColumnLineageConfidence = ..., - line: int | None = ..., - column: int | None = ..., - ) -> None: ... - class ColumnLineage(NativeRecord): """Lineage for one output column in one model.""" @@ -10266,34 +8473,6 @@ class ModelColumnLineage(NativeRecord): has_star: bool = ..., ) -> None: ... -class RefactorProject(NativeRecord): - """Compiler facts of one project, as the refactoring planner reads them.""" - - project_dir: Path - graph: ProjectGraph - discovered: DiscoveredProjectInputs - def __init__( - self, - project_dir: Path, - graph: ProjectGraph, - discovered: DiscoveredProjectInputs, - ) -> None: ... - -class ManualLocation(NativeRecord): - """A location a refactoring cannot rewrite safely.""" - - path: str - line: int | None - column: int | None - reason: str - def __init__( - self, - path: str, - line: int | None, - column: int | None, - reason: str, - ) -> None: ... - class NativeSqlTestFailure(NativeRecord): """The error one test's assembly raises: its kind and message.""" @@ -10442,23 +8621,6 @@ class LintViolation(NativeRecord): fix_unavailable_reason: str | None = ..., ) -> None: ... -class RuleFixResult(NativeRecord): - """One applied, refused, or unavailable semantic Rule fix.""" - - file_path: Path - code: str - line: int - status: RuleFixStatus - reason: str - def __init__( - self, - file_path: Path, - code: str, - line: int, - status: RuleFixStatus, - reason: str, - ) -> None: ... - class LintConfig(NativeRecord): """Resolved lint and format configuration for one run.""" @@ -10604,44 +8766,6 @@ class ColumnLineageMode(StrEnum): RICH = "rich" FAST = "fast" -class PolyglotAnalysisDialect(StrEnum): - """Dialect names accepted by Polyglot analyze_query.""" - - GENERIC = "generic" - POSTGRESQL = "postgresql" - MYSQL = "mysql" - BIGQUERY = "bigquery" - SNOWFLAKE = "snowflake" - DUCKDB = "duckdb" - SQLITE = "sqlite" - HIVE = "hive" - SPARK = "spark" - TRINO = "trino" - PRESTO = "presto" - REDSHIFT = "redshift" - TSQL = "tsql" - ORACLE = "oracle" - CLICKHOUSE = "clickhouse" - DATABRICKS = "databricks" - ATHENA = "athena" - TERADATA = "teradata" - DORIS = "doris" - STARROCKS = "starrocks" - MATERIALIZE = "materialize" - RISINGWAVE = "risingwave" - SINGLESTORE = "singlestore" - COCKROACHDB = "cockroachdb" - TIDB = "tidb" - DRUID = "druid" - SOLR = "solr" - TABLEAU = "tableau" - DUNE = "dune" - FABRIC = "fabric" - DRILL = "drill" - DREMIO = "dremio" - EXASOL = "exasol" - DATAFUSION = "datafusion" - class MigrationDiscovery(StrEnum): """How a migration was requested.""" @@ -10793,17 +8917,6 @@ class CompileModelConfig(NativeRecord): table_type: ResolvedTableType = ..., ) -> None: ... -class CursorInputRoles(NativeRecord): - """Effective filter and watermark inputs for one compiled model.""" - - filter_inputs: dict[str, str] - watermark_inputs: dict[str, str] - def __init__( - self, - filter_inputs: dict[str, str], - watermark_inputs: dict[str, str], - ) -> None: ... - class DeclarationRuntimeProjection(NativeRecord): """Process-only declaration values keyed by canonical static identity.""" @@ -10866,35 +8979,6 @@ class MacroExpansionResult(NativeRecord): argument_references: tuple[CompileSqlReference, ...] = ..., ) -> None: ... -class VisibleModelDeclarations(NativeRecord): - """One model's visible declarations and macros, as the native model loop resolves them.""" - - local_enums: dict[str, EnumDeclaration] - local_constants: dict[str, ConstantDeclaration] - enums: dict[str, EnumDeclaration] - constants: dict[str, ConstantDeclaration] - inaccessible_enums: dict[str, DeclarationRecord] - inaccessible_constants: dict[str, DeclarationRecord] - enum_visibility: dict[str, tuple[VisibilityRecord, ...]] - constant_visibility: dict[str, tuple[VisibilityRecord, ...]] - macros: dict[str, LoadedMacro] - macro_records: dict[str, DeclarationRecord] - inaccessible_macros: dict[str, DeclarationRecord] - def __init__( - self, - local_enums: dict[str, EnumDeclaration], - local_constants: dict[str, ConstantDeclaration], - enums: dict[str, EnumDeclaration], - constants: dict[str, ConstantDeclaration], - inaccessible_enums: dict[str, DeclarationRecord], - inaccessible_constants: dict[str, DeclarationRecord], - enum_visibility: dict[str, tuple[VisibilityRecord, ...]], - constant_visibility: dict[str, tuple[VisibilityRecord, ...]], - macros: dict[str, LoadedMacro], - macro_records: dict[str, DeclarationRecord], - inaccessible_macros: dict[str, DeclarationRecord], - ) -> None: ... - class DeclarationExpansionContext(NativeRecord): """Declarations and adapter rendering used by one authored SQL owner.""" @@ -10991,19 +9075,6 @@ class PolyglotAnalysisResult(NativeRecord): binding_validated: bool = ..., ) -> None: ... -class AnalysisCacheContext(NativeRecord): - """Shared project-local analysis cache identity for one compile invocation.""" - - root: Path - shared_fingerprint: str - signature_namespace: str - def __init__( - self, - root: Path, - shared_fingerprint: str, - signature_namespace: str = ..., - ) -> None: ... - class CompileAnalysisSelection(NativeRecord): """Deep-analysis selection and invocation-local preparation observer.""" @@ -11054,37 +9125,6 @@ class FunctionReturnColumn(NativeRecord): type: str, ) -> None: ... -class HandBuiltAnalysis(NativeRecord): - """A hand-built model input's session position, fallback columns and standalone proof.""" - - session: tuple[Any, int] | None - fallback: list[tuple[str, str | None, str]] | None - standalone_proof: ( - tuple[ - bool, - list[tuple[str, str | None, str]], - list[tuple[str, str | None]], - list[str], - str | None, - bool, - ] - | None - ) - def __init__( - self, - session: tuple[Any, int] | None, - fallback: list[tuple[str, str | None, str]] | None, - standalone_proof: tuple[ - bool, - list[tuple[str, str | None, str]], - list[tuple[str, str | None]], - list[str], - str | None, - bool, - ] - | None, - ) -> None: ... - class ModelSqlAnalysis(NativeRecord): """Completed model analysis and its in-memory binding proof.""" @@ -11287,17 +9327,6 @@ class CompiledFunction(NativeRecord): description: str | None = ..., ) -> None: ... -class PythonSqlReferenceReport(NativeRecord): - """P008 diagnostics plus literal SQL relations that named no project relation.""" - - diagnostics: tuple[CompilerDiagnostic, ...] - unmatched: tuple[LiteralSqlRelation, ...] - def __init__( - self, - diagnostics: tuple[CompilerDiagnostic, ...] = ..., - unmatched: tuple[LiteralSqlRelation, ...] = ..., - ) -> None: ... - class CompileSqlTestCte(NativeRecord): """One top-level SQL-native test CTE extracted after macro expansion.""" @@ -11970,49 +9999,6 @@ class PythonPlanEntry(NativeRecord): provider_usages: tuple[DiscoveredProviderUsage, ...] = ..., ) -> None: ... -class PythonRunPlanOutputs(NativeRecord): - """Plan output and Python entries after python-aware run selection.""" - - plan_output: PlanOutput - python_plan_entries: tuple[PythonPlanEntry, ...] - selected_python_node_names: frozenset[str] - def __init__( - self, - plan_output: PlanOutput, - python_plan_entries: tuple[PythonPlanEntry, ...], - selected_python_node_names: frozenset[str], - ) -> None: ... - -class CompiledProjectPhaseResult(NativeRecord): - """Canonical project compilation output before command-specific planning.""" - - project: CompiledProjectView - connection_config: dict[str, object] - compile_seconds: float - def __init__( - self, - project: CompiledProjectView, - connection_config: dict[str, object], - compile_seconds: float, - ) -> None: ... - -class StaticCommandContext(NativeRecord): - """Shared compile, selection, and relation phases for focused commands.""" - - project: CompiledProjectView - scope: PlannerScope - relations: PlannerRelationsContext - connection_config: dict[str, object] - compile_seconds: float - def __init__( - self, - project: CompiledProjectView, - scope: PlannerScope, - relations: PlannerRelationsContext, - connection_config: dict[str, object], - compile_seconds: float, - ) -> None: ... - class ClonePipelineOptions(NativeRecord): """Compilation and selection options for one clone pipeline.""" @@ -12725,27 +10711,6 @@ class RulesRunResult(NativeRecord): skipped_type_proof_rules: tuple[str, ...] = ..., ) -> None: ... -class NativeRulesEvaluation(NativeRecord): - """The built-in rules response, decoded natively.""" - - findings: tuple[Finding, ...] - selected_codes: tuple[str, ...] - evaluated_models: int - cache_hits: int - cache_misses: int - built_in_ms: int - reused: bool - def __init__( - self, - findings: tuple[Finding, ...], - selected_codes: tuple[str, ...], - evaluated_models: int, - cache_hits: int, - cache_misses: int, - built_in_ms: int, - reused: bool, - ) -> None: ... - class CustomRulesOutcome(NativeRecord): """Custom-rule findings in canonical order and their cache accounting.""" @@ -13238,19 +11203,6 @@ class ScopeReportFilters(NativeRecord): globals: str = ..., ) -> None: ... -class ScopeSourceLocation(NativeRecord): - """Safe project-relative source location.""" - - path: str - line: int - column: int - def __init__( - self, - path: str, - line: int, - column: int, - ) -> None: ... - class VisibilityProvenance(NativeRecord): """Why a declaration is visible or inaccessible.""" @@ -15305,9 +13257,6 @@ class PlannerInputError(ValueError): self, message: str, *, code: str | None = None, help: str | None = None ) -> None: ... -class NativeSqlTestPlanningError(PlannerInputError): - """Raised when the native SQL-test planning boundary returns invalid data.""" - class FutureCursorSafetyError(PlannerInputError): """Raised when an effective cursor exceeds the configured future limit.""" @@ -16322,29 +14271,6 @@ class CompileInputError(ValueError): self, message: str, *, code: str | None = None, help: str | None = None ) -> None: ... -class MacroArgumentError(CompileInputError): - """Raised when one macro call's arguments do not parse; `offset` is in the expanded SQL.""" - - detail: str - macro_name: str - file_path: Path - offset: int - relative_position: tuple[int, int] - location: SourceLocation | None - def __init__( - self, - *, - detail: str, - help: str, - macro_name: str, - file_path: Path, - offset: int, - relative_position: tuple[int, int], - location: SourceLocation | None = None, - ) -> None: ... - def shifted(self, by: int) -> MacroArgumentError: ... - def located(self, location: SourceLocation) -> MacroArgumentError: ... - class SqlTestReferenceError(CompileInputError): """Raised when a SQL-test CTE calls a reference the test query cannot resolve.""" @@ -17187,43 +15113,6 @@ class DeclarationResolutionContext(NativeRecord): consumer: ResourceIdentity | DeclarationIdentity | None = ..., ) -> None: ... -class ModelInputBuildContext(NativeRecord): - """Run-constant config and macros for building model compile inputs.""" - - effective_vars: dict[str, object] - effective_settings: SettingsConfig - target_config: TargetConfig | None - effective_target_name: str | None - run_id: str - macro_context: MacroContext - loaded_macros: dict[str, LoadedMacro] - value_renderer: TypedSqlValueRenderer - collection_rendering: CollectionRendering - sql_lexical_syntax: SqlLexicalSyntax - public_enums: dict[str, EnumDeclaration] - public_constants: dict[str, ConstantDeclaration] - public_model_schemas: dict[str, ModelSchemaDeclaration] - declaration_resolver: DeclarationScopeResolver | None - def __init__( - self, - effective_vars: dict[str, object], - effective_settings: SettingsConfig, - target_config: TargetConfig | None, - effective_target_name: str | None, - run_id: str, - macro_context: MacroContext, - loaded_macros: dict[str, LoadedMacro], - value_renderer: TypedSqlValueRenderer, - collection_rendering: CollectionRendering, - sql_lexical_syntax: SqlLexicalSyntax, - public_enums: dict[str, EnumDeclaration] = ..., - public_constants: dict[str, ConstantDeclaration] = ..., - public_model_schemas: dict[str, ModelSchemaDeclaration] = ..., - declaration_resolver: DeclarationScopeResolver | None = ..., - ) -> None: ... - @property - def declaration_expansion(self) -> DeclarationExpansionContext: ... - class CompileSqlReference(NativeRecord): """One logical SQL reference discovered from compiled SQL text.""" diff --git a/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/_test_types.py b/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/_test_types.py index 02908a71fe..6020e57fa0 100644 --- a/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/_test_types.py +++ b/tests/e2e/src/sqlbuild/cli/commands/main/sqlite/_test_types.py @@ -17,13 +17,6 @@ class SqliteCommandE2ETestCase: expected_return_code: int = 0 -@dataclass(frozen=True) -class SqliteFileLayoutE2ETestCase: - description: str - expected_tables: tuple[str, ...] - absent_tables: tuple[str, ...] = field(default_factory=tuple) - - @dataclass(frozen=True) class SqliteProjectE2ETestCase: description: str diff --git a/tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/_test_types.py b/tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/_test_types.py deleted file mode 100644 index 05a82380e8..0000000000 --- a/tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/_test_types.py +++ /dev/null @@ -1,11 +0,0 @@ -from dataclasses import dataclass, field - - -@dataclass(frozen=True) -class DefaultBranchDetectionTestCase: - description: str - init_branch: str | None - extra_branches: tuple[str, ...] = field(default_factory=tuple) - set_remote_head_to: str | None = None - is_git_repo: bool = True - expected_ref: str = "main" diff --git a/tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/helpers.py b/tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/helpers.py deleted file mode 100644 index 442648a443..0000000000 --- a/tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/helpers.py +++ /dev/null @@ -1,68 +0,0 @@ -import subprocess -from collections.abc import Callable -from pathlib import Path -from typing import cast - -from tests.integration.src.sqlbuild.cli.commands._helpers.dbt_init._test_types import ( - DefaultBranchDetectionTestCase, -) - - -def build_git_repo_for_case(*, root: Path, test_case: DefaultBranchDetectionTestCase) -> Path: - """Create a git repo on disk matching the test case branch topology.""" - - strategy: Callable[..., Path] = { - False: _preserve_non_git_directory, - True: _build_git_repo, - }[test_case.is_git_repo] - return strategy(root=root, test_case=test_case) - - -def _preserve_non_git_directory(*, root: Path, test_case: DefaultBranchDetectionTestCase) -> Path: - return root - - -def _build_git_repo(*, root: Path, test_case: DefaultBranchDetectionTestCase) -> Path: - """Create the configured repository variant.""" - - _git(root, "init", f"--initial-branch={test_case.init_branch or 'main'}") - _git(root, "config", "user.email", "test@example.com") - _git(root, "config", "user.name", "Test User") - (root / "file.txt").write_text("seed\n", encoding="utf-8") - _git(root, "add", "file.txt") - _git(root, "commit", "-m", "initial") - - branch: str - for branch in test_case.extra_branches: - _git(root, "branch", branch) - - remote_strategy: Callable[..., None] = { - False: _preserve_repo_without_remote_head, - True: _set_remote_head, - }[test_case.set_remote_head_to is not None] - remote_strategy(root=root, remote_head=test_case.set_remote_head_to) - - return root - - -def _preserve_repo_without_remote_head(**_kwargs: object) -> None: - return - - -def _set_remote_head(*, root: Path, remote_head: str | None) -> None: - _git(root, "remote", "add", "origin", str(root)) - _git( - root, - "symbolic-ref", - "refs/remotes/origin/HEAD", - f"refs/remotes/origin/{cast(str, remote_head)}", - ) - - -def _git(root: Path, *args: str) -> None: - subprocess.run( - ("git", "-C", str(root), *args), - capture_output=True, - check=True, - text=True, - ) diff --git a/tests/integration/src/sqlbuild/compiler/discovery/helpers.py b/tests/integration/src/sqlbuild/compiler/discovery/helpers.py index f6996f4d4b..cc2621b29a 100644 --- a/tests/integration/src/sqlbuild/compiler/discovery/helpers.py +++ b/tests/integration/src/sqlbuild/compiler/discovery/helpers.py @@ -380,24 +380,6 @@ def deferred_valid_count(*, expected: list[object], actual: list[object]) -> int ) -def _is_harmful(expected: object, actual: object) -> bool: - return actual != DEFERRED and actual != expected - - -def harmful_mismatches( - *, inputs: list[object], expected: list[object], actual: list[object] -) -> list[tuple[object, object, object]]: - """Return the first few cases where the native reader accepts a different result. - - A native failure defers the file to the Python loader, so only an accepted value that - differs from Python's outcome, including accepting what Python rejects, is harmful. - """ - - return list( - compress(zip(inputs, expected, actual, strict=True), map(_is_harmful, expected, actual)) - )[:3] - - def toml_harmful_mismatches( *, inputs: list[object], expected: list[object], actual: list[object] ) -> list[tuple[object, object, object]]: diff --git a/tests/integration/src/sqlbuild/compiler/helpers.py b/tests/integration/src/sqlbuild/compiler/helpers.py index 2520f88dc3..4ab1958fb4 100644 --- a/tests/integration/src/sqlbuild/compiler/helpers.py +++ b/tests/integration/src/sqlbuild/compiler/helpers.py @@ -434,15 +434,6 @@ def read_golden(name: str) -> list[GoldenEntry]: return json.loads((GOLDEN_DIR / f"{name}.json").read_text(encoding="utf-8")) -def write_golden(name: str, entries: list[GoldenEntry]) -> None: - """Record one golden file; used only by the one-off oracle recording.""" - - GOLDEN_DIR.mkdir(parents=True, exist_ok=True) - _ = (GOLDEN_DIR / f"{name}.json").write_text( - json.dumps(entries, indent=0, sort_keys=True) + "\n", encoding="utf-8" - ) - - def golden_differences( expected: list[GoldenEntry], actual: list[GoldenEntry] ) -> list[GoldenDifference]: diff --git a/tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/__init__.py b/tests/unit/scripts/native_stub/__init__.py similarity index 100% rename from tests/integration/src/sqlbuild/cli/commands/_helpers/dbt_init/__init__.py rename to tests/unit/scripts/native_stub/__init__.py diff --git a/tests/unit/scripts/native_stub/_helpers/__init__.py b/tests/unit/scripts/native_stub/_helpers/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/unit/scripts/native_stub/_helpers/_test_types.py b/tests/unit/scripts/native_stub/_helpers/_test_types.py new file mode 100644 index 0000000000..091805e016 --- /dev/null +++ b/tests/unit/scripts/native_stub/_helpers/_test_types.py @@ -0,0 +1,9 @@ +from dataclasses import dataclass + + +@dataclass(frozen=True) +class NativeStubDriftTestCase: + description: str + stub_text: str + registered: frozenset[str] + expected_drift: tuple[str, ...] diff --git a/tests/unit/scripts/native_stub/_helpers/test_declarations.py b/tests/unit/scripts/native_stub/_helpers/test_declarations.py new file mode 100644 index 0000000000..e1bfbac5a5 --- /dev/null +++ b/tests/unit/scripts/native_stub/_helpers/test_declarations.py @@ -0,0 +1,65 @@ +import pytest + +from scripts.native_stub._helpers.declarations import stub_drift +from tests.unit.scripts.native_stub._helpers._test_types import NativeStubDriftTestCase + +STUB: str = ( + "from typing import Protocol, TypedDict\n" + "\n" + "type Row = tuple[str, int]\n" + "API_VERSION: int\n" + "\n" + "class Handler(Protocol):\n" + " def __call__(self) -> int: ...\n" + "\n" + "class Request(TypedDict):\n" + " name: str\n" + "\n" + "class _Storage:\n" + " def path(self) -> str: ...\n" + "\n" + "class History(_Storage): ...\n" + "\n" + "def digest(text: str) -> str: ...\n" + "def _hook() -> None: ...\n" +) + + +@pytest.mark.parametrize( + "test_case", + [ + NativeStubDriftTestCase( + description="every runtime declaration is registered", + stub_text=STUB, + registered=frozenset({"API_VERSION", "History", "digest", "_hook"}), + expected_drift=(), + ), + NativeStubDriftTestCase( + description="unregistered functions, classes and constants are reported", + stub_text=STUB, + registered=frozenset({"History"}), + expected_drift=("API_VERSION", "_hook", "digest"), + ), + NativeStubDriftTestCase( + description="unregistered class is reported", + stub_text=STUB, + registered=frozenset({"API_VERSION", "digest", "_hook"}), + expected_drift=("History",), + ), + NativeStubDriftTestCase( + description="protocols, typed dicts, aliases and private classes need no registration", + stub_text=STUB, + registered=frozenset({"API_VERSION", "History", "digest", "_hook", "Unrelated"}), + expected_drift=(), + ), + ], + ids=lambda case: case.description, +) +def test_given_native_stub_when_comparing_registered_names_then_reports_unregistered_declarations( + test_case: NativeStubDriftTestCase, +) -> None: + drift: tuple[str, ...] = stub_drift( + stub_text=test_case.stub_text, registered=test_case.registered + ) + + assert drift == test_case.expected_drift diff --git a/tests/unit/src/sqlbuild/cli/commands/_helpers/entry/_test_types.py b/tests/unit/src/sqlbuild/cli/commands/_helpers/entry/_test_types.py index e5edd3e8ac..29b9e9c45f 100644 --- a/tests/unit/src/sqlbuild/cli/commands/_helpers/entry/_test_types.py +++ b/tests/unit/src/sqlbuild/cli/commands/_helpers/entry/_test_types.py @@ -97,15 +97,6 @@ class UntypedCursorParsingTestCase: expected_end: str | None -@dataclass(frozen=True) -class HiddenOptionTestCase: - """A help page and an option that must not appear on it.""" - - description: str - option: str - expected_listed: bool - - @dataclass(frozen=True) class ChoiceListTestCase: """One option whose choices come from a Python enum.""" diff --git a/tests/unit/src/sqlbuild/cli/commands/_helpers/helpers.py b/tests/unit/src/sqlbuild/cli/commands/_helpers/helpers.py index b045f5f8c8..e9aac9965c 100644 --- a/tests/unit/src/sqlbuild/cli/commands/_helpers/helpers.py +++ b/tests/unit/src/sqlbuild/cli/commands/_helpers/helpers.py @@ -4,7 +4,6 @@ from pathlib import Path from sqlbuild._native import ( - ChainStep, CompiledObjectKey, CompiledRelationLocation, CompiledResourceType, @@ -15,7 +14,6 @@ PlanReason, SourceFreshnessIdentity, SourceFreshnessRecord, - SqlTestPlanEntry, build_source_freshness_create_table_sql, ) from sqlbuild.adapter.contract.types import FrameworkType @@ -106,21 +104,6 @@ def model_entry(name: str) -> ModelPlanEntry: ) -def chained_sql_test_entry() -> SqlTestPlanEntry: - return SqlTestPlanEntry( - key=CompiledObjectKey(resource_type=CompiledResourceType.SQL_TEST, name="test_orders"), - name="test_orders", - chain=( - ChainStep(model_name="stg_orders", resolved_sql="select 1"), - ChainStep( - model_name="fct_orders", - resolved_sql="select 1", - expected_cte_sql="select 1", - ), - ), - ) - - def source_freshness_identity() -> SourceFreshnessIdentity: return SourceFreshnessIdentity( source_name="raw_orders", diff --git a/tests/unit/src/sqlbuild/cli/compile_reuse/_helpers/helpers.py b/tests/unit/src/sqlbuild/cli/compile_reuse/_helpers/helpers.py index 2db9ecd581..ed6010b80b 100644 --- a/tests/unit/src/sqlbuild/cli/compile_reuse/_helpers/helpers.py +++ b/tests/unit/src/sqlbuild/cli/compile_reuse/_helpers/helpers.py @@ -5,23 +5,13 @@ from pathlib import Path from typing import ClassVar -import pytest from pydantic import AliasChoices, BaseModel, Field from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict from sqlbuild.cli.compile_reuse.models import ( - SettingsEnvironmentInputs, SettingsInputsResult, ) - -def write_file(path: Path, contents: str) -> None: - """Write one file, creating parent folders.""" - - path.parent.mkdir(parents=True, exist_ok=True) - path.write_text(contents, encoding="utf-8") - - SETTINGS_TOKEN_ENV_VAR: str = "ORDERS_API_TOKEN" SETTINGS_ENV_FILE_NAME: str = "orders_api.env" SETTINGS_SECRETS_DIR_NAME: str = "orders_secrets" @@ -106,30 +96,6 @@ class CommandLineOrdersSettings(BaseSettings): orders_api_token: str = "" -def file_settings_inputs(*, root: Path) -> SettingsEnvironmentInputs: - """Describe FileOrdersSettings as if read from root, the process working directory.""" - - return SettingsEnvironmentInputs( - case_sensitive=False, - names=("orders_api_token",), - prefixes=(), - env_files=(str(root / SETTINGS_ENV_FILE_NAME),), - secrets_dirs=(str(root / SETTINGS_SECRETS_DIR_NAME),), - ) - - -def set_token(monkeypatch: pytest.MonkeyPatch, value: str) -> None: - """Set the tracked token variable.""" - - monkeypatch.setenv(SETTINGS_TOKEN_ENV_VAR, value) - - -def write_settings_file(root: Path, relative_path: str, contents: str) -> None: - """Write one env file or secrets file below root.""" - - write_file(root / relative_path, contents) - - def described_settings_inputs( *, result: SettingsInputsResult ) -> tuple[tuple[bool, tuple[str, ...], tuple[str, ...], tuple[str, ...], tuple[str, ...]], ...]: diff --git a/tests/unit/src/sqlbuild/compiler/planner/_helpers/helpers.py b/tests/unit/src/sqlbuild/compiler/planner/_helpers/helpers.py index f6dd035585..f6d1084adf 100644 --- a/tests/unit/src/sqlbuild/compiler/planner/_helpers/helpers.py +++ b/tests/unit/src/sqlbuild/compiler/planner/_helpers/helpers.py @@ -1119,57 +1119,6 @@ def build_audit_source_map( } -def build_cursor_ref(ref_name: str) -> CompileSqlReference: - """Build a ref-type SQL reference for cursor resolution tests.""" - - return CompileSqlReference( - ref_kind=SqlReferenceKind.REF, - ref_name=ref_name, - ) - - -def build_cursor_model_map( - ref_name: str, - qualified_name: str | None, -) -> dict[str, CompiledModelView]: - """Build a model map with one entry for cursor resolution tests.""" - - model_map: dict[str, CompiledModelView] = { - ref_name: CompiledModel( - key=CompiledObjectKey(resource_type=CompiledResourceType.MODEL, name=ref_name), - deps=(), - name=ref_name, - relative_path=Path(f"models/{ref_name}.sql"), - query_sql="SELECT 1", - config=CompileModelConfig(), - destination=CompiledRelationLocation( - database=None, - schema=None, - name=ref_name, - qualified_name=qualified_name, - ), - ), - } - return ({}, model_map)[qualified_name is not None] - - -def build_cursor_deferred_locations( - ref_name: str, - qualified_name: str | None, -) -> dict[str, CompiledRelationLocation] | None: - """Build deferred locations dict with one entry, or None.""" - - locations: dict[str, CompiledRelationLocation] = { - ref_name: CompiledRelationLocation( - database=None, - schema=None, - name=ref_name, - qualified_name=qualified_name, - ), - } - return (None, locations)[qualified_name is not None] - - def build_cursor_override_model(cursor_type: str | None) -> CompiledModelView: """Build a minimal model with optional cursor_type for override resolution tests.""" diff --git a/tests/unit/src/sqlbuild/executor/janitor/main/_test_types.py b/tests/unit/src/sqlbuild/executor/janitor/main/_test_types.py index 445c7dbf35..528edca1ef 100644 --- a/tests/unit/src/sqlbuild/executor/janitor/main/_test_types.py +++ b/tests/unit/src/sqlbuild/executor/janitor/main/_test_types.py @@ -40,13 +40,6 @@ class JanitorExecuteTestCase: expected_pruned_table_names: tuple[str, ...] = field(default_factory=tuple) -@dataclass(frozen=True) -class JanitorExecutionOrderTestCase: - description: str - expected_error_fragment: str - expected_deleted_state_items: tuple[str, ...] - - def relation_info( name: str, *, diff --git a/tests/unit/src/sqlbuild/executor/janitor/main/helpers.py b/tests/unit/src/sqlbuild/executor/janitor/main/helpers.py index 0adb02c07b..402c648ef6 100644 --- a/tests/unit/src/sqlbuild/executor/janitor/main/helpers.py +++ b/tests/unit/src/sqlbuild/executor/janitor/main/helpers.py @@ -439,24 +439,6 @@ def render_seed_select_before_cursor( raise NotImplementedError -class FailingDropAdapter(FakeJanitorAdapter): - def __init__(self, *, message: str) -> None: - super().__init__(relation_infos=()) - self.message: str = message - - def drop( - self, - connection: Any, - *, - destination: str, - if_exists: bool = True, - statement_recorder: StatementRecorder, - ) -> None: - del connection, if_exists, statement_recorder - self.dropped_targets.append(destination) - raise RuntimeError(self.message) - - class FoldingJanitorAdapter(FakeJanitorAdapter): """Warehouse double that filters case-insensitively and lists lowercase identifiers.""" @@ -616,17 +598,6 @@ def build_project( ) -def relation_info_for_test(*, schema: str, name: str) -> RelationInfo: - return RelationInfo( - database=None, - schema=schema, - name=name, - relation_type="table", - created_at=None, - last_altered_at=None, - ) - - def _append_relation(selected: list[RelationInfo], relation: RelationInfo) -> None: selected.append(relation) diff --git a/tests/unit/src/sqlbuild/integrations/dagster/helpers.py b/tests/unit/src/sqlbuild/integrations/dagster/helpers.py index d97ed5225c..036ed0e904 100644 --- a/tests/unit/src/sqlbuild/integrations/dagster/helpers.py +++ b/tests/unit/src/sqlbuild/integrations/dagster/helpers.py @@ -345,44 +345,6 @@ def write_blocking_fake_sqb_command(*, root: Path, release_path: Path) -> list[s return ["python", str(script_path)] -def write_blocking_clone_event_command( - *, root: Path, release_path: Path, command: str = "clone" -) -> list[str]: - event_payload: str = json.dumps( - integration_result_payload( - command=command, - asset={"kind": "model", "name": "orders", "status": "success", "action": "cloned"}, - ) - ) - script_path: Path = root / "blocking_clone_event.py" - script_path.write_text( - "\n".join( - ( - "from pathlib import Path", - "import os", - "import sys", - "import time", - "event_path = Path(os.environ['SQLBUILD_INTEGRATION_RESULT_PATH'])", - f"event_path.write_text({event_payload + chr(10)!r}, encoding='utf-8')", - f"release_path = Path({str(release_path)!r})", - "while not release_path.exists():", - " time.sleep(0.01)", - "json_path = Path(sys.argv[sys.argv.index('--json-output') + 1])", - "json_path.write_text(" - ' \'{"version": 1, "command": "clone", "status": "success", \'' - ' \'"summary": {"success_count": 1}, "assets": \'' - ' \'[{"kind": "model", "name": "orders", "status": "success", \'' - ' \'"action": "cloned"}], "checks": []}\',' - " encoding='utf-8'," - ")", - ) - ) - + "\n", - encoding="utf-8", - ) - return ["python", str(script_path)] - - def write_blocking_execution_event_command( *, root: Path, release_path: Path, command: str, asset_name: str = "customers" ) -> list[str]: diff --git a/tests/unit/src/sqlbuild/integrations/dbt/_test_types.py b/tests/unit/src/sqlbuild/integrations/dbt/_test_types.py index 0da4a83d31..627b36c488 100644 --- a/tests/unit/src/sqlbuild/integrations/dbt/_test_types.py +++ b/tests/unit/src/sqlbuild/integrations/dbt/_test_types.py @@ -87,15 +87,6 @@ class DbtRunnerCommandTestCase: expected_argv: tuple[str, ...] -@dataclass(frozen=True) -class DbtModeGuardTestCase: - description: str - virtual_environments: bool - expected_error_fragment: str | None - expected_code: str | None - expected_help_fragment: str | None - - @dataclass(frozen=True) class DbtSelectionErrorTestCase: description: str diff --git a/tests/unit/src/sqlbuild/integrations/dbt/helpers.py b/tests/unit/src/sqlbuild/integrations/dbt/helpers.py index 5caa2f16bb..24290f5e19 100644 --- a/tests/unit/src/sqlbuild/integrations/dbt/helpers.py +++ b/tests/unit/src/sqlbuild/integrations/dbt/helpers.py @@ -9,11 +9,6 @@ from typing import cast from sqlbuild._native import ( - BackfillAction, - BackfillResult, - CompiledObjectKey, - CompiledRelationLocation, - CompiledResourceType, CompileModelConfig, CompileModelInput, CompileProjectInputs, @@ -28,10 +23,6 @@ DiscoveredProjectInputs, DiscoveredSqlModelFile, LocalConfig, - MaterializationType, - ModelPlanEntry, - PlanAction, - PlanReason, ProjectConfig, SqlLexicalSyntax, assemble_project, @@ -144,30 +135,6 @@ def build_dbt_ls_command_result( return DbtCommandResult(argv=argv, returncode=0, stdout=stdout) -def _build_sqlbuild_model_plan_entry(model_name: str) -> ModelPlanEntry: - return ModelPlanEntry( - key=CompiledObjectKey( - resource_type=CompiledResourceType.MODEL, - name=model_name, - ), - name=model_name, - relative_path=Path(f"models/{model_name}.sql"), - materialization_type=MaterializationType.TABLE, - action=PlanAction.CREATE_TABLE, - reason=PlanReason.NO_CHANGE, - destination=CompiledRelationLocation( - database=None, - schema=None, - name=model_name, - qualified_name=None, - ), - fingerprint_query_sql="select 1", - resolved_sql="select 1", - logical_ddl="", - backfill=BackfillResult(action=BackfillAction.FORWARD_ONLY), - ) - - def build_dbt_plan_mapping_invoker( *, options: DbtCliOptions, @@ -351,46 +318,6 @@ def build_manifest_source_node( return node -def build_manifest_seed_node( - *, - unique_id: str, - package_name: str = "analytics", - name: str = "countries", - relation_name: str | None = None, - database: str | None = None, - schema: str | None = None, - alias: str | None = None, - checksum: str | None = None, - config_overrides: dict[str, object] | None = None, - root_path: str | None = None, - original_file_path: str | None = None, -) -> dict[str, object]: - """Build a minimal dbt manifest seed node.""" - - node: dict[str, object] = { - "unique_id": unique_id, - "resource_type": "seed", - "package_name": package_name, - "name": name, - } - optional_fields: tuple[tuple[str, object, bool], ...] = ( - ("relation_name", relation_name, relation_name is not None), - ("database", database, database is not None), - ("schema", schema, schema is not None), - ("alias", alias, alias is not None), - ("checksum", {"checksum": checksum}, checksum is not None), - ("config", config_overrides, config_overrides is not None), - ("root_path", root_path, root_path is not None), - ("original_file_path", original_file_path, original_file_path is not None), - ) - field_name: str - field_value: object - is_present: bool - for field_name, field_value, is_present in optional_fields: - node.update(_OPTIONAL_FIELD_BUILDERS[is_present](field_name, field_value)) - return node - - def build_compiled_project_with_models(sql_by_model_name: dict[str, str]) -> CompiledProjectView: """Build a minimal compiled project from model SQL strings.""" diff --git a/tests/unit/src/sqlbuild/lint/_helpers/_test_types.py b/tests/unit/src/sqlbuild/lint/_helpers/_test_types.py index 51fcfc51c6..51ae37e7db 100644 --- a/tests/unit/src/sqlbuild/lint/_helpers/_test_types.py +++ b/tests/unit/src/sqlbuild/lint/_helpers/_test_types.py @@ -62,40 +62,6 @@ class FormatDescriptionTestCase: expected_contents: str -@dataclass(frozen=True) -class InvalidNativeSqlResponseTestCase: - """Test case for rejecting malformed native SQL lint responses.""" - - description: str - response: str - expected_message: str - - -@dataclass(frozen=True) -class NativeSqlReuseTestCase: - """Identity for native SQL reuse behavior.""" - - description: str - expected_call_count: int - - -@dataclass(frozen=True) -class NativeSqlDependencyCacheTestCase: - """Dependency identities that must remain part of native lint cache identity.""" - - description: str - expected_call_count: int - - -@dataclass(frozen=True) -class NativeParseIsolationTestCase: - """Native parser fault that must not stop later bodies.""" - - description: str - error_message: str - expected_position: tuple[int, int] - - @dataclass(frozen=True) class ReservedCteLintTestCase: """Test case for SQLBuild harness CTE filtering.""" @@ -124,18 +90,6 @@ class NativeSqlFindingTestCase: expected_violation_count: int -@dataclass(frozen=True) -class GeneratedRangeFallbackTestCase: - """Test case for a diagnostic that crosses generated SQL.""" - - description: str - authored: str - expanded: str - diagnostic_start: int - diagnostic_end: int - expected_position: tuple[int, int] - - @dataclass(frozen=True) class NeutralizeInterpolationTestCase: """Test case for interpolation neutralization.""" diff --git a/tests/unit/src/sqlbuild/lint/_helpers/helpers.py b/tests/unit/src/sqlbuild/lint/_helpers/helpers.py index f54c0e2632..dfcb5f2de8 100644 --- a/tests/unit/src/sqlbuild/lint/_helpers/helpers.py +++ b/tests/unit/src/sqlbuild/lint/_helpers/helpers.py @@ -6,7 +6,6 @@ from pathlib import Path from sqlbuild._native import ( - HeaderSpan, InterpolationSite, LintBody, LintConfig, @@ -14,31 +13,9 @@ lint_native_sql_bodies, neutralize_lint_interpolation, restore_lint_interpolation, - scan_headers, - sql_body_ranges, ) -def lint_bodies_for(*, file_path: Path, contents: str) -> tuple[LintBody, ...]: - """Build unexpanded lint bodies for every SQL body in the contents.""" - - headers: tuple[HeaderSpan, ...] = scan_headers(contents=contents) - bodies: list[LintBody] = [] - body_start: int - body_end: int - for body_start, body_end in sql_body_ranges(contents=contents, headers=headers): - bodies.append( - LintBody( - file_path=file_path, - body_start=body_start, - body_end=body_end, - lint_text=contents[body_start:body_end], - passes=(), - ) - ) - return tuple(bodies) - - def unused_cte_orders_file( *, tmp_path: Path, prefix: str, file_index: int, unused_cte_count: int ) -> tuple[Path, str, LintBody]: diff --git a/uv.lock b/uv.lock index a0cd3839c2..1f393e1857 100644 --- a/uv.lock +++ b/uv.lock @@ -4258,7 +4258,6 @@ dependencies = [ { name = "polyglot-sql-chio" }, { name = "pydantic-settings" }, { name = "pyyaml" }, - { name = "rich" }, { name = "sqlbuild-cli" }, ] @@ -4343,7 +4342,6 @@ requires-dist = [ { name = "pydantic-settings", specifier = ">=2,<3" }, { name = "pymssql", marker = "extra == 'sqlserver'", specifier = ">=2.3.0" }, { name = "pyyaml", specifier = ">=6.0.2" }, - { name = "rich", specifier = ">=15.0.0" }, { name = "rivers", marker = "extra == 'rivers'", specifier = ">=0.1.4" }, { name = "snowflake-connector-python", marker = "extra == 'snowflake'", specifier = ">=4.7.1,<5" }, { name = "sqlbuild-cli", directory = "crates/sqlbuild-cli" },