Repository navigation
Commit 45005ee
authored
feat(server): preview plans from the synced warehouse copy (#1437)
* feat(state): add the display-only observations state table
* feat(state): record cursor observations after successful builds
After a build, each successful incremental model's cursor MAX is read with
the planner's own cursor SQL and appended to the observations table in its
state schema. Failures only warn.
* feat(state): record described source columns after builds
A build keeps the columns planning described for each type-enforced
expression source and appends them as source_columns observations in the
state schema of every model reading the source. Plans record nothing.
* feat(orchestration): mirror build observations into the control store
Location sync reads _sqlbuild_observations as its own history kind and
the server keeps the rows in sqb_warehouse_observations, keyed by the
observation identity, with kind and node columns for latest-value reads.
* test(policy): keep build observations out of planning and build decisions
Add Fensu rule XSB078: Rust code may name observation state only in the
files that write, prune, mirror or display it. An E2E build ignores a
wrong cursor_max observation and appends from the live MAX.
* fix(observations): record the described SQL hash with source columns
A source_columns value is now {sql_hash, columns}, the SHA-256 of the
exact expression SQL planning described, so a preview can tell when the
expression changed since the observation and report it as unknown.
* feat(server): serve the mirrored copy a plan preview plans from
Add POST .../metadata/preview-copy for a location's fenced reader. It
returns the target's catalog relations, each node's newest fingerprint
with its definition, newest succeeded run and newest observation per
kind, and synced_at: the oldest of the newest clean syncs of catalog,
fingerprints and consumption, or null until all three synced cleanly.
* feat(plan): plan location previews from the synced warehouse copy
A location's requested plan now fetches the server's synced copy and runs
sqb plan against an adapter that answers listings, columns and fingerprints
from it, never connecting to the warehouse. Cursor targets use the newest
successful build's cursor_max, inputs are read when the run starts, and
expression sources use the columns described for the same SQL. The plan
reports when the copy synced and what stays unknown until the run, and
refuses --defer-to. Fensu XSB079 confines the synced copy to sqb plan.
* refactor(state): share the fixed-column state table DDL between consumption and observations
* refactor(plan): render the copy's optional database without a higher-layer helper
* feat(ui): show what a plan preview planned from and each incremental window start
A location plans a build from the server's synced copy of warehouse
metadata. The plan page now says when that copy synced, lists what stays
unknown until the run, and shows each incremental model's window start
running to the latest data when the run starts.
* docs(server): explain that plan previews read the synced warehouse copy
* refactor(plan): read a synced-copy listing's scope in one place
Record why the remaining per-table state bindings, the SQL Server keyed
state DDL overrides, the observation ingest projection and the copy's
Python object builders look alike.
* test(plan): move the preview test's helpers beside the publication helpers
Name the preview cases' outcomes expected_ and keep the Fensu rules module
to its rule functions.
* fix(plan): keep previews within the synced copy on every adapter and project shape
Table types and retention stay unknown instead of reading the warehouse,
and sources outside the mirrored schemas are not probed. The copy counts
as synced only once every schema the snapshot builds into has synced each
required table. A model whose lookback, backfill duration or microbatches
move its start reports its window as unknown.
* fix(plan): keep source freshness and moved cursor windows unknown in previews
A preview observes no source freshness and warns about none, and reports a
cursor window as unknown when lookback, replay on change, a start override,
or a cursor_start floor past the last build moves the run's start. Cursor
intrinsics bind to the bounds the run resolves, and typed source
projections render through the facade.
* fix(plan): bind preview cursor intrinsics only for models with watermark inputs
Keep the preview's runtime-resolved bounds to models whose watermark inputs
it cleared, so a model live planning cannot bound still fails the preview.
XSB079 now also confines the synced copy's refusal error.1 parent 71c36b3 commit 45005ee
102 files changed
Lines changed: 3801 additions & 265 deletions
File tree
- benchmarks/duckshop/edge_cases/orchestration
- clients/typescript/src
- crates
- sqlbuild-analysis/src/janitor_planning
- sqlbuild-cache/src/digest
- main
- sqlbuild-cli/src/native_commands/main
- sqlbuild-core/src
- plan_display
- sqlbuild-orchestration
- src
- api
- _helpers/resources
- platform
- _helpers
- main
- store
- warehouse_metadata
- _helpers
- main
- ingest
- location_reads
- tests/api
- warehouse_metadata
- events
- preview_copy
- sqlbuild-python/src/bindings/_helpers
- build_command
- cli
- execution_history
- exported_constants
- freshness
- janitor
- native_host
- observations
- plan_command
- plan_output
- planner_phases
- planner_resolution
- planner_warehouse
- recall
- sqlbuild-state/src
- observations
- main
- scripts/fensu_policy
- _helpers
- rules
- src/sqlbuild
- .agents/skills/sqlbuild/references/docs/cli
- adapters
- bigquery/classes
- clickhouse/classes
- databricks/classes
- duckdb/classes
- motherduck/classes
- postgres/classes
- snowflake/classes
- sqlite/classes
- sqlserver/classes
- adapter/contract/classes
- tests
- e2e/src/sqlbuild/cli/commands/main/build
- integration
- scripts/fensu_policy
- src/sqlbuild/compiler/compiled_project/publication
- catalog
- ui/src
- lib
- api
- mock
- types
- run
- routes/plan
- website/src/content/docs/docs/cli
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 | |
|---|---|---|---|
| |||
147 | 147 | | |
148 | 148 | | |
149 | 149 | | |
| 150 | + | |
150 | 151 | | |
151 | 152 | | |
152 | 153 | | |
| |||
| 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 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
1013 | 1029 | | |
1014 | 1030 | | |
1015 | 1031 | | |
| |||
2308 | 2324 | | |
2309 | 2325 | | |
2310 | 2326 | | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
2311 | 2351 | | |
2312 | 2352 | | |
2313 | 2353 | | |
| |||
3078 | 3118 | | |
3079 | 3119 | | |
3080 | 3120 | | |
| 3121 | + | |
| 3122 | + | |
| 3123 | + | |
| 3124 | + | |
| 3125 | + | |
| 3126 | + | |
| 3127 | + | |
| 3128 | + | |
| 3129 | + | |
| 3130 | + | |
| 3131 | + | |
| 3132 | + | |
| 3133 | + | |
| 3134 | + | |
| 3135 | + | |
| 3136 | + | |
| 3137 | + | |
| 3138 | + | |
| 3139 | + | |
3081 | 3140 | | |
3082 | 3141 | | |
3083 | 3142 | | |
3084 | 3143 | | |
3085 | | - | |
| 3144 | + | |
3086 | 3145 | | |
3087 | 3146 | | |
3088 | 3147 | | |
| |||
3131 | 3190 | | |
3132 | 3191 | | |
3133 | 3192 | | |
| 3193 | + | |
| 3194 | + | |
| 3195 | + | |
| 3196 | + | |
| 3197 | + | |
| 3198 | + | |
| 3199 | + | |
| 3200 | + | |
| 3201 | + | |
| 3202 | + | |
| 3203 | + | |
| 3204 | + | |
| 3205 | + | |
3134 | 3206 | | |
3135 | 3207 | | |
3136 | 3208 | | |
| |||
5889 | 5961 | | |
5890 | 5962 | | |
5891 | 5963 | | |
| 5964 | + | |
| 5965 | + | |
| 5966 | + | |
| 5967 | + | |
| 5968 | + | |
| 5969 | + | |
| 5970 | + | |
| 5971 | + | |
| 5972 | + | |
| 5973 | + | |
| 5974 | + | |
| 5975 | + | |
| 5976 | + | |
| 5977 | + | |
| 5978 | + | |
| 5979 | + | |
| 5980 | + | |
| 5981 | + | |
| 5982 | + | |
| 5983 | + | |
| 5984 | + | |
| 5985 | + | |
| 5986 | + | |
| 5987 | + | |
| 5988 | + | |
| 5989 | + | |
| 5990 | + | |
| 5991 | + | |
| 5992 | + | |
| 5993 | + | |
| 5994 | + | |
| 5995 | + | |
| 5996 | + | |
| 5997 | + | |
| 5998 | + | |
| 5999 | + | |
| 6000 | + | |
| 6001 | + | |
| 6002 | + | |
| 6003 | + | |
| 6004 | + | |
| 6005 | + | |
| 6006 | + | |
| 6007 | + | |
| 6008 | + | |
| 6009 | + | |
| 6010 | + | |
| 6011 | + | |
| 6012 | + | |
| 6013 | + | |
| 6014 | + | |
| 6015 | + | |
| 6016 | + | |
| 6017 | + | |
| 6018 | + | |
5892 | 6019 | | |
5893 | 6020 | | |
5894 | 6021 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 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 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
| 12 | + | |
10 | 13 | | |
11 | 14 | | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
| 28 | + | |
24 | 29 | | |
25 | 30 | | |
26 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
27 | 61 | | |
28 | 62 | | |
29 | 63 | | |
| |||
57 | 91 | | |
58 | 92 | | |
59 | 93 | | |
| 94 | + | |
60 | 95 | | |
61 | 96 | | |
62 | 97 | | |
| |||
78 | 113 | | |
79 | 114 | | |
80 | 115 | | |
| 116 | + | |
81 | 117 | | |
82 | 118 | | |
83 | 119 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
59 | | - | |
| 60 | + | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
122 | 124 | | |
123 | 125 | | |
124 | 126 | | |
| 127 | + | |
125 | 128 | | |
126 | 129 | | |
127 | 130 | | |
| |||
150 | 153 | | |
151 | 154 | | |
152 | 155 | | |
153 | | - | |
| 156 | + | |
154 | 157 | | |
155 | 158 | | |
156 | 159 | | |
| |||
0 commit comments