Repository navigation
Commit 6f3bee6
authored
refactor: digest rule facts and read declared columns natively (#1122)
* refactor(rules): digest custom-rule facts natively
Recompute and digest recorded custom-rule facts from the native compiled
project in Rust instead of rebuilding Python fact views and encoding them
with orjson. Rule hosts digest live filesystem reads through the same native
encoder, project-tree file reads are native, and the custom-rule cache
runtime version is bumped so entries keyed on the old digests miss.
* refactor(rules): read per-model rule inputs natively
Read model names, project paths and materializations for custom-rule cache
rows, rule selection, run summaries and the native rules request through the
compiled model views directly instead of per-model attribute lookups.
* refactor(compile): read declared model columns and SQL from native facts
Answer declared column rows, custom-rule SQL facts and semantic-check audit
metadata of compiled model views from the native facts and schema records
the compile already holds, instead of rebuilding schema entries and reading
each column back through Python attributes.
* refactor(compile): build declared column facts natively and read them in schema readers
Build each model's declared column facts (name, type, nullability,
description, migration source, audit definitions and location) from the
parsed header and the named schema while the column specs are built, instead
of reading every merged and enum-resolved column back through Python
attributes. Audit attachment, declared relation types and nullability,
relation keys and semantic-check audit metadata read these facts and touch a
column's Python spec only for its audits. Model input records keep the model
name, so readers no longer derive it from the file path.
* refactor(compile): run model analysis directly from project assembly
Project assembly now starts, runs and finishes the native model analysis
session through Rust calls on typed request and result structs, instead of
building a NativeModelAnalysisRequest record and calling
analyze_native_model_sql and start_model_analysis_session through the
extension module. The request and result record classes and both module
functions are removed.
The analysis session tests now assemble real projects with a cold, a warm
and no analysis cache and compare those assemblies; their goldens are
unchanged. Tests that could only reach unreachable internal invariants
through the removed module seam are dropped; the duplicate-name invariant
stays covered by the native session tests.
* perf(rules): lint shared compile expansions without copying them up front
Early SQL lint and SQL rules keep references to the compile's shared
authored and expanded SQL texts instead of copying every model's expansion
into owned strings before linting. A file's expansion is converted only when
that file is linted and dropped afterwards.
* perf(compile): free the analysis request early and keep schema facts lean
Model analysis converts its session request before running the session, so
the per-model request rows are freed instead of living through the run.
Declared column facts keep only what readers use: whether a column is
described, and the location of columns declared outside the model file.
Attached schemas no longer copy every column fact; the declared-relation
reader asks for them on its own.
* fix: tag numbers in custom-rule fact digests and keep Windows read errors and model path lookups
* fix: load project Python from current source so same-size edits are never hidden by cached bytecode
* refactor: name user-code spec arguments and split root registration
* fix: keep installed packages on cached bytecode and order the user-code finder after built-in importers
* test: pause the slow lint macro by expanded file, not by thread1 parent ecc31b7 commit 6f3bee6
110 files changed
Lines changed: 3534 additions & 2059 deletions
File tree
- crates
- sqlbuild-analysis/src/compiled_project
- sqlbuild-cache/src/hosted_shapes
- sqlbuild-python/src/bindings/_helpers
- analysis_session
- compile_driver
- compiled_project
- compiler_errors
- compiler_records
- contracts
- native_host
- project_assembly
- records
- rules
- semantic_checks
- sqlbuild-rules/src
- engine/_helpers
- project_tree
- _helpers
- main
- tests
- src/sqlbuild
- adapter
- contract/classes
- discovery/_helpers
- compiler
- discovery/_helpers/filesystem
- pipeline/_helpers
- rule_engine
- _helpers
- engine
- host
- classes
- runtime/user_code
- _helpers
- classes
- main
- tests
- e2e/src/sqlbuild/cli/commands/main
- compile
- rules
- integration/src/sqlbuild
- compiler/analysis_session
- rule_engine
- fact_digests
- host_payload
- unit/src/sqlbuild
- rule_engine
- _helpers/engine
- runtime/user_code
- main
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 | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
1104 | 1104 | | |
1105 | 1105 | | |
1106 | 1106 | | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | 1107 | | |
1116 | 1108 | | |
1117 | 1109 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
111 | | - | |
| 111 | + | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
163 | | - | |
164 | 163 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | 164 | | |
175 | | - | |
| 165 | + | |
176 | 166 | | |
177 | 167 | | |
178 | 168 | | |
| |||
188 | 178 | | |
189 | 179 | | |
190 | 180 | | |
191 | | - | |
| 181 | + | |
192 | 182 | | |
193 | 183 | | |
194 | 184 | | |
| |||
213 | 203 | | |
214 | 204 | | |
215 | 205 | | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
216 | 218 | | |
217 | 219 | | |
218 | | - | |
| 220 | + | |
219 | 221 | | |
220 | 222 | | |
221 | 223 | | |
| |||
236 | 238 | | |
237 | 239 | | |
238 | 240 | | |
239 | | - | |
| 241 | + | |
240 | 242 | | |
241 | 243 | | |
242 | 244 | | |
| |||
265 | 267 | | |
266 | 268 | | |
267 | 269 | | |
268 | | - | |
269 | | - | |
270 | | - | |
| 270 | + | |
271 | 271 | | |
272 | 272 | | |
273 | 273 | | |
| |||
514 | 514 | | |
515 | 515 | | |
516 | 516 | | |
517 | | - | |
518 | 517 | | |
519 | 518 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
30 | 33 | | |
31 | 34 | | |
32 | 35 | | |
33 | | - | |
34 | | - | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
90 | 93 | | |
91 | 94 | | |
92 | 95 | | |
93 | | - | |
| 96 | + | |
94 | 97 | | |
95 | 98 | | |
96 | 99 | | |
| |||
324 | 327 | | |
325 | 328 | | |
326 | 329 | | |
327 | | - | |
| 330 | + | |
328 | 331 | | |
329 | 332 | | |
330 | | - | |
| 333 | + | |
331 | 334 | | |
332 | 335 | | |
333 | 336 | | |
| |||
346 | 349 | | |
347 | 350 | | |
348 | 351 | | |
349 | | - | |
350 | | - | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
| |||
357 | 358 | | |
358 | 359 | | |
359 | 360 | | |
360 | | - | |
361 | | - | |
362 | | - | |
363 | | - | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | | - | |
379 | | - | |
380 | | - | |
381 | | - | |
382 | | - | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
383 | 372 | | |
384 | 373 | | |
385 | 374 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
37 | 36 | | |
38 | 37 | | |
39 | 38 | | |
| |||
0 commit comments