Skip to content

fix(cloudfetch): keep connection headers off presigned downloads - #481

Closed
vuanhphung wants to merge 2 commits into
mainfrom
vuanhphung/cf-hdr
Closed

vuanhphung wants to merge 2 commits into
mainfrom
vuanhphung/cf-hdr

Conversation

@vuanhphung

@vuanhphung vuanhphung commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Connection custom headers were replayed by the shared HTTP retry loop onto presigned CloudFetch storage GETs. Skip that configured-header map only for CloudFetchDownload; retain server-provided link headers and existing header behavior on execute/execute_without_auth (SEA, telemetry, M2M/OIDC) and feature-flag GETs. A caller User-Agent remains client-wide, including downloads; direct U2M token/refresh and Azure tenant-discovery behavior is unchanged. Addresses the coverage-factory cf-hdr finding (no numbered kernel issue supplied).

Verified red/green with wiremock regressions covering all 12 request types and the real ChunkDownloader::download, which preserves one link header exactly once and the client-wide User-Agent. Root workspace tests: 1,322 passed; native/rustls client suites: 149/145 passed; napi tests: 91 passed. Format checks (root/ADBC/napi/pyo3), root/napi clippy, root build, napi release build and loader drift check pass. Live Node SEA CUSTOMHDR-001 consumes 100,000 ordered rows plus metadata and checks every warehouse request class: 3/3 fail at pin dac32e2bf, 3/3 pass with this fix. Coverage branch 4db7e66d5 intentionally expects the leak; a factory-only runtime overlay removes its expected-failure wrapper without editing the shared test checkout or weakening assertions.

Fresh-process loopback benchmarks against main 596379d88, alternating build order with three runs each (3,000 fully consumed 4-KiB requests/run): warehouse median 814.911 → 767.140 ms, CloudFetch median 758.257 → 689.713 ms. There is no measurable change for the warehouse path: the differences are within run-to-run noise, not a claimed speedup. The CloudFetch difference is also too noisy to claim a gain; these measure local HTTP-client overhead, not warehouse throughput.

Cross-driver state

Driver State Code evidence / behavior
JDBC (Thrift/SEA) Supported http.header.* (none by default); storage uses link headers + driver UA, ArrowResultChunk.java:81 @d5bdaa3
Python Thrift Supported http_headers=None; storage uses link headers + driver UA, cloudfetch/downloader.py:109 @b8259e4
Node Thrift Supported Optional customHeaders; storage uses link headers, CloudFetchResultHandler.ts:131 @bd8cb80
Go Thrift Supported (built-in path) Storage GET sets only link headers; optional injected HTTPClient is caller-owned, arrowbased/batchloader.go:456 @d9008a9
Kernel / kernel-backed SEA bindings Not supported → Supported HttpConfig.custom_headers defaults empty; storage now excludes that map while retaining link headers

Shared User-Agent defaults and configured x-databricks-org-id still reach storage; restricting those is explicitly outside this minimal fix. Downstream binding pin bumps follow after merge. This touches the same HTTP builder as perf PR #470; no refactor or API changes.

Adversarial review: converged in round 1 with no open high findings; all five requested documentation/test follow-ups are addressed.

This pull request and its description were written by Isaac.

Preserve link-provided storage headers and custom headers on warehouse, telemetry, OAuth token and discovery requests.

Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Vu Anh Phung <vu.phung@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

@oss-reviewer-bot oss-reviewer-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Terra), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Nit

Looks good, no findings. The CloudFetchDownload check is the only download path (chunk_downloader.rs:123). The feature-flag GET applies headers separately and is unchanged (feature_flags/mod.rs:340). Tests cover all request types and the real downloader.

This overview is Claude Opus 5.5's initial take; GPT-6.1 Terra added findings it doesn't mention — see the findings below.

Other findings

  • ⚪ Nit — This is a test-coverage gap, not a code defect. The new tests only cover first-attempt success. The retry loop rebuilds the request on every attempt, and the header filter runs inside that loop, so the behaviour is probably correct. Add a test with a retryable 5xx followed by 200 that checks both attempts omit connection headers and keep the link header. (Found by GPT-6.1 Terra · confirmed by the judge)

@vuanhphung

Copy link
Copy Markdown
Collaborator Author

Verified the retry nit with a local wiremock 503→200 probe: both attempts omit the connection sentinel and send the link header exactly once. execute_impl runs the guard and original-header replay on every iteration (src/client/http.rs:851, :872, :898), so this is optional regression coverage, not a current defect. Keeping the committed tests scoped to the reported leak.

CI note: Security Scan flags chrono@0.4.45 / RUSTSEC-2026-0543; all four lockfiles are byte-identical to main 596379d88 and contain that version. No dependency or suppression changes here.


This comment was generated with GitHub MCP.

@vuanhphung

Copy link
Copy Markdown
Collaborator Author

Closing per maintainer decision: custom headers on presigned CloudFetch downloads haven't caused failures, so the kernel keeps its current behavior. The driver-test CUSTOMHDR-002 case will no longer assert storage-request headers.

@vuanhphung vuanhphung closed this Nov 18, 2026

This branch was previously deployed

1 inactive deployment
azure-prod — 88e9740d Deployed Nov 18, 2026 by vuanhphung via review #1359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant