Skip to content

feat(kernel): honor _port and _connection_uri on use_kernel connections - #1071

Merged
cathleeny merged 30 commits into
mainfrom
cathleeny/feat/kernel-honor-port-uri-parity
Dec 1, 2026
Merged

cathleeny merged 30 commits into
mainfrom
cathleeny/feat/kernel-honor-port-uri-parity

Conversation

@cathleeny

@cathleeny cathleeny commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

On the kernel backend (use_kernel=True), _port and _connection_uri are now honored. Before this PR the kernel path ignored both. Thrift is unchanged.

The kernel applies the port (databricks/databricks-sql-kernel#505). The driver passes server_hostname and _port to the kernel as is, and keeps no port logic of its own.

Behavior

  • Port (kernel rules):
    • 0, unset or 443 changes nothing;
    • any other port is applied as host:port;
    • a non-default port already in the host wins, with a warning;
    • an IPv6 host needs brackets.
    • An invalid port raises OperationalError, which wraps the kernel's ValueError, as for the binding's other argument errors. A host that can't take the port (credentials, path, query or fragment) raises ProgrammingError, and the error never repeats the host.
  • Connection URI: _connection_uri (http(s)://host[:port]/path?query) sets the host (with any port in it) and the path, and wins over _port. A URI-only connection works. Credentials in the URI are rejected; the kernel validates the rest. On the kernel, OAuth also uses the URI's host:port.

Before merge

  • Raise the databricks-sql-kernel dependency floor and lockfile to a release that includes the kernel change. Until then the published-wheel CI tier skips the two loopback port tests.

Testing

  • Unit: test_session.py and test_kernel_client.py pass; black is clean.
  • Real kernel: the loopback tests pass against a wheel built from the kernel PR, and skip on the published wheel.
  • Live (dogfood), against main: a custom port is dialed and a port in the host wins. Bad hosts are rejected before any request. A 300k-row result is fetched over the custom port, and URI-only connections work. The default, explicit-443, Reyden and Thrift paths match main.

Note

This overlaps databricks-sql-python#915, another engineer's PR that changes the same function. Only one of the two should merge.

Related PRs: databricks/databricks-sql-kernel#505, databricks/databricks-sql-nodejs#636, databricks/databricks-sql-go#581, https://github.com/databricks/databricks-driver-test/pull/2188

This pull request and its description were written by Isaac.

The kernel backend (use_kernel=True) ignored the Thrift-style _port and
_connection_uri overrides. Resolve both connector-side onto the kernel's single
host and http_path, with the Thrift rules:

- _port (1..65535; 0 or None mean the default) folds into server_hostname as
  host:port. The default 443 adds nothing, IPv6 literals are bracketed, and an
  embedded port equal to _port is accepted. An empty server_hostname with _port
  raises ValueError.
- _connection_uri (http(s)://host[:port]/path?query) replaces host, port, path
  and query, and wins over _port. Scheme-less, non-http(s), path-less and
  credential-bearing URIs raise ValueError. URI-only use works.
- With OAuth (U2M, Azure service principal, JWT key file, or M2M client id and
  secret), a _connection_uri whose origin differs from https://server_hostname
  raises before a kernel session opens. PAT is not affected. A non-default _port
  with OAuth is not guarded: the token exchange goes to the same host:port, which
  is documented.
- The SPOG x-databricks-org-id header follows the resolved path.

Tests cover the resolver tables, the OAuth origin guard, the SPOG re-derivation,
and a real-wheel loopback dial proving the kernel reaches the requested port
over TLS for _port and for _connection_uri.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
The helper returned Optional[str] for the resolved path, but KernelDatabricksClient takes a str, so mypy fails in check-types on every supported Python. Session.__init__ already types http_path as str, so this is an annotation-only change with no runtime effect.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 2 Low

Looks good: two low concerns. Resolver, OAuth origin guard and SPOG re-derivation match Thrift's precedence and have thorough table tests. Nit: a few new lines (the Conflicting-ports f-string, the _split_host and _uri_host_and_path docstrings) exceed the 100-char limit in CONTRIBUTING.md.

Comment thread src/databricks/sql/session.py Resolved
Comment thread src/databricks/sql/session.py Resolved

@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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 2 Low

Looks good, with 1 low concern. The resolver, the OAuth origin guard and the SPOG re-derivation match the auth bridge's routing and are well covered by tests. Nit: a few new lines go past the 100-char limit (the Conflicting ports f-string and the _split_host/_uri_host_and_path docstrings), and the AC-P4 ticket reference in the docstring.

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

Comment thread src/databricks/sql/session.py Resolved
Comment thread src/databricks/sql/session.py Resolved
A kernel connection without _port or _connection_uri again passes server_hostname through unchanged, so odd hosts no longer raise on the default path. The OAuth origin guard now skips connections the kernel auth bridge routes to PAT: an access_token with no JWT or client-secret M2M credentials, even when auth_type is databricks-oauth. azure-sp-m2m and M2M/JWT stay guarded.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low

Looks good, with 1 low concern. The resolver, the OAuth predicate (which matches the auth bridge's routing) and the SPOG re-derivation all check out. Nits: session.py:135 and the _split_host/_uri_host_and_path docstrings go past the 100-char limit, and test_session.py imports databricks.sql twice.

Comment thread src/databricks/sql/session.py Resolved
Wraps the origin-guard condition to the repo's black line length (check-linting). The guard no longer treats a custom credentials_provider as OAuth: the kernel auth bridge rejects that provider with NotSupportedError, so no OAuth origin is involved.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
An explicit _port=443 adds nothing to the kernel host, but it still ran
the checks for a folded port, so a host that main sent through as-is
was now rejected: a path or query (`h.io/x`, `h.io?x=1`), a bare IPv6
literal (`::1`), userinfo (`user:pw@h`), or an empty host. 443 now
returns the host unchanged before those checks, as on main and as the
Node driver does. A non-default _port is unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Low

Looks good, with 1 low concern. Port/URI resolution, the OAuth origin guard and the SPOG re-derivation match the auth bridge's routing order and have thorough tests. Nit: the CHANGELOG says "as on main", which is internal wording that shouldn't appear in release notes.

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

Other findings

  • 🟠 High — Disputed by the cross-check judge (it quotes return not is_same_host(issuer, normalize_host_with_protocol(server_hostname))); a human should decide. Original finding: A JWT issued by h.io bypasses the OAuth origin guard when _connection_uri targets another host, because this comparison uses the original hostname even though the kernel receives the overridden host and token together for federation. Classify exchange eligibility against the resolved kernel host as well, and add a same-issuer-JWT/cross-origin regression test. (Found by GPT-6.1 Sol · disputed by the judge)

Comment thread src/databricks/sql/session.py Resolved
…n mismatch

With OAuth and _connection_uri, the origin guard parsed server_hostname with the _port parser, so a host such as '::1', 'h.io:' or 'user:pass@h.io' raised 'malformed IPv6 literal or port' even though no _port was set. The guard now treats a server_hostname it cannot parse as an origin that cannot match, and raises its own origin-mismatch error. The changelog entry no longer says 'as on main'.

Co-authored-by: Isaac <no-reply@databricks.com>
Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High

Looks good, no blocking issues. I traced the resolver, the OAuth origin guard and the SPOG header re-derivation against auth_bridge.kernel_auth_kwargs. The guard's routing predicates (M2M, JWT, azure-sp-m2m, PAT, U2M) match the bridge, and Thrift is unchanged.

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

Other findings

  • 🟠 High — Disputed by the cross-check judge (it quotes foreign_jwt = bool(access_token and _is_foreign_jwt(access_token, server_hostname))); a human should decide. Original finding: A JWT issued by server_hostname bypasses this guard when _connection_uri points elsewhere, although it becomes foreign to the resolved kernel host and eligible for token exchange there. Classify JWT exchange against both the original and resolved hosts, and add a same-original-issuer/different-URI regression test. (Found by GPT-6.1 Sol · disputed by the judge)

cathleeny and others added 2 commits November 25, 2026 20:52
The kernel now folds _port into the connection host (databricks-sql-kernel
#505), so the driver no longer rewrites server_hostname. The session passes
server_hostname through unchanged and the parsed _port as the binding's
port= kwarg.

The driver keeps what is driver-specific: _port parsing (falsy means the
default, invalid values raise ValueError), _connection_uri resolution into
host, port and path, the OAuth origin guard, and redaction of its own error
messages.

port= is sent only when a non-default port applies, so the default path
sends the same kwargs as before. A wheel without the kwarg raises
NotSupportedError instead of silently connecting to port 443.

Removed the driver-side folding rules (embedded-port-wins and its warning,
path/userinfo/IPv6 checks, _split_host). Kernel InvalidArgument errors now
surface as ProgrammingError rather than ValueError.

KERNEL_REV is pinned to 22ae6ec250837b38d0e3dc720310d4dcfb81fa98 so the
kernel-e2e workflow builds the kernel with port support. This PR needs a
kernel release that includes databricks-sql-kernel#505.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Resolved two conflicts. CHANGELOG.md: Unreleased keeps the port entry
plus main's new fetch speed-up entry; the other entries were released in
4.10.0. KERNEL_REV keeps 22ae6ec (the kernel port PR head), which
already contains main's 5c3a909.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Medium · 2 Low

Mostly solid. I have 1 medium and 1 low concern, both about the tests. The driver resolves the port, URI and OAuth origin carefully and the coverage is broad. The KERNEL_REV and dependency-floor bumps listed under "Before merge" are still pending.

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

Other findings

  • 🟡 Medium — A JWT issued by the original server is classified as PAT when _connection_uri selects another host, bypassing the origin guard even though the kernel's host-relative exchange decision uses that new destination. Include the resolved kernel host when determining whether the token requires exchange, and add a regression with issuer https://h.io/oidc and URI https://other.io/sql/x. (Found by GPT-6.1 Sol · the judge couldn't confirm it)

Comment thread tests/unit/test_session.py Resolved
Comment thread tests/unit/test_kernel_client.py Resolved
The OAuth origin guard judged a JWT's issuer only against
server_hostname. The kernel judges it against its connection host, so a
token issued by server_hostname with a _connection_uri on another host
was treated as a PAT here but exchanged by the kernel at that other host.
A token foreign to either host now counts as exchanged, so the mismatched
origin is rejected. Added the h.io issuer + other.io URI case.

Tests:
- The loopback realkernel tests skip when the installed wheel has no
  port kwarg, and re-raise NotSupportedError instead of swallowing it
  and timing out. They pass on a wheel built from the kernel PR and skip
  on the published 1.4.0 wheel.
- The old-wheel port test uses a fixed-signature fake Session, so the
  real signature introspection decides, as in the geospatial test.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 2 Low

Looks good, with 1 low concern. Before merge, KERNEL_REV still has to point at the merged kernel commit, and the databricks-sql-kernel floor and lockfile need a released wheel that has the port kwarg. The PR description already lists both.

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

Comment thread src/databricks/sql/session.py Resolved
urlsplit reads "https://h.io:/sql/x" as having no port, so the URI passed
validation and "https://h.io:" went to the kernel. An authority that ends
in ":" is now rejected as malformed, like port 0. Covered for a host
name and a bracketed IPv6 literal.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High

Looks good, no blocking issues. The OAuth origin guard's classification follows auth_bridge routing order. Before merge, as the description says: move KERNEL_REV to the merged kernel commit and raise the databricks-sql-kernel floor and lockfile to a released wheel. Nit: client.py docstring says https:// but http:// is also accepted.

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

Other findings

  • 🟠 High — Disputed by the cross-check judge (it quotes if not _kernel_session_accepts_kwarg("port"): raise NotSupportedError(); a human should decide. Original finding: The dependency floor still permits—and the lockfile selects—kernel 1.5.0, so a supported installation raises NotSupportedError for the newly advertised non-default _port feature; updating KERNEL_REV does not update the shipped wheel dependency. Before merging, raise the dependency floor and regenerate the lockfile against a released kernel containing the port binding. (Found by GPT-6.1 Sol · disputed by the judge)

Keep the user-facing change and its requirement; the detailed rules stay
in the connection parameter docs and the PR description.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Low · 1 Nit

Looks good — 1 low concern. The endpoint resolution, the OAuth origin guard (checked against the auth_bridge routing) and port-kwarg gating look correct and well tested. The remaining before-merge items are still open: KERNEL_REV must move to the merged commit and the kernel dependency floor must be raised. The PR description says the ProgrammingError change is in the CHANGELOG, but the entry doesn't mention it.

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

Other findings

  • ⚪ Nit — Kernel connections now raise ValueError for an invalid _port or a malformed _connection_uri. These values were ignored before, and the CHANGELOG only mentions the OAuth origin mismatch. Add the new validation errors to the CHANGELOG entry. (Found by Claude Opus 5.5 · confirmed by the judge)

The kernel now validates the port and applies it to the host, so the
driver drops its own port handling: `_port_or_none` (falsy/string
parsing and the 1..65535 check), the 443 drop, and the wheel-capability
gate. A set `_port` reaches the kernel's `port=` unchanged; an invalid
value raises the kernel's ValueError. `_connection_uri` parsing and the
OAuth origin guard are unchanged.

KERNEL_REV moves to the kernel PR head (403ef24), and the docs describe
the kernel's rules: IPv6 hosts need brackets, and errors never repeat
the host.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Medium

Needs changes: 1 high concern. Forwarding the port kwarg without gating breaks existing explicit-_port kernel connections on the currently published kernel wheel. The rest of the URI/OAuth-origin logic and its tests look careful.

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

…i handling

Remove the OAuth origin check for `_connection_uri` (and its JWT issuer,
server-origin and redaction helpers). `_connection_uri` now only splits
into host and path, rejecting a non-http(s) scheme, a missing host, or
credentials in the URI; the kernel validates the rest. The related tests
go too. KERNEL_REV moves to the kernel PR head (7e76a60).

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Medium

Needs changes: 1 high concern. On older kernel wheels, port is forwarded without a gate, so any explicit _port breaks connect() where it used to be ignored. The _connection_uri resolution and SPOG re-derivation look correct and are tested.

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

The kernel's ValueError for a bad port value reaches the caller through
the binding's usual wrapper, which maps non-kernel exceptions to
OperationalError. Say so instead of ValueError.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High

Changes needed: 1 high concern. port reaches Session without the capability check the other optional kwargs get, so _port breaks connections on kernel wheels released before databricks-sql-kernel#505. The resolution logic and the SPOG re-derivation look correct.

A kernel wheel whose Session does not declare `port` rejected the kwarg with a
TypeError. Gate it like the other optional kwargs so the error names the fix.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High · 1 Low

Looks good, with 1 medium concern. The URI resolution, the SPOG re-derivation and the port forwarding are sound and well tested. The KERNEL_REV and dependency-floor bumps listed in the PR's Before merge section are still outstanding.

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

Comment thread tests/unit/test_session.py Resolved
databricks-sql-kernel#505 merged as 3b691d2; pin that commit instead of the
PR head.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Medium · 1 Low

Mostly sound, with 1 medium and 1 low concern. The port is passed through cleanly and the SPOG header is re-derived when _connection_uri changes the path. The new strict gate on port turns a former no-op _port=443 into an error on older kernel wheels.

Comment thread tests/unit/test_session.py Resolved
… kernel

Match the existing real-wheel guard: if sys.modules holds a fake
databricks_sql_kernel, fail with a clear message instead of a listener timeout.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 High

Mostly sound: 1 medium and 1 low concern. Passing _port=443 on an older kernel wheel used to do nothing and now fails, and a _connection_uri fragment is silently dropped. The dependency floor and lockfile bump the PR lists under "Before merge" is still outstanding.

This overview is Claude Opus 5.5's initial take; some of its points were set aside by the cross-check judge — see the findings below.

🔀 1 finding considered and dismissed by the judge
  • 🔵 Low src/databricks/sql/session.py:68 — _kernel_endpoint rebuilds the endpoint from scheme, netloc, path and query only. A _connection_uri fragment (https://h/p#x) is dropped without any error,
    Judge's evidence: path = parts.path + (f"?{parts.query}" if parts.query else "")

… wheel

The port loopback tests in test_session.py skip on published wheels without
`port`. Run them in kernel-e2e, against the wheel built from KERNEL_REV.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Medium · 1 Nit

Looks good, with 1 low concern. Port and URI resolution follow Thrift's precedence, and the SPOG header is re-derived correctly. Follow-up: until the kernel dependency floor is raised, an explicit _port=443 or _port=0 on an older wheel now raises NotSupportedError instead of being ignored.

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

Other findings

  • ⚪ Nit — The re-derivation of the SPOG header claims a caller-supplied x-databricks-org-id still wins, but test_spog_org_id_follows_resolved_path has no such case. Add a case with http_headers=[("X-Databricks-Org-Id", "999")] and a URI carrying ?o=222, and assert only 999 is forwarded. (Found by Claude Opus 5.5 · confirmed by the judge)

Comment thread src/databricks/sql/session.py Resolved
The kernel binding takes only an int, so _port="443" (from an env var or a
DSN) raised OperationalError, while Thrift accepts it. Coerce a digit string
to the int it names before passing the port on; any other value still goes to
the kernel as is, which validates it.

Signed-off-by: Cathleen Yan <58714163+cathleeny@users.noreply.github.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 Sol), checked by a judge model (Claude Sonnet 5.5).

Verdict: 1 Medium · 1 Low

Looks good, with 1 medium concern. Endpoint resolution, SPOG re-derivation and Thrift parity look correct and are well tested. One gap remains: on an older kernel wheel, an explicit default port now fails the connection where it used to be ignored.

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

This branch was previously deployed

1 inactive deployment
azure-prod — c4f02b4c Deployed Dec 1, 2026 by cathleeny via followup #2748
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.

2 participants