Skip to content

Commit f320484

Browse files
committed
Merge remote-tracking branch 'origin/main' into refactor/plan-diffs-node-states
# Conflicts: # crates/sqlbuild-orchestration/src/warehouse_metadata/models.rs
2 parents f58b037 + 069c955 commit f320484

87 files changed

Lines changed: 1341 additions & 738 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.release-please-manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.248.0"
2+
".": "0.249.1"
33
}

‎CHANGELOG.md‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# Changelog
22

3+
## [0.249.1](https://github.com/sqlstack-io/sqlbuild/compare/v0.249.0...v0.249.1) (2026-11-18)
4+
5+
6+
### Bug Fixes
7+
8+
* **plan:** read deferred upstreams from the deferred target and trust synced records from their last scan ([#1584](https://github.com/sqlstack-io/sqlbuild/issues/1584)) ([77a12cc](https://github.com/sqlstack-io/sqlbuild/commit/77a12ccc61770bcb965ba83d92e351ffb2bb4ffc))
9+
10+
## [0.249.0](https://github.com/sqlstack-io/sqlbuild/compare/v0.248.0...v0.249.0) (2026-11-18)
11+
12+
13+
### Features
14+
15+
* **plan:** plan from synced state, depend on jobs or tags, and faster plans ([#1580](https://github.com/sqlstack-io/sqlbuild/issues/1580)) ([1fb37f7](https://github.com/sqlstack-io/sqlbuild/commit/1fb37f75ebf1967a11f2d55fef76dac0d6acee0a))
16+
317
## [0.248.0](https://github.com/sqlstack-io/sqlbuild/compare/v0.247.0...v0.248.0) (2026-11-18)
418

519

‎Cargo.lock‎

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MODEL (description "A report a deferring build selects alone, reading the aliased orders.", materialized table);
2+
3+
SELECT order_id FROM __ref("orders")
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MODEL (description "Orders stored under an alias, so the deferred target lists them as orders_v2.", materialized table, alias "orders_v2");
2+
3+
SELECT 1 AS order_id

‎clients/typescript/src/schema.d.ts‎

Lines changed: 21 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -530,22 +530,6 @@ export interface paths {
530530
patch?: never;
531531
trace?: never;
532532
};
533-
"/api/control/locations/{location_id}/targets/{target}/mirrored-totals": {
534-
parameters: {
535-
query?: never;
536-
header?: never;
537-
path?: never;
538-
cookie?: never;
539-
};
540-
get: operations["readPersonMirroredTotals"];
541-
put?: never;
542-
post?: never;
543-
delete?: never;
544-
options?: never;
545-
head?: never;
546-
patch?: never;
547-
trace?: never;
548-
};
549533
"/api/control/locations/{location_id}/targets/{target}/node-states": {
550534
parameters: {
551535
query?: never;
@@ -1234,23 +1218,6 @@ export interface paths {
12341218
patch?: never;
12351219
trace?: never;
12361220
};
1237-
"/api/locations/{location_id}/targets/{target}/metadata/retention": {
1238-
parameters: {
1239-
query?: never;
1240-
header?: never;
1241-
path?: never;
1242-
cookie?: never;
1243-
};
1244-
/** How much state history a full read delivers; older servers answer 404 and the location reads it all. */
1245-
get: operations["read_metadata_retention"];
1246-
put?: never;
1247-
post?: never;
1248-
delete?: never;
1249-
options?: never;
1250-
head?: never;
1251-
patch?: never;
1252-
trace?: never;
1253-
};
12541221
"/api/locations/{location_id}/targets/{target}/metadata/statistics-due": {
12551222
parameters: {
12561223
query?: never;
@@ -1765,7 +1732,7 @@ export interface components {
17651732
ChangedBuildReport: {
17661733
changed: string[];
17671734
downstream: string[];
1768-
/** @description Why the plan failed, sent with empty lists; only newer servers accept it. */
1735+
/** @description Why the plan failed, sent with empty lists. */
17691736
failing?: string | null;
17701737
/** Format: int64 */
17711738
generation: number;
@@ -2220,6 +2187,11 @@ export interface components {
22202187
/** @enum {string} */
22212188
kind: "warehouse_sync";
22222189
location: components["schemas"]["WarehouseStateLocation"];
2190+
/**
2191+
* Format: int64
2192+
* @description On the report of a table's last delivered page, the records the server then mirrored of that table across the target's state locations.
2193+
*/
2194+
mirrored_records?: number | null;
22232195
/**
22242196
* Format: date-time
22252197
* @description On the report that completes or stops a sync, when the next safety sync is due unless a run ends first; absent otherwise, where no timed sync follows, and from older locations.
@@ -2421,6 +2393,8 @@ export interface components {
24212393
/** Format: int64 */
24222394
generation: number;
24232395
kind: components["schemas"]["WarehouseHistoryKind"];
2396+
/** @description The table's read ends with this page, so the reply counts the records mirrored of it. */
2397+
last_page?: boolean;
24242398
records: Record<string, never>[];
24252399
scan?: null | components["schemas"]["MetadataScan"];
24262400
/** Format: uuid */
@@ -2452,12 +2426,6 @@ export interface components {
24522426
physical_generation_id: string;
24532427
target_name: string;
24542428
};
2455-
/** @description How many records the server holds for one mirrored state table of a target. */
2456-
MirroredTotal: {
2457-
/** Format: int64 */
2458-
records: number;
2459-
table: components["schemas"]["WarehouseHistoryKind"];
2460-
};
24612429
MutationResponse: {
24622430
applied: boolean;
24632431
};
@@ -2955,21 +2923,19 @@ export interface components {
29552923
synced_at?: string | null;
29562924
/** @description Set when the mirror is still at the read's known version: the records are left out. */
29572925
unchanged?: boolean;
2958-
/** @description The mirror version these records were read at; sent only to a versioned read. */
2959-
version?: string | null;
2926+
/** @description The mirror version these records were read at. */
2927+
version: string;
29602928
};
29612929
/** @description A location asks for the mirrored copy a plan preview plans from, as its fenced reader. */
29622930
PreviewCopyRead: {
2963-
/** @description Whether the copy carries consumption history; sent only when set, as older servers reject it. */
2931+
/** @description Whether the copy carries consumption history. */
29642932
consumption?: boolean;
29652933
/** Format: int64 */
29662934
generation: number;
29672935
/** @description The mirror version of the copy the location holds; an unchanged mirror returns no records. */
29682936
known_version?: string | null;
29692937
/** Format: uuid */
29702938
session_id: string;
2971-
/** @description Whether the location holds copies by mirror version; sent only when set, as older servers reject it. */
2972-
versioned?: boolean;
29732939
};
29742940
/** @description The newest successful build of a node, which a `cursor_max` observation must come from. */
29752941
PreviewLatestRun: {
@@ -4102,9 +4068,6 @@ export interface components {
41024068
};
41034069
/** @description What went wrong reading one page, without the warehouse's message, which may name hosts or users. */
41044070
WarehouseReadFailure: {
4105-
/** @enum {string} */
4106-
kind: "reader_start";
4107-
} | {
41084071
/** @enum {string} */
41094072
kind: "read_error";
41104073
} | {
@@ -4150,11 +4113,6 @@ export interface components {
41504113
warehouse_size: string;
41514114
warehouse_type?: string | null;
41524115
};
4153-
/** @description The newest versions per node or check a full read of state history needs to deliver. */
4154-
WarehouseRetention: {
4155-
/** Format: int32 */
4156-
state_history_versions: number;
4157-
};
41584116
/** @description Physical namespace of SQLBuild's source-freshness state table, never a source query. */
41594117
WarehouseStateLocation: {
41604118
database?: string | null;
@@ -4180,6 +4138,11 @@ export interface components {
41804138
now: string;
41814139
/** Format: date-time */
41824140
runs_ended_at?: string | null;
4141+
/**
4142+
* Format: int32
4143+
* @description The newest versions per node or check a full read of state history needs to deliver.
4144+
*/
4145+
state_history_versions: number;
41834146
};
41844147
/** @description A registered reader asks whether a run ended since its last synchronization began. */
41854148
WarehouseSyncDueRead: {
@@ -4222,6 +4185,11 @@ export interface components {
42224185
};
42234186
WarehouseSyncResponse: {
42244187
applied: boolean;
4188+
/**
4189+
* Format: int64
4190+
* @description Records the server mirrors of this table for the target, counted after a read's last page.
4191+
*/
4192+
mirrored_records?: number | null;
42254193
};
42264194
/** @description Derive progress from committed mirror rows, scoped to the active physical reader. */
42274195
WarehouseWatermarkRead: {
@@ -5586,44 +5554,6 @@ export interface operations {
55865554
};
55875555
};
55885556
};
5589-
readPersonMirroredTotals: {
5590-
parameters: {
5591-
query?: never;
5592-
header?: never;
5593-
path: {
5594-
location_id: string;
5595-
target: string;
5596-
};
5597-
cookie?: never;
5598-
};
5599-
requestBody?: never;
5600-
responses: {
5601-
/** @description Records the server mirrors of each state table of this target, in sync order */
5602-
200: {
5603-
headers: {
5604-
[name: string]: unknown;
5605-
};
5606-
content: {
5607-
"application/json": components["schemas"]["MirroredTotal"][];
5608-
};
5609-
};
5610-
/** @description Session rejected */
5611-
401: {
5612-
headers: {
5613-
[name: string]: unknown;
5614-
};
5615-
content?: never;
5616-
};
5617-
403: {
5618-
headers: {
5619-
[name: string]: unknown;
5620-
};
5621-
content: {
5622-
"application/json": components["schemas"]["ApiErrorBody"];
5623-
};
5624-
};
5625-
};
5626-
};
56275557
readPersonNodeStates: {
56285558
parameters: {
56295559
query?: never;
@@ -7599,42 +7529,6 @@ export interface operations {
75997529
};
76007530
};
76017531
};
7602-
read_metadata_retention: {
7603-
parameters: {
7604-
query?: never;
7605-
header?: never;
7606-
path: {
7607-
location_id: string;
7608-
target: string;
7609-
};
7610-
cookie?: never;
7611-
};
7612-
requestBody?: never;
7613-
responses: {
7614-
200: {
7615-
headers: {
7616-
[name: string]: unknown;
7617-
};
7618-
content: {
7619-
"application/json": components["schemas"]["WarehouseRetention"];
7620-
};
7621-
};
7622-
/** @description Invalid credential */
7623-
401: {
7624-
headers: {
7625-
[name: string]: unknown;
7626-
};
7627-
content?: never;
7628-
};
7629-
/** @description Location not authorized */
7630-
403: {
7631-
headers: {
7632-
[name: string]: unknown;
7633-
};
7634-
content?: never;
7635-
};
7636-
};
7637-
};
76387532
statistics_due: {
76397533
parameters: {
76407534
query?: never;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//! The lines naming upstreams of a missing-upstream message that one target lacks.
2+
3+
use crate::planner_identity::constants::MISSING_MESSAGE_ITEM_LIMIT;
4+
5+
/// How many upstreams of these kinds are missing from `target`, a few by name.
6+
pub(crate) fn missing_lines(missing: &[(&str, &str)], target: Option<&String>) -> Vec<String> {
7+
let one: bool = missing.len() == 1;
8+
let kinds: std::collections::BTreeSet<&str> = missing.iter().map(|(_, kind)| *kind).collect();
9+
let noun: String = match kinds.iter().collect::<Vec<_>>().as_slice() {
10+
[kind] if one => (*kind).to_string(),
11+
[kind] => format!("{kind}s"),
12+
_ => "models and seeds".to_owned(),
13+
};
14+
let place: String = target.map_or_else(
15+
|| "the warehouse".to_owned(),
16+
|target| format!("target '{target}'"),
17+
);
18+
let mut lines: Vec<String> = vec![format!(
19+
"{} upstream {noun} this build reads {} exist in {place}",
20+
missing.len(),
21+
if one { "doesn't" } else { "don't" }
22+
)];
23+
lines.extend(
24+
missing
25+
.iter()
26+
.take(MISSING_MESSAGE_ITEM_LIMIT)
27+
.map(|(name, _)| format!(" {name}")),
28+
);
29+
if missing.len() > MISSING_MESSAGE_ITEM_LIMIT {
30+
lines.push(format!(
31+
" ... {} more (sqb plan --json lists all)",
32+
missing.len() - MISSING_MESSAGE_ITEM_LIMIT
33+
));
34+
}
35+
lines
36+
}

‎crates/sqlbuild-analysis/src/planner_identity/_helpers/mod.rs‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ pub(crate) mod compose_graph_identity;
22
pub(crate) mod cycle_message;
33
pub(crate) mod dependency_counts;
44
pub(crate) mod identity_resolver;
5+
pub(crate) mod missing_lines;
56
pub(crate) mod staleness_walk;

0 commit comments

Comments
 (0)