Repository navigation
Commit 7203112
authored
refactor(native): delete the Python discovery implementation (#1007)
* refactor(native): read bounded discovery entry points through native discovery
Scope inspection, selected contract discovery, model description inputs
and SQL test fixture formatting now read model, SQL test, scenario and
source files and the declaration layout through the native discovery
instead of the Python discovery helpers. Native discovery gains model
name and test path selection, per-file fault reporting, in-memory SQL
test and scenario parsing, and declaration scans isolated to one kind,
so these callers keep their exact outcomes. The Python engine's
discovery stage is unchanged and remains the differential oracle.
* feat(native): replace native discovery deferrals with native errors
Model, SQL test, scenario, source and schema files and the declaration
layout are now discovered natively under both compiler engines, with no
Python fallback:
- Unreadable files raise Python's own read errors natively: the exact
UnicodeDecodeError for invalid UTF-8 and OSError for refused reads,
with Windows error codes mapped the way Python maps them.
- Invalid YAML in sources files (D006) and seed declarations or
schema.yml (D005) names the file, line and column. YAML outside the
supported plain subset (tabs, directives, Python-only tags, recursive
aliases and similar) fails with the same codes and a hint.
- A model, SQL test, scenario, source or schema file whose path is not
UTF-8 fails with D016, showing invalid bytes as \xNN escapes; callers
that tolerate bad files report it per file. Other files and directories
with such names are ignored and declaration files are read by their
real names, as before; every name keeps its own identity even when
names share a lossy spelling. A non-UTF-8 project directory fails.
- Native discovery runs on Windows: paths print with backslashes, sort
case-insensitively as Python's Windows paths do, and junctions are
walked like directories. A Windows CI job covers it.
- An unknown Python or Unicode version fails with D017 naming the
supported Python versions.
The discovery fact cache, which only served the Python fallbacks, is
removed.
* refactor(native): delete the Python discovery implementation
Model, SQL test, scenario, source and schema file discovery and the
declaration layout scan now exist only in native discovery, for both
compiler engines. Delete the Python walkers, parsers, YAML loaders and
the discovery fact cache they used, keep the Python semantic layers that
build discovered objects from native results, and point the remaining
behaviour tests at native discovery. Parity oracles that compared the
two implementations are removed with the Python side.
* build: support Python 3.12 to 3.14 only
Native discovery ships Unicode and text tables for Python 3.12, 3.13 and
3.14 and refuses other versions, so declare that range in
requires-python and the lockfile, and say "Python 3.12–3.14" in the
quickstart and contributing guide.
* fix(native): show Windows lone surrogates as units and test Windows raw names
A raw-segment test built its names from POSIX byte hex, which Windows
decodes as UTF-16 units, so it failed there. The product round-trips
Windows names correctly; only the display was off: a lone surrogate in
U+DC80-U+DCFF was shown as a \xNN byte. Windows now always shows lone
surrogates as \uXXXX, in Rust and in Python's own messages.
Decoding and display take the platform as a parameter so Linux tests
cover both the POSIX and the Windows branches, and a Windows-only test
walks real files whose names hold lone surrogates.
* fix(cli): write CLI output as UTF-8 under legacy code pages
When stdout or stderr was opened with a non-UTF-8 encoding, such as the
Windows cp1252 code page used for pipes and redirects, sqb crashed with
E001 on the first non-ASCII character of its summary output.
The CLI entry point now reconfigures any non-UTF-8 standard stream to
UTF-8 with backslashreplace, so output never fails to encode and JSON
output stays valid. Library use and the rule-engine host process are
unaffected.1 parent e166844 commit 7203112
146 files changed
Lines changed: 3989 additions & 2996 deletions
File tree
- .github/workflows
- crates
- sqlbuild-config/src
- yaml
- _helpers
- sqlbuild-core/src/text
- main
- sqlbuild-discovery
- src
- _helpers
- declarations
- _helpers
- main
- tests
- model_files
- _helpers
- main
- tests
- sql_tests
- _helpers
- main
- tests
- tree
- _helpers
- main
- tests
- yaml_files
- _helpers
- main
- tests
- sqlbuild-python/src/bindings
- _helpers/discovery
- scripts/compiler_differential
- _helpers/corpus
- src/sqlbuild
- .agents/skills/sqlbuild/references/docs
- concepts
- cli
- commands/_helpers/compile
- entry
- _helpers
- main
- compiler/discovery
- _helpers
- filesystem
- native
- sql
- yml
- classes
- main
- tests
- e2e
- scripts/compiler_differential
- src/sqlbuild/cli/commands/main/playground
- integration/src/sqlbuild
- cli/commands/main
- compiler/discovery
- unit/src/sqlbuild
- cli/entry
- _helpers
- compiler/discovery
- _helpers
- lint/_helpers
- website/src/content/docs/docs
- concepts
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 | |
|---|---|---|---|
| |||
335 | 335 | | |
336 | 336 | | |
337 | 337 | | |
338 | | - | |
| 338 | + | |
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
342 | 342 | | |
343 | | - | |
| 343 | + | |
344 | 344 | | |
345 | 345 | | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
346 | 393 | | |
347 | 394 | | |
348 | 395 | | |
| |||
762 | 809 | | |
763 | 810 | | |
764 | 811 | | |
| 812 | + | |
765 | 813 | | |
766 | 814 | | |
767 | 815 | | |
| |||
783 | 831 | | |
784 | 832 | | |
785 | 833 | | |
| 834 | + | |
786 | 835 | | |
787 | 836 | | |
788 | 837 | | |
| |||
806 | 855 | | |
807 | 856 | | |
808 | 857 | | |
| 858 | + | |
809 | 859 | | |
810 | 860 | | |
811 | 861 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
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 | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
37 | 49 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
71 | 76 | | |
72 | 77 | | |
73 | 78 | | |
| |||
92 | 97 | | |
93 | 98 | | |
94 | 99 | | |
95 | | - | |
96 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
97 | 106 | | |
98 | 107 | | |
99 | 108 | | |
| |||
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
106 | | - | |
| 115 | + | |
107 | 116 | | |
108 | 117 | | |
109 | 118 | | |
| |||
130 | 139 | | |
131 | 140 | | |
132 | 141 | | |
133 | | - | |
| 142 | + | |
134 | 143 | | |
135 | 144 | | |
136 | 145 | | |
| |||
212 | 221 | | |
213 | 222 | | |
214 | 223 | | |
215 | | - | |
| 224 | + | |
216 | 225 | | |
217 | 226 | | |
218 | 227 | | |
| |||
281 | 290 | | |
282 | 291 | | |
283 | 292 | | |
284 | | - | |
| 293 | + | |
285 | 294 | | |
286 | 295 | | |
287 | 296 | | |
| |||
304 | 313 | | |
305 | 314 | | |
306 | 315 | | |
| 316 | + | |
307 | 317 | | |
308 | 318 | | |
309 | 319 | | |
310 | 320 | | |
311 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
312 | 333 | | |
313 | 334 | | |
314 | | - | |
| 335 | + | |
315 | 336 | | |
316 | 337 | | |
317 | 338 | | |
| |||
321 | 342 | | |
322 | 343 | | |
323 | 344 | | |
324 | | - | |
| 345 | + | |
325 | 346 | | |
326 | 347 | | |
327 | 348 | | |
| |||
340 | 361 | | |
341 | 362 | | |
342 | 363 | | |
343 | | - | |
344 | | - | |
345 | | - | |
| 364 | + | |
346 | 365 | | |
347 | 366 | | |
348 | 367 | | |
| |||
361 | 380 | | |
362 | 381 | | |
363 | 382 | | |
364 | | - | |
365 | | - | |
366 | | - | |
| 383 | + | |
367 | 384 | | |
368 | 385 | | |
369 | 386 | | |
370 | | - | |
| 387 | + | |
371 | 388 | | |
372 | 389 | | |
373 | 390 | | |
| |||
398 | 415 | | |
399 | 416 | | |
400 | 417 | | |
401 | | - | |
| 418 | + | |
402 | 419 | | |
403 | 420 | | |
404 | 421 | | |
| |||
426 | 443 | | |
427 | 444 | | |
428 | 445 | | |
429 | | - | |
| 446 | + | |
430 | 447 | | |
431 | 448 | | |
432 | 449 | | |
| |||
0 commit comments