Skip to content

Commit a2a7d4b

Browse files
committed
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.
1 parent 32aa75a commit a2a7d4b

82 files changed

Lines changed: 241 additions & 3252 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/verify.yml‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ jobs:
147147
;;
148148
esac
149149
case "${path}" in
150-
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)
150+
scripts/compiler_differential/*|scripts/run_compiler_differential.py|tests/*/scripts/compiler_differential/*|tests/goldens/*|tests/e2e/fixtures/*|website/examples/*|.github/workflows/verify.yml|Makefile)
151151
compiler_differential=true
152152
;;
153153
esac
@@ -163,16 +163,16 @@ jobs:
163163
performance=true
164164
rules_performance=true
165165
;;
166-
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/*)
166+
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/*)
167167
broad=true
168168
performance=true
169169
;;
170-
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/*)
170+
src/sqlbuild/executor/build/*|src/sqlbuild/executor/run/*|src/sqlbuild/presentation/*)
171171
# Inspection, plan, and build guards run inside the fresh-process compile jobs.
172172
broad=true
173173
performance=true
174174
;;
175-
src/sqlbuild/rule_engine/*|src/sqlbuild/lint/*|scripts/rules_benchmark/*|scripts/benchmark_rules_ci.py|tests/performance/*)
175+
src/sqlbuild/rule_engine/*|src/sqlbuild/lint/*|scripts/rules_benchmark/*|scripts/benchmark_rules_ci.py)
176176
broad=true
177177
performance=true
178178
format_performance=true

‎Makefile‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL := /bin/bash
22

3-
.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 \
3+
.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 \
44
check-e2e-shards test-e2e-duckdb test-e2e-duckdb-build-core \
55
test-e2e-duckdb-build-incremental \
66
test-e2e-duckdb-cli-data test-e2e-duckdb-cli test-e2e-duckdb-inspection \
@@ -645,7 +645,7 @@ verify-quick:
645645
exit $$status
646646

647647

648-
check-ci: check-e2e-shards check-native-layering check-build-features check-python-boundary check-release-gate check-docs-skill rust-lint
648+
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
649649
uv run ruff format --check .
650650
uv run ruff check .
651651
uv run ty check src tests
@@ -657,6 +657,10 @@ check-native-layering:
657657
uv run python -m scripts.check_native_layering
658658

659659

660+
check-native-stub:
661+
uv run python -m scripts.check_native_stub
662+
663+
660664
check-build-features:
661665
uv run python -m scripts.check_build_features
662666

‎crates/sqlbuild-analysis/src/compiled_project/models.rs‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,16 +140,6 @@ pub struct ModelLoopSettings {
140140
pub require_sql_analysis: bool,
141141
}
142142

143-
/// The `description` config value's shape.
144-
#[derive(Clone, Debug, Default, PartialEq, Eq)]
145-
pub enum DescriptionShape {
146-
#[default]
147-
Absent,
148-
Text(String),
149-
/// Present but not a non-blank string.
150-
Invalid,
151-
}
152-
153143
/// The per-model `sql_analysis` / legacy `sql_validation` override.
154144
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
155145
pub enum AnalysisOverride {

‎crates/sqlbuild-config/src/command_connection/constants.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ pub const CLI_WAREHOUSE_SOURCE: &str = "--warehouse";
44
pub const CONNECTION_WAREHOUSE_SOURCE: &str = "connection warehouse";
55
pub const CONNECTION_DEFAULT_WAREHOUSE_SOURCE: &str = "connection default";
66
pub const CONNECTION_WAREHOUSE_KEY: &str = "warehouse";
7-
pub const CONNECTION_DATABASE_KEY: &str = "database";
87
pub const CONNECTION_SOURCE_KEY: &str = "source";
98
pub const DBT_PROFILE_CONNECTION_SOURCE: &str = "dbt_profile";
109
pub const DUCKDB_ADAPTER: &str = "duckdb";

‎crates/sqlbuild-core/src/dbt_cli/constants.rs‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@
22
33
/// The dbt executable when no override is set.
44
pub const DEFAULT_DBT_EXECUTABLE: &str = "dbt";
5-
/// SQLBuild cursor flags `sqb dbt` forwards to SQLBuild.
6-
pub const CURSOR_FLAGS: [&str; 4] = [
7-
"--start-cursor-ts",
8-
"--end-cursor-ts",
9-
"--start-cursor-int",
10-
"--end-cursor-int",
11-
];
125
/// SQLBuild-only flags `sqb dbt run` and `sqb dbt build` accept.
136
pub const EXECUTION_SQLBUILD_FLAGS: [&str; 7] = [
147
"--start-cursor-ts",

‎crates/sqlbuild-core/src/diagnostic_routing/constants.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub const SAFE_FIELDS: [&str; 7] = [
5757
/// The safe fields a retained SQL diagnostic keeps.
5858
pub const SQL_SAFE_FIELDS: [&str; 4] = ["sql_action", "sql_digest", "sql_intent", "sql_query_id"];
5959
/// Python logging level numbers.
60-
pub const LEVEL_DEBUG: i64 = 10;
6160
pub const LEVEL_INFO: i64 = 20;
6261
pub const LEVEL_WARNING: i64 = 30;
6362
pub const LEVEL_ERROR: i64 = 40;

‎crates/sqlbuild-core/src/event_export/constants.rs‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ pub const OUTCOME_EVENT_TYPES: [&str; 6] = [
3232
pub const OUTCOME_RESERVE_FRACTION: f64 = 0.25;
3333
pub const RETRY_EVENT_TYPE: &str = "retry_scheduled";
3434
pub const RETRY_EVENT_KIND: &str = "retry";
35-
pub const RESOURCE_EVENT_PREFIX: &str = "resource";
3635
pub const FAILED_EVENT_SUFFIX: &str = "_failed";
3736
pub const FAILED_EVENT_PRIORITY: u8 = 3;
3837
pub const TERMINAL_EVENT_PRIORITY: u8 = 2;

‎crates/sqlbuild-core/src/text/models.rs‎

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ pub struct TextPosition {
99
pub column: usize,
1010
}
1111

12-
/// A half-open range of text.
13-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
14-
pub struct TextSpan {
15-
pub start: TextPosition,
16-
pub end: TextPosition,
17-
}
18-
1912
/// Line starts of one text, converting offsets into Python-compatible lines and columns.
2013
#[derive(Clone, Debug, PartialEq, Eq)]
2114
pub struct LineIndex<'text> {
@@ -64,38 +57,4 @@ impl<'text> LineIndex<'text> {
6457
column,
6558
})
6659
}
67-
68-
/// The position at a code-point offset (a Python string index), or `None` past the end.
69-
pub fn position_at_char(&self, char_offset: usize) -> Option<TextPosition> {
70-
if char_offset > self.char_len {
71-
return None;
72-
}
73-
let line_index = self
74-
.line_char_starts
75-
.partition_point(|start| *start <= char_offset)
76-
- 1;
77-
let line_start = self.line_byte_starts[line_index];
78-
let column = char_offset - self.line_char_starts[line_index] + 1;
79-
let byte_offset = self.text[line_start..]
80-
.char_indices()
81-
.nth(column - 1)
82-
.map_or(self.text.len(), |(offset, _)| line_start + offset);
83-
Some(TextPosition {
84-
byte_offset,
85-
char_offset,
86-
line: line_index + 1,
87-
column,
88-
})
89-
}
90-
91-
/// The span between two UTF-8 byte offsets, or `None` when either end is not a position.
92-
pub fn span_at_bytes(&self, start: usize, end: usize) -> Option<TextSpan> {
93-
if start > end {
94-
return None;
95-
}
96-
Some(TextSpan {
97-
start: self.position_at_byte(start)?,
98-
end: self.position_at_byte(end)?,
99-
})
100-
}
10160
}

‎crates/sqlbuild-core/src/text/tests/test_text.rs‎

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ use crate::text::main::decimal_digit_value::decimal_digit_value;
22
use crate::text::main::decode_text::decode_text;
33
use crate::text::main::is_decimal_digit::is_decimal_digit;
44
use crate::text::models::LineIndex;
5-
use crate::text::tests::test_types::{
6-
DecimalDigitTestCase, DecodeTestCase, PositionTestCase, SpanTestCase,
7-
};
5+
use crate::text::tests::test_types::{DecimalDigitTestCase, DecodeTestCase, PositionTestCase};
86

97
#[test]
108
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() {
6159
for test_case in test_cases {
6260
let index = LineIndex::new(test_case.text);
6361
let position = index.position_at_byte(test_case.byte_offset);
64-
let round_trip = position.and_then(|found| index.position_at_char(found.char_offset));
6562
assert_eq!(
6663
position.map(|found| (found.char_offset, found.line, found.column)),
6764
test_case.expected_position,
6865
"{}",
6966
test_case.description
7067
);
71-
assert_eq!(round_trip, position, "{} round trip", test_case.description);
72-
}
73-
}
74-
75-
#[test]
76-
fn given_byte_ranges_when_building_spans_then_both_ends_are_positions() {
77-
let test_cases = [
78-
SpanTestCase {
79-
description: "range on the second line",
80-
text: "one\ntwo é three",
81-
byte_range: (8, 10),
82-
expected_ends: Some(((2, 5), (2, 6))),
83-
},
84-
SpanTestCase {
85-
description: "reversed range is rejected",
86-
text: "one",
87-
byte_range: (2, 1),
88-
expected_ends: None,
89-
},
90-
];
91-
for test_case in test_cases {
92-
let span = LineIndex::new(test_case.text)
93-
.span_at_bytes(test_case.byte_range.0, test_case.byte_range.1);
94-
assert_eq!(
95-
span.map(|found| (
96-
(found.start.line, found.start.column),
97-
(found.end.line, found.end.column)
98-
)),
99-
test_case.expected_ends,
100-
"{}",
101-
test_case.description
102-
);
10368
}
10469
}
10570

‎crates/sqlbuild-core/src/text/tests/test_types.rs‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@ pub(super) struct PositionTestCase {
55
pub(super) expected_position: Option<(usize, usize, usize)>,
66
}
77

8-
pub(super) struct SpanTestCase {
9-
pub(super) description: &'static str,
10-
pub(super) text: &'static str,
11-
pub(super) byte_range: (usize, usize),
12-
pub(super) expected_ends: Option<((usize, usize), (usize, usize))>,
13-
}
14-
158
pub(super) struct DecodeTestCase {
169
pub(super) description: &'static str,
1710
pub(super) bytes: &'static [u8],

0 commit comments

Comments
 (0)