Skip to content

Fix ignored insecure option and add unit and integration tests - #14

Open
dantasse wants to merge 2 commits into
mainfrom
dantasse/tests
Open

dantasse wants to merge 2 commits into
mainfrom
dantasse/tests

Conversation

@dantasse

@dantasse dantasse commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

This PR lets us use TLS (accidentally(?) ignored before) and adds a bunch of tests.

Bug fix: insecure was ignored

ClientOptions.insecure was documented but never read. The Flight client always created plaintext credentials, so TLS connections could not work. Connections now use TLS by default and plaintext only when insecure: true is passed, which is what the docs always said.

Breaking change: anyone connecting to a plaintext server without insecure: true will now fail the TLS handshake. The README calls this out. No merged code in LanceDB depends on this package yet, so nothing released needs to absorb it.

Also fixed: getFlightInfo called resolve after reject on the error path.

Tests

Added ~50 unit tests and 8 integration tests. Integration tests (more valuable imo) include: bad credentials, invalid SQL, empty result sets, a full multi-batch read checked against COUNT(*), type mapping across ten SQL types, early exit from a stream, a concurrent burst, and importing the published package from an ES module.

@dantasse dantasse changed the title Update dependencies, fix ignored insecure option, add unit and integration tests Fix ignored insecure option and add unit and integration tests Oct 1, 2026
@dantasse dantasse added the breaking-change Requires a minor version bump on release label Oct 1, 2026
@dantasse
dantasse changed the base branch from main to dantasse/updates October 1, 2026 16:09
@dantasse
dantasse requested a review from westonpace October 1, 2026 16:46

@westonpace westonpace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes, we probably need this. My only concern is that this is implemented as a backwards incompatible change. There are a few users of this library and these users would suddenly break without warning.

Could we start with the default of insecure=true? We could log a warning if the user doesn't specifically set insecure saying the default will be changing soon and they should explicitly set a value to disable the warning and then change it in a future release?

Comment thread src/flight.ts Outdated
* No actual messages are sent yet.
*
* @param host The hostname / port of the server, separated by a colon
* @param insecure If true, connect without TLS. Defaults to false (TLS is used).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this a backwards incompatible change? Was the previous default that we didn't use TLS?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oh right! yeah I didn't know this had users. makes perfect sense.

In the past:

  • TLS was always off. insecure was an option but didn't actually do anything.
  • Docs implied that TLS was on by default. (didn't really say so explicitly, but just the docstring on insecure said Is the server using TLS? If not, this must be set to true.)

So a current user might assume either that TLS is on by default or off by default 😅
But I agree with your instinct that it's better to match old behavior than old docs. So I've switched the default to be insecure=true.

Base automatically changed from dantasse/updates to main October 5, 2026 18:33
@dantasse dantasse removed the breaking-change Requires a minor version bump on release label Oct 5, 2026
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