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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//! `franken-snowflake-sqlapi` — the Snowflake SQL API protocol heart.
//!
//! This crate owns the *protocol data*: the request/response schemas, the
//! `jsonv2` wire codec, and the HTTP-status response classification. It is pure
//! and `serde`-driven — **no `asupersync`, no live network**. The cancel-correct
//! statement lifecycle (`bracket` over submit/poll/partition/cancel) and the
//! HTTPS transport land in the sibling beads `fsnow-statement-lifecycle-ofl` and
//! `fsnow-asupersync-native-https-ofq`; this crate gives them the typed payloads
//! and the status state machine to act on.
//!
//! Modules:
//!
//! - [`request`] — `POST /api/v2/statements` body: [`request::SubmitStatementRequest`],
//! positional typed [`request::Binding`]s, and session [`request::SubmitQueryParams`].
//! - [`response`] — the response bodies, one per HTTP status: a 200
//! [`response::ResultSet`], a 202 [`response::QueryStatus`], a 408/422
//! [`response::QueryFailureStatus`], and the [`response::StatementCancelResponse`],
//! plus [`response::ResultSetMetaData`] / [`response::ColumnType`] /
//! [`response::PartitionInfo`].
//! - [`status`] — [`status::ResponseClass`]: the 200/202/408/422/429 routing
//! state machine, kept distinct so no two states are ever conflated.
//! - [`wire`] — the [`wire::CellValue`] `jsonv2` codec: every `data` cell is a
//! JSON string decoded per its [`response::ColumnType`], never by JSON shape.
//!
//! ## Protocol references
//!
//! Behavioral source: Snowflake's official SQL API docs (clean-room — docs +
//! live observation + our own fixtures only). Consulted 2026-06-24:
//! `developer-guide/sql-api/{index,reference,submitting-requests,handling-responses}`.
//! See `docs/protocol/schema_draft.md` for the field-by-field rationale and
//! `docs/proof_lanes.md` (Lane 1) for the proof obligations these types satisfy.
// Proving the driver future `Send` (its test, and any crate that spawns it)
// walks the whole async chain past rustc's default depth of 128
// (`recursion_depth_exceeding_limit`).
/// Crate version string.
pub const VERSION: &str = env!;
/// The SQL API base paths, relative to the account host
/// (`<account>.snowflakecomputing.com`). The transport crate joins these with the
/// host and the query string (`requestId`, `retry`, `async`, `partition`,
/// `nullable`).