Repository navigation
Preserve IPv6 brackets in remote connection URLs - #16
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SQLAlchemy exposes an IPv6 URL's
hostwithout brackets. The libSQL dialect copies that value directly into the HTTP authority, producing URLs such ashttp://::1:8080/database. That is not a valid IPv6 authority and cannot be parsed into the intended host and port.Change
Restore brackets around IPv6 host literals when constructing the remote URL. IPv4 addresses and DNS hostnames retain their existing formatting. The same formatted host is used in all existing user-info branches.
Validation
create_engineAPI and dialect connection arguments, covering loopback/documentation IPv6 addresses, IPv4, DNS, and HTTP/HTTPS. They also verify the resulting hostname and port with the standard URL parser.pytest tests/test_connection_urls.py tests/test_basic.py -q: 28 passed after the fix, including actual in-memory/local-file libSQL operations.pytest tests/ -q: 40 passed, 8 failed, 4 errors. The failures are existing async-adapter behavior (Cursor._async_soft_closemissing and transaction teardown errors). Running the async tests with unchangedlibsql.pyreproduces the same eight failures and four errors (12 pass). No failures are suppressed.compileallandgit diff --checkpass.Python 3.12; SQLAlchemy 2.1.6; libsql-experimental 0.0.55. No hosted database, auth token, IPv6 server connection, or embedded replication was used. Without remote configuration, the existing remote/embedded fixture variants fall back to in-memory databases; those are not claimed as remote integration coverage.
This is independent of the dependency migration in #15 and does not change the DBAPI dependency.
AI assistance: OpenAI Codex assisted with reproduction, patch, tests, and this description.