Skip to content

fix: resolve flaky tenant input validation in Python 3.12#2096

Open
Missing-Identity wants to merge 1 commit into
weaviate:mainfrom
Missing-Identity:fix/tenant-validation-312
Open

fix: resolve flaky tenant input validation in Python 3.12#2096
Missing-Identity wants to merge 1 commit into
weaviate:mainfrom
Missing-Identity:fix/tenant-validation-312

Conversation

@Missing-Identity

Copy link
Copy Markdown

Description

This PR resolves flaky runtime type-checking for tenant inputs specifically observed in Python 3.12+.

Problem

In Python 3.12, using typing.Sequence for isinstance() checks can exhibit flaky or unexpected behavior because typing.Sequence is intended primarily for static analysis. This has led to intermittent validation failures when processing tenant lists in certain environments.

Solution

Replaces typing.Sequence with collections.abc.Sequence for runtime validation in weaviate/validator.py. This ensures stable and consistent type-checking across all supported Python versions, including Python 3.12.

Verification

  • Verified consistent behavior in Python 3.12 local test suite.
  • Confirmed that valid tenant sequences (lists, tuples) are correctly identified and invalid inputs are rejected.

Fixes #1355

Signed-off-by: Unmilan Mukherjee unmilanm@gmail.com

)

Replaces typing.Sequence with collections.abc.Sequence for runtime
type-checking to avoid flaky behavior in Python 3.12+.

Signed-off-by: Unmilan Mukherjee <unmilanm@gmail.com>

@orca-security-eu orca-security-eu 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.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@weaviate-git-bot

Copy link
Copy Markdown

To avoid any confusion in the future about your contribution to Weaviate, we work with a Contributor License Agreement. If you agree, you can simply add a comment to this PR that you agree with the CLA so that we can merge.

beep boop - the Weaviate bot 👋🤖

PS:
Are you already a member of the Weaviate Forum?

@Missing-Identity

Copy link
Copy Markdown
Author

I have read the CLA Document and I sign the CLA

@Missing-Identity

Copy link
Copy Markdown
Author

I agree to the CLA

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.

Fix flaky tenant input validations in different Python versions

2 participants