fix(api): scope segment batch deletes#38217
Open
WH-2099 wants to merge 1 commit into
Open
Conversation
Contributor
Pyrefly Type Coverage
|
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-06-30 10:08:30.533660785 +0000
+++ /tmp/pyrefly_pr.txt 2026-06-30 10:08:15.521673888 +0000
@@ -7088,13 +7088,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:250: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:913:49
+ --> tests/unit_tests/services/test_dataset_service_segment.py:922: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:913:68
+ --> tests/unit_tests/services/test_dataset_service_segment.py:922: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:913:87
+ --> tests/unit_tests/services/test_dataset_service_segment.py:922: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:927:60
+ --> tests/unit_tests/services/test_dataset_service_segment.py:936: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:118: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]
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #38217 +/- ##
==========================================
- Coverage 85.36% 85.36% -0.01%
==========================================
Files 4970 4970
Lines 258774 258774
Branches 49076 49076
==========================================
- Hits 220893 220891 -2
- Misses 33576 33578 +2
Partials 4305 4305
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Root cause
PR #38177 added nested resource lookup safeguards for single segment and child chunk paths, but the batch segment delete path still deleted by the raw request id list after the scoped lookup.
A request that mixed valid ids with foreign ids could therefore delete records outside the selected document.
Follow-up to #38177 (comment).
Tests