Skip to content

Add some types to OLConnection#12113

Merged
RayBB merged 1 commit intointernetarchive:masterfrom
cdrini:refactor/connection-types
Mar 23, 2026
Merged

Add some types to OLConnection#12113
RayBB merged 1 commit intointernetarchive:masterfrom
cdrini:refactor/connection-types

Conversation

@cdrini
Copy link
Copy Markdown
Collaborator

@cdrini cdrini commented Mar 17, 2026

Small refactor. While investigating the db pathway added some types to clear up ambiguities.

Technical

Testing

Screenshot

Stakeholders

Copilot AI review requested due to automatic review settings March 17, 2026 18:08
@github-project-automation github-project-automation bot moved this to Waiting Review/Merge from Staff in Ray's Project Mar 17, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds Python type annotations around the Open Library infobase connection factory and related connection wrappers to reduce ambiguity when tracing the DB connection pathway.

Changes:

  • Added type hints to ConnectionMiddleware.__init__ and HybridConnection.__init__.
  • Refactored OLConnection to inline the connection-selection logic and added return typing plus cast(...) for local/remote connections.

Copy link
Copy Markdown
Collaborator

@RayBB RayBB left a comment

Choose a reason for hiding this comment

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

This has been working well on testing and it looks pretty safe to me. The type hints are a great improvement, so let's go with it.

@RayBB RayBB merged commit 2d3f7f5 into internetarchive:master Mar 23, 2026
8 checks passed
@github-project-automation github-project-automation bot moved this from Waiting Review/Merge from Staff to Done in Ray's Project Mar 23, 2026
@cdrini cdrini deleted the refactor/connection-types branch March 23, 2026 17:45
@RayBB RayBB removed the On Testing label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants