Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: upsert() always uses default tenant/database #3387

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

codetheweb
Copy link
Contributor

@codetheweb codetheweb commented Jan 2, 2025

Description of changes

Bug found by a user. Before this fix, the resource object passed to auth providers would always have the default tenant and default database for calls made via the chromadb Python HTTP client.

Added test was failing before I updated Collection.py.

Test plan

How are these changes tested?

  • Tests pass locally with pytest for python, yarn test for js, cargo test for rust

Documentation Changes

Are all docstrings for user-facing APIs updated if required? Do we need to make documentation changes in the docs repository?

n/a

Copy link

github-actions bot commented Jan 2, 2025

Reviewer Checklist

Please leverage this checklist to ensure your code review is thorough before approving

Testing, Bugs, Errors, Logs, Documentation

  • Can you think of any use case in which the code does not behave as intended? Have they been tested?
  • Can you think of any inputs or external events that could break the code? Is user input validated and safe? Have they been tested?
  • If appropriate, are there adequate property based tests?
  • If appropriate, are there adequate unit tests?
  • Should any logging, debugging, tracing information be added or removed?
  • Are error messages user-friendly?
  • Have all documentation changes needed been made?
  • Have all non-obvious changes been commented?

System Compatibility

  • Are there any potential impacts on other parts of the system or backward compatibility?
  • Does this change intersect with any items on our roadmap, and if so, is there a plan for fitting them together?

Quality

  • Is this code of a unexpectedly high quality (Readability, Modularity, Intuitiveness)

@codetheweb codetheweb force-pushed the fix-upsert-default-tenant branch from 3d05519 to dc878ab Compare January 2, 2025 21:51
@codetheweb codetheweb force-pushed the fix-upsert-default-tenant branch from dc878ab to cd614d3 Compare January 2, 2025 21:52
@@ -91,7 +91,6 @@ def __init__(self, client: ClientAPI):

@initialize(collection=collection_st) # type: ignore
def initialize(self, collection: strategies.Collection):
reset(self.client)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should be fine since the created collection is torn down after each state machine run
otherwise, the reset removes the non-default tenant and database that we created

@codetheweb codetheweb marked this pull request as ready for review January 2, 2025 21:56
@codetheweb codetheweb requested a review from atroyn January 2, 2025 21:56
@atroyn atroyn self-assigned this Jan 2, 2025
Copy link
Contributor

@atroyn atroyn left a comment

Choose a reason for hiding this comment

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

Thanks @codetheweb for fixing my bug, and adding tests. I think this approach is fine, except one possible concern around how heavyweight running the entire property test state machine is just to test non-default tenant / database ids.

Approved, with further changes at your discretion. Should we choose not to write them now, let's open an issue where we can discuss the need for some intermediate 'run each endpoint once' test suite.

@codetheweb codetheweb merged commit 92152f1 into main Jan 2, 2025
78 checks passed
@codetheweb codetheweb deleted the fix-upsert-default-tenant branch January 2, 2025 23:05
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