fix: restore vectors when segments are re-enabled via API - #39999
Open
jasonfish568 wants to merge 4 commits into
Open
fix: restore vectors when segments are re-enabled via API#39999jasonfish568 wants to merge 4 commits into
jasonfish568 wants to merge 4 commits into
Conversation
Route enable-only segment updates through the existing async status flow so disabled vectors are rebuilt instead of synchronously updated. Refs langgenius#39988
jasonfish568
requested review from
JohnJyong,
QuantumGhost and
laipz8200
as code owners
August 4, 2026 16:13
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-08-05 13:06:44.221520285 +0000
+++ /tmp/pyrefly_pr.txt 2026-08-05 13:06:30.413423296 +0000
@@ -7663,13 +7663,13 @@
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.SegmentService.delete_child_chunk` [bad-argument-type]
--> tests/unit_tests/services/test_dataset_service_segment.py:280:64
ERROR Argument `SimpleNamespace` is not assignable to parameter `segment` with type `DocumentSegment` in function `services.dataset_service.SegmentService.update_child_chunk` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_segment.py:953:49
+ --> tests/unit_tests/services/test_dataset_service_segment.py:1010:49
ERROR Argument `SimpleNamespace` is not assignable to parameter `document` with type `Document` in function `services.dataset_service.SegmentService.update_child_chunk` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_segment.py:953:68
+ --> tests/unit_tests/services/test_dataset_service_segment.py:1010:68
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.SegmentService.update_child_chunk` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_segment.py:953:87
+ --> tests/unit_tests/services/test_dataset_service_segment.py:1010:87
ERROR Argument `SimpleNamespace` is not assignable to parameter `dataset` with type `Dataset` in function `services.dataset_service.SegmentService.delete_child_chunk` [bad-argument-type]
- --> tests/unit_tests/services/test_dataset_service_segment.py:967:60
+ --> tests/unit_tests/services/test_dataset_service_segment.py:1024:60
ERROR Argument `str` is not assignable to parameter `type` with type `Literal['basic', 'bearer', 'custom'] | None` in function `services.entities.external_knowledge_entities.external_knowledge_entities.AuthorizationConfig.__init__` [bad-argument-type]
--> tests/unit_tests/services/test_external_dataset_service.py:119:60
ERROR Argument `str` is not assignable to parameter `type` with type `Literal['api-key', 'no-auth']` in function `services.entities.external_knowledge_entities.external_knowledge_entities.Authorization.__init__` [bad-argument-type]
|
Contributor
Pyrefly Type Coverage
|
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.
Summary
Fixes #39988.
The Service API used the segment update path for
enabled: true. After a segment was disabled, its vector had already been deleted, so updating the missing Elasticsearch document did not restore it.This change reuses the existing enable flow used by the Web Console when the request only sets
enabled: true. Requests that also change content or keywords keep the current update behavior. This keeps Web and Service API behavior on the same code path and avoids duplicating indexing logic.Validation
make lintmake type-checkmake test TARGET_TESTS=api/tests/unit_tests/services/test_dataset_service_segment.py(44 passed)From Codex