Repository navigation
Commit 06fa96d
authored
refactor(native): split the native crate into a layered workspace (#983)
* refactor(native): rename the native crate to sqlbuild-python under a versioned workspace
The extension crate becomes the Python boundary crate of a Cargo workspace. The release
version moves to the workspace package so every native crate shares it, and maturin, uv
cache keys, release automation and fensu paths follow the new location.
* refactor(native): keep PyO3 classes and conversions in the bindings module
ProjectCatalog, CompactAnalysisJob, BindingPositions and ParsedRulesRequest become thin
Python classes in bindings that wrap plain native models, and catalog mapping requests are
converted from Python at the boundary. Method names, signatures, GIL release, panic
handling and exception types are unchanged, so later crates can stay free of PyO3.
* refactor(native): extract sqlbuild-core with shared constants and the panic boundary
The constants used by more than one future crate and the PyO3-free panic catcher move to a
dependency-free sqlbuild-core crate, with the panic tests. The Python crate keeps the named
exception and guards, and the build identity now hashes every workspace crate.
* refactor(native): extract sqlbuild-sqltext for lexical scanning and model headers
SQL scanning, the rules quote policy, model header tokenization and matching, static
variable substitution and static reference extraction move with their tests to a
polyglot-free sqlbuild-sqltext crate. Items other crates use become public; behaviour is
unchanged.
* refactor(native): extract sqlbuild-analysis for polyglot query analysis
Query analysis, the binding catalog, semantic validation and usage, column references,
SQL tokens and SQL-test extraction, planning and rendering move with their tests and the
function-name data to sqlbuild-analysis, the lowest crate that depends on polyglot. A
test-support feature exposes one test-only helper to dependent crates' tests, and the
workspace states the insertion-ordered JSON feature every crate already relied on.
* refactor(native): extract sqlbuild-rules for rules, lint, quality and formatting
Built-in rules, the rules engine and custom-rule host, SQL lint, quality checks, the
formatter, rules configuration and the request models move with their tests to
sqlbuild-rules. It owns the build identity script, which still hashes every workspace
crate, so sqlbuild-python is left with only the PyO3 bindings.
* refactor(native): route cross-crate use through main entries and declare the crates to fensu
Items other crates use are reached through main entry points, models and types modules
instead of helpers: the static reference type moves to types.rs, the rules dialect and the
test-only built-in function list gain main entries, and the panic boundary splits into one
entry per function with its message in constants. fensu now declares every workspace
crate and its exceptions follow the moved files.
* refactor(native): enforce one-way crate layering and matching versions in check-ci
The workspace declares its crates from the bottom up, and a check run by make check-ci
fails when a crate depends on a later layer (resolving aliased workspace dependencies to
their packages), when any crate other than sqlbuild-python reaches PyO3, or when a crate
below sqlbuild-analysis reaches polyglot. It also fails when the workspace, pyproject and
release-please versions differ, since the version is part of the build identity.
crates/README.md documents the crates, the graph and the check.
* fix(native): include the workspace manifest in the build identity
Dependency features and release profiles live in the workspace Cargo.toml, so changing them
left BUILD_IDENTITY and every cache keyed on it unchanged. The build script now hashes and
watches the workspace manifest next to the lockfile and exports the hashed workspace files,
which a test asserts.1 parent 89d64a5 commit 06fa96d
374 files changed
Lines changed: 2325 additions & 1186 deletions
File tree
- .github/workflows
- crates
- sqlbuild-analysis
- function_names
- src
- column_references
- _helpers
- main
- tests
- compiler
- _helpers
- sql_tests
- main
- tests
- query_analysis
- _helpers
- main
- tests
- semantic_usage
- tests
- semantic_validation
- _helpers
- main
- tests
- sql_tokens
- _helpers
- main
- reserved_keywords
- tests
- sqlbuild-core
- src
- panics
- main
- tests
- sqlbuild-python
- src
- bindings
- _helpers
- main
- sqlbuild-rules-native
- src
- bindings
- _helpers
- main
- column_references/main
- compiler
- _helpers
- model_headers
- sql_interpolation
- sql_references
- sql_tests
- main
- configuration
- _helpers
- main
- engine
- _helpers
- main
- query_analysis/main
- rules
- _helpers
- main
- scope_metadata
- semantic_validation
- _helpers
- sql_lint
- _helpers
- main
- sql_quality/main
- sql_scan
- _helpers
- main
- sql_tokens
- _helpers
- main
- sqlbuild-rules
- src
- configuration
- _helpers
- main
- engine
- _helpers
- main
- tests
- rules
- _helpers
- main
- scope_metadata
- sql_lint
- _helpers
- main
- tests
- fixtures
- sql_quality
- _helpers
- main
- tests
- sqlbuild-sqltext
- src
- compiler
- _helpers
- model_headers
- sql_interpolation
- sql_references
- main
- tests
- sql_scan
- _helpers
- main
- tests
- scripts
- native_layering
- _helpers
- main
- tests/unit
- scripts/native_layering
- _helpers
- src/sqlbuild/lint
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
7 | 25 | | |
| 26 | + | |
8 | 27 | | |
9 | 28 | | |
10 | 29 | | |
| |||
36 | 55 | | |
37 | 56 | | |
38 | 57 | | |
39 | | - | |
| 58 | + | |
| 59 | + | |
40 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
41 | 65 | | |
42 | 66 | | |
43 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
569 | | - | |
| 569 | + | |
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
573 | 573 | | |
574 | 574 | | |
575 | 575 | | |
576 | 576 | | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
577 | 581 | | |
578 | 582 | | |
579 | 583 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments