fix(opensearch): Update should clear projects and personas when they are empty#8845
Open
fix(opensearch): Update should clear projects and personas when they are empty#8845
Conversation
Contributor
Greptile SummaryFixes a bug where empty lists for
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: ac49a02 |
Contributor
There was a problem hiding this comment.
1 issue found across 4 files
Confidence score: 4/5
- There’s a moderate risk of test failures: module-scoped fixtures in
backend/tests/external_dependency_unit/document_index/test_document_index_old.pydepend on function-scopedtenant_context, which can trigger pytestScopeMismatcherrors. - This is limited to the test suite and doesn’t imply a runtime regression, so the overall merge risk remains low.
- Pay close attention to
backend/tests/external_dependency_unit/document_index/test_document_index_old.py- fix fixture scoping to avoidScopeMismatcherrors.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="backend/tests/external_dependency_unit/document_index/test_document_index_old.py">
<violation number="1" location="backend/tests/external_dependency_unit/document_index/test_document_index_old.py:60">
P2: Module-scoped fixtures cannot depend on a function-scoped fixture. `tenant_context` should be module-scoped (or removed from those fixtures) to avoid pytest `ScopeMismatch` errors.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| yield f"test_index_{uuid.uuid4().hex[:8]}" # Test runs here. | ||
|
|
||
|
|
||
| @pytest.fixture(scope="function") |
Contributor
There was a problem hiding this comment.
P2: Module-scoped fixtures cannot depend on a function-scoped fixture. tenant_context should be module-scoped (or removed from those fixtures) to avoid pytest ScopeMismatch errors.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At backend/tests/external_dependency_unit/document_index/test_document_index_old.py, line 60:
<comment>Module-scoped fixtures cannot depend on a function-scoped fixture. `tenant_context` should be module-scoped (or removed from those fixtures) to avoid pytest `ScopeMismatch` errors.</comment>
<file context>
@@ -0,0 +1,290 @@
+ yield f"test_index_{uuid.uuid4().hex[:8]}" # Test runs here.
+
+
[email protected](scope="function")
+def tenant_context() -> Generator[None, None, None]:
+ """Sets up tenant context for testing."""
</file context>
evan-onyx
approved these changes
Feb 27, 2026
Contributor
🖼️ Visual Regression Report
|
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.
Description
Currently empty projects and personas are treated as None, meaning no update required, when really an empty list should mean clear these respective fields from the chunk.
This is a followup to #8680 (comment).
How Has This Been Tested?
I went through the effort of adding external dependency unit tests for this function of the old document index interface. Hopefully these fixtures can be used to easily add additional tests when needed. This took me more time and effort than I wanted, please clap.
Additional Options
Summary by cubic
Fixes document updates so empty user_projects/personas clear those fields in OpenSearch and Vespa. Filters for project/persona no longer match cleared chunks.
Written for commit 892e1c7. Summary will update on new commits.