You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f08ff72
Browse filesBrowse the repository at this point in the historyBrowse files
perf: keep the build identity out of sqlbuild-rules so edits stop rebuilding it
The source hash that keys local caches was a compile-time constant in
sqlbuild-rules, whose build script hashes every workspace crate. Any source
edit therefore rebuilt sqlbuild-rules and every crate above it, and the
constant changed the same codegen units of the extension on every build.
The hash now lives in a leaf crate, sqlbuild-build-identity, behind one
non-inlined accessor. sqb and the extension install it into sqlbuild-rules
at startup through sqlbuild-cli; reading it before then fails instead of
falling back. Cache keys and BUILD_IDENTITY keep the same value.
Copy file name to clipboardExpand all lines: crates/README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ tested and benchmarked with `cargo test` alone.
8
8
| Crate | Responsibility |
9
9
|---|---|
10
10
|`sqlbuild-build-features`| No code. Enables, in the `sqb` build, the dependency features the extension build resolves, so Cargo compiles the crates both builds share (polyglot-sql, `sqlbuild-analysis`, `sqlbuild-rules` and the rest) once. `make check-build-features` (part of `make check-ci`) fails when the two builds resolve a shared crate differently and names the features to add. |
11
+
|`sqlbuild-build-identity`| The content identity of the native build: a hash of every workspace crate's sources, manifest and lockfile, behind one accessor. It rebuilds after any source edit, so only the top-level crates (`sqlbuild-python` and `sqlbuild-cli`) depend on it; they install the identity into `sqlbuild-rules` at startup, so the crates in between keep their incremental builds. |
11
12
|`sqlbuild-core`| Constants shared by several crates, the panic boundary that turns an unwinding native failure into a named compiler error, passive identity, diagnostic and SQL value types, text positions, a JSON emitter whose output matches Python's `json.dumps` and `orjson` byte for byte, and run-cost allocation with exact Python `decimal` default-context arithmetic and Snowflake query-history SQL. |
12
13
|`sqlbuild-cursor`| Microbatch cursor algebra: typed cursor values, grain flooring and stepping, half-open interval clamping, merging and batch splitting, timestamp text normalization and calendar durations, with Python `datetime` results and errors. Zones other than fixed offsets are resolved through a caller-supplied lookup. |
13
14
|`sqlbuild-process-ownership`| Proof that a live process owns a scheduler worker claim, and the only way to stop one: an inherited claim lock on Linux and macOS, checked through `/proc` and a pidfd or through libproc with a start-time recheck, and a private named Job object on Windows. It is the only crate allowed unsafe code, for those platform calls. |
@@ -23,7 +24,7 @@ tested and benchmarked with `cargo test` alone.
23
24
|`sqlbuild-render`| Macro call scanning, argument evaluation, expansion, splicing, memoisation and persistent call-store keys. Python executes user macro bodies at the extension boundary. |
24
25
|`sqlbuild-attachments`| Native attachment of tests, audits, sources, functions, scenarios and seeds, including argument merging, validation and audit policy resolution. Adapter value rendering remains an extension boundary. |
25
26
|`sqlbuild-analysis`| SQL analysis over polyglot: query analysis, binding, semantic validation and usage, column references, type normalization, FAST/RICH lineage, SQL-test/scenario extraction and compiler-side assembly, and Snowflake cost statement classification and query-tag parsing. |
26
-
|`sqlbuild-rules`| Built-in rules and the rules engine, the custom-rule host, SQL lint, quality checks and formatting, rules configuration and the request models. It also owns the build identity script. |
27
+
|`sqlbuild-rules`| Built-in rules and the rules engine, the custom-rule host, SQL lint, quality checks and formatting, rules configuration and the request models. Its caches and rule fingerprints key on the build identity the binary installs at startup. |
27
28
|`sqlbuild-refactor`| Native rename/move plans, contract-adoption edits, MODEL/SCHEMA/YAML text edits and atomic staging/commit with rollback. Shared scope placement delegates to the native scope implementation; user Python source inspection remains at the Python AST boundary. |
28
29
|`sqlbuild-project`| The compiled project as plain Rust: `CompiledProject` with the producers' facts and each resource's records (model inputs and schemas, compiled models and their analysis, sources, functions, audits and seeds), and what those records answer without Python, such as lineage rows, resolved namespaces and dependency keys. Values the host owns, such as user config and discovered files, and the views it builds lazily live in one slot per record, whose types `sqlbuild-python` supplies through the `ProjectHost` trait; reads that need Python stay in the bindings as extension traits. |
29
30
|`sqlbuild-cli`| The `sqb` and `sqlbuild` executables: `--version`, unchanged compiles replayed from the shared reuse store with Python's exact streams, exit code and compute log capture, and a handoff of every other invocation to the installed `sqlbuild-python` script. Built as its own wheel (`crates/sqlbuild-cli/pyproject.toml`). |
0 commit comments