Repository navigation
Commit 1ecc1d0
authored
fix!: batch of refactor, sink, audit, CLI and rules fixes (#1202)
* fix: move and rename a model's unit tests with sqb rename and sqb mv
A model's own unit test files, whose every TEST block targets only that
model, now follow it: test_<model>[__<behavior>].sql files take the new
name, TEST (name "<model>__<behavior>") headers take the new subject, and
files in the folder mirroring the model move to the folder mirroring the
destination. The edits are verified in the scratch compile like every
other edit, reported in --dry-run, and written only when verification
passes.
* fix: list USING joins and keep lambda parameters in audit-argument column renames
An audit argument that joins on the renamed column with USING or NATURAL
is now listed for a manual edit instead of failing the verification
compile. The column analyser treats a lambda parameter named like the
column as its own scope, so references in the lambda body are no longer
renamed to the outer column.
* fix: resume lifecycle sink delivery after one slow call
A sink call over the one-second timeout used to block that sink for the
rest of the command, silently dropping every later event including run
and invocation outcomes. Delivery now resumes on a fresh worker once the
slow call returns; events dropped meanwhile are still counted, outcome
events are held and delivered instead of dropped, and the command warns
when the stall begins. The timeout clock only charges calls the delivery
thread has started and caps each dispatcher round's charge, so time
spent waiting for the GIL is not blamed on the sink. The exit warning now
points at sink health and the shutdown deadline instead of only the
shutdown timeout.
* fix!: reject generic audit arguments the audit's SQL never uses
An attached generic audit that passes an argument neither its SQL nor its
evidence SQL reads, including a misspelt one, now fails the compile with
an error naming the audit, the argument to remove and the definition
file. Such arguments used to be ignored, so the audit silently checked
something other than what the attachment declared.
BREAKING CHANGE: projects whose audit attachments pass arguments the
audit never reads must remove those arguments.
* docs: document the rendered audit SQL compile writes under target/compiled/audits
sqb compile already writes each attached generic audit's rendered SQL to
target/compiled/audits/generic/<resource>/ and removes it with the
attachment, but nothing said so. Document the compiled artifact layout
and cover the audit files, and their cleanup, with an end-to-end test.
* fix: print expected CLI errors whose text holds undecodable bytes
A selector with undecodable bytes made sqb compile crash with a Unicode
error instead of reporting S007, in text mode and with --json. Expected
error text now keeps lone surrogates as \xNN or \uXXXX escapes before it
is printed or put in the JSON report.
* fix(rules): stop treating # as a Snowflake line comment
The Rules scanner skipped Snowflake code after #, which Snowflake does
not treat as a comment (only -- and //), so dependency calls there were
missed. The scanner now matches the Snowflake tokenizer.
* fix(rules): report SELECT * in plain set-operation branches
SQBRMODEL102 only inspected a query's body when it was a single SELECT,
so a star in any branch of UNION, INTERSECT or EXCEPT went unreported.
The rule now checks every plain SELECT branch of each query body.
* test: pin the S101 missing-database message to one settings example
* fix: keep an audit's other options in the 64-bit option help
The help for an oversized minimum_samples or evidence_limit showed the
audit call with only the offending option, so copying it dropped the
audit's name, severity and other options. It now repeats the whole call
with only the offending value replaced.
* fix(rules): exempt each dynamic-pivot SELECT * branch of a set operation
SQBRMODEL102 now checks every set-operation branch, but the dynamic-pivot
exemption was decided once per query and never matched a set-operation
body, so a union of dynamic-pivot star branches was reported per branch
although a lone dynamic-pivot star is exempt. The exemption now applies
to each branch.
* fix: keep delivering lifecycle events when the stall warning cannot be written
A failing stderr write of the blocked-sink warning ended the dispatcher
thread, leaving queued events undelivered and uncounted. The warning is
now best-effort.
* fix: keep a unit test in its folder when a move would change what it resolves
Test SQL resolves macros, enums and constants from the test file's own
folder, so moving a model's test to the destination's mirrored folder
could hide a folder-scoped test declaration, failing verification. A
test file now moves only when every scoped declaration it uses resolves
to the same definition from the destination folder; otherwise it is
renamed in place and the output's new notes section names the file and
the declaration. The JSON output gains a notes array.
* style: satisfy the doc-comment, parameter and test-shape checks for the batch
* test: expect escaped errors for undecodable selectors
Two integration tests pinned the previous crash (a TypeError) for a selector with undecodable bytes. Expected CLI errors now print that text escaped, so the tests assert the escaped S007 error and a valid ASCII JSON report.1 parent 2e05617 commit 1ecc1d0
84 files changed
Lines changed: 2038 additions & 136 deletions
File tree
- crates
- sqlbuild-analysis/src/column_references
- _helpers
- tests
- sqlbuild-attachments/src/audits
- _helpers
- main
- tests
- sqlbuild-cli/src/dispatch
- main
- tests
- sqlbuild-model-config/src/header_metadata/_helpers
- sqlbuild-python/src/bindings/_helpers
- cli
- event_exporting
- input_loops
- refactor
- scopes
- sqlbuild-refactor/src
- refactor_command
- main
- tests
- refactoring
- _helpers
- edits
- planning
- main
- tests
- sqlbuild-rules/src
- engine/tests
- query_facts
- _helpers
- rules/_helpers
- sqlbuild-scopes/src/scope_report
- _helpers
- main
- scripts/compiler_differential/_helpers/corpus
- src/sqlbuild/.agents/skills/sqlbuild/references/docs
- cli
- concepts
- observability
- tests
- e2e/src/sqlbuild/cli/commands/main
- audit
- compile
- providers
- refactor
- goldens/compiler/failure
- integration/src/sqlbuild
- cli
- commands/main
- compile_outputs
- recall
- compiler/model_config
- unit/src/sqlbuild/runtime/event_exporting/classes
- website/src/content/docs/docs
- cli
- concepts
- observability
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 | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
349 | 350 | | |
350 | 351 | | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
355 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
356 | 364 | | |
357 | 365 | | |
358 | 366 | | |
359 | 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 | + | |
| 393 | + | |
| 394 | + | |
360 | 395 | | |
361 | 396 | | |
362 | 397 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
79 | 94 | | |
80 | 95 | | |
81 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
18 | 21 | | |
19 | 22 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
83 | 105 | | |
84 | 106 | | |
85 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
3 | 5 | | |
4 | 6 | | |
5 | 7 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
36 | 40 | | |
37 | 41 | | |
38 | 42 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
28 | 30 | | |
29 | 31 | | |
30 | 32 | | |
31 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
| |||
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
0 commit comments