Repository navigation
feat(session): add session version exchange - #331
Conversation
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a clean, well-tested addition of session version exchange. The atomic version state is correctly scoped (one transport per session), fetch_max/has_session_version ordering is sound (no i64::MIN sentinel leaks), and both execute and metadata paths send-then-observe consistently while correctly excluding detached-statement polls. Wiremock coverage is solid. One Low note: FAST execution mode is now applied unconditionally to every session with no opt-out — intentional per the PR, but flagged for a reviewer's eye on warehouse compatibility.
8c58436 to
0f3c708
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — clean, well-tested change. The per-session transport lifetime makes the session_version atomic correctly session-scoped, and the observe/exclude split between session-owned polling (wait_for_completion) and detached statement-ID operations matches the PR intent, with wiremock coverage for create/execute exchange, missing-version tolerance, and the detached-poll exclusion. One low note on the 0 sentinel colliding with a potential legitimate version_id: 0.
| } | ||
|
|
||
| fn current_session_version(&self) -> Option<SessionVersion> { | ||
| let version_id = self.session_version.load(Ordering::SeqCst); |
There was a problem hiding this comment.
🔵 Low — The sentinel NO_SESSION_VERSION = 0 collides with a legitimate version_id of 0. current_session_version() treats any stored value equal to 0 as "no version observed" and returns None, so if the server ever reports session_version: { version_id: 0 }, observe_session_version will store it via fetch_max (max(0,0)=0) but the version will never be echoed back on subsequent execute requests — it is indistinguishable from the unset state. This is harmless if server-assigned versions are always positive (which appears to be the intent), but the assumption is undocumented and unenforced. Consider using Option<i64> behind an atomic guard, an i64::MIN sentinel, or a comment/assert documenting that version_id == 0 is reserved.
Minor, and likely never hit in practice — flagging only so the sentinel invariant is a conscious decision rather than an implicit one.
0f3c708 to
b56084d
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — clean, well-tested session-version exchange. Version threading (create/execute/status), Current-vs-Detached attribution via the owning flag, fetch_max monotonicity, and omit-when-absent wire behavior are all correct and covered by wiremock + unit tests. One low note: execution_mode=FAST is now hardcoded on every session with no opt-out — fine if SEA ignores it on older servers, worth a confirmation.
b56084d to
aeb28bb
Compare
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
aeb28bb to
00c3498
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — a focused, well-tested change. Session-version exchange is wired correctly: owned execute/submit/direct/metadata paths (all through call_execute_api) send and observe the version, while status polls observe only under SessionAttribution::Current, and ExecutedAsyncStatement maps owning→Current/attached→Detached conservatively. fetch_max over the sentinel-0 baseline is monotonic and matches the documented protocol (FAST versions start at 1). One low note on missing live e2e coverage for the new FAST-mode behavior.
| catalog: catalog.map(|s| s.to_string()), | ||
| schema: schema.map(|s| s.to_string()), | ||
| session_confs: session_config, | ||
| execution_mode: SessionExecutionMode::Fast, |
There was a problem hiding this comment.
🔵 Low — Requesting execution_mode=FAST on every session and negotiating session_version is a live-server behavior change, but coverage is entirely wiremock/unit. Per repo guidance, a live behavior change warrants an #[ignore] tests/v0_*_e2e.rs case so the FAST/version handshake is validated against a real warehouse (the wire-shape mocks can't catch a server that rejects execution_mode or versions statements differently). Consider adding one. The wiremock coverage here is otherwise thorough — this is a gap only in live validation.
00c3498 to
f1c85ad
Compare
There was a problem hiding this comment.
Verdict: 1 Low
Looks good — the session-version-exchange logic is correct. The session_version atomic is per-Session (one SeaRestTransport per Session::open), fetch_max keeps it monotonic under concurrent statements, wire compat is preserved via skip_serializing_if on the request field, and every Transport::statement_status/fetch_completed_result caller passes the right SessionAttribution (owning→Current, adopted/attached ids→Detached) so detached polls can't advance this session. Tests cover the create/execute exchange, absent-version, and detached-exclusion cases. One non-blocking note: an unrelated rustls RUSTSEC suppression is bundled in (see inline).
| reason = "h2 (RUSTSEC-2026-0258) DoS is a server-side empty-DATA-frame flood; the kernel is an HTTP client only and runs no h2 server. Transitive via reqwest/hyper, pre-existing on main, latest 0.4.x so no bump available. Re-review on expiry." | ||
|
|
||
| [[IgnoredVulns]] | ||
| id = "RUSTSEC-2026-0285" |
There was a problem hiding this comment.
🔵 Low — This PR bundles an unrelated supply-chain change: a new [[IgnoredVulns]] exception for RUSTSEC-2026-0285 (rustls) that the PR title/description ("add session version exchange") does not mention. The suppression itself is well-reasoned and time-boxed (ignoreUntil = 2026-09-22, ~5 days out from the current date), but folding an advisory exception into an unrelated feature PR makes it easy to miss in review and hard to bisect later. Consider splitting it into its own PR, or at minimum calling it out in the PR description so the security-advisory decision has an explicit audit trail.
f1c85ad to
af78ef5
Compare
Summary
execution_mode=FASTby default when creating SQL Exec API sessionssession_versionobserved from session creation, initial execution responses, and status/result responses attributable to the originating session/api/2.0/sqlpathTesting
cargo +stable fmt --all -- --checkcargo clippy --all-targets -- -D warningscargo test(942 unit tests plus all enabled integration-test binaries; live tests ignored)