Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dependencies = [
"onnxruntime==1.22.1",
"openai>=2.0.0,<3",
"opensearch-dsl>=2.0.0,<3",
"opensearch-py>=2.0.0,<3",
"opensearch-py>=3.1,<4",
Copy link

Choose a reason for hiding this comment

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

Bug: Calls to the opensearch-py client use positional arguments, such as conn.indices.get_alias(temp_alias), which are no longer supported after the library upgrade and will cause a TypeError.
Severity: HIGH

Suggested Fix

Update all calls to the opensearch-py client to use keyword arguments instead of positional arguments. For example, change conn.indices.get_alias(temp_alias) to conn.indices.get_alias(name=temp_alias) and conn.indices.create(index_name, ...) to conn.indices.create(index=index_name, ...).

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: pyproject.toml#L73

Potential issue: The upgrade to `opensearch-py` v3.1.0 introduces a breaking change that
requires keyword-only arguments for API calls. The codebase contains several calls that
use positional arguments, which will now raise a `TypeError` at runtime. For example,
`conn.indices.get_alias(temp_alias)` in `create_backing_index` will fail during
reindexing operations, breaking the entire workflow. Other affected calls include
`conn.indices.refresh(index)`, `conn.indices.exists(alias)`, and
`conn.indices.create(index_name, ...)`. These will cause runtime errors when their
respective code paths are executed.

Copy link

Choose a reason for hiding this comment

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

Bug: The opensearch-dsl version is incompatible with the upgraded opensearch-py v3, which will likely cause runtime failures. The tests do not cover this incompatibility.
Severity: CRITICAL

Suggested Fix

Since opensearch-dsl is deprecated, the recommended fix is to migrate all code using opensearch-dsl APIs (like Search, MoreLikeThis, Percolate) to use the native opensearch-py v3 client directly. After the migration, the opensearch-dsl dependency should be removed from pyproject.toml.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: pyproject.toml#L73

Potential issue: The pull request upgrades `opensearch-py` to version 3, but leaves the
`opensearch-dsl` library at version 2. The documentation for `opensearch-dsl` v2
specifies a dependency on `opensearch-py` version 2 (`<3`), making it incompatible with
the newly upgraded version. The application uses `opensearch-dsl` for search
functionality, and this version mismatch will likely cause runtime errors such as
`TypeError` or `AttributeError` when `opensearch-dsl` makes calls to the underlying
`opensearch-py` client. The existing test suite will not detect this issue because it
mocks the client connections, bypassing the actual library interaction that would fail
in a live environment.

"opentelemetry-api>=1.31.0",
"opentelemetry-exporter-otlp>=1.31.0",
"opentelemetry-instrumentation-celery>=0.52b0",
Expand Down
21 changes: 17 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading