Skip to content

Respect exclusions before reporting DeepSearch path matches - #638

Open
FanWu-ai wants to merge 1 commit into
qlustered:devfrom
FanWu-ai:fix/deepsearch-excluded-path-reporting
Open

FanWu-ai wants to merge 1 commit into
qlustered:devfrom
FanWu-ai:fix/deepsearch-excluded-path-reporting

Conversation

@FanWu-ai

@FanWu-ai FanWu-ai commented Oct 3, 2026

Copy link
Copy Markdown

DeepSearch reports matching dictionary keys and attribute names before the recursive search checks exclusions. For example, DeepSearch({'needle': 'x'}, 'needle', exclude_paths=["root['needle']"]) currently reports the excluded path in matched_paths.

Check the child object and its path with the existing exclusion predicate before reporting a path match. Add ten regression cases covering exact, wildcard and regex path exclusions, attribute names, excluded child types, retained siblings, and both verbosity levels.

This complements #629: that change fixes the recursive current-object type check, while this fixes the earlier path-reporting step. All eight initial path-exclusion regressions still fail with #629's production change alone.

Validation on Linux, CPython 3.12.14:

  • Full suite including slow tests: pytest --cov=deepdiff --runslow --benchmark-disable -q: 1,319 passed, 8 skipped; 95% aggregate coverage.
  • Search suite: 72 passed; 100% coverage of deepdiff/search.py.
  • pyright deepdiff/search.py: 0 errors, 0 warnings.
  • CI-blocking Flake8 rules E9,F63,F7,F82 and git diff --check: passed.
  • Full Flake8 on the touched files reports seven pre-existing diagnostics, compared against the unchanged baseline; no new diagnostics.

Other Python versions, operating systems, and hosted CI have not been validated locally.

@FanWu-ai
FanWu-ai marked this pull request as ready for review October 3, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant