fix(testing): correct delete_dir prefix matching in stateful tests#4002
Open
NIK-TIGER-BILL wants to merge 1 commit into
Open
fix(testing): correct delete_dir prefix matching in stateful tests#4002NIK-TIGER-BILL wants to merge 1 commit into
NIK-TIGER-BILL wants to merge 1 commit into
Conversation
Fix flaky stateful test bookkeeping when delete_dir matches string prefixes instead of true directory descendants. A path such as 6/faNT... could be incorrectly removed when deleting 6/f. Closes zarr-developers#3977 Signed-off-by: NIK-TIGER-BILL <nik.tiger.bill@github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4002 +/- ##
=======================================
Coverage 93.49% 93.49%
=======================================
Files 88 88
Lines 11873 11873
=======================================
Hits 11101 11101
Misses 772 772
🚀 New features to boost your workflow:
|
dcherian
approved these changes
May 22, 2026
dcherian
reviewed
May 22, 2026
| run_state_machine_as_test(mk_test_instance_sync) # type: ignore[no-untyped-call] | ||
|
|
||
|
|
||
| def test_delete_dir_prefix_matching() -> None: |
Contributor
There was a problem hiding this comment.
let's delete this; it's not neeed
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.
This PR fixes a flaky bookkeeping bug in the Hypothesis stateful tests where
delete_dirused raw string prefix matching (startswith) instead of true directory-descendant matching. A path such as6/faNT7p7jvJsO3_C._HYicould be incorrectly removed fromall_arrays/all_groupswhen deleting6/f, because"6/faNT…".startswith("6/f")isTrue. The fix adds an explicit separator check:node == path or node.startswith(path + "/").Closes #3977
TODO:
docs/user-guide/*.md(N/A – test-only change)changes/