Skip to content

Recurse through nested lists and tuples during deep rename and remove - #616

Merged
fabiocaccamo merged 2 commits into
fabiocaccamo:mainfrom
xiehuanyi:fix/deep-rename-nested-sequences
Oct 9, 2026
Merged

fabiocaccamo merged 2 commits into
fabiocaccamo:mainfrom
xiehuanyi:fix/deep-rename-nested-sequences

Conversation

@xiehuanyi

@xiehuanyi xiehuanyi commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

rename(..., deep=True) and remove(..., deep=True) previously skipped dictionaries below another list or tuple, such as { "users": [[{ "password": "secret" }]] }. Give both operations a recursive visitor for sequence elements while retaining top-level keypath handling and literal nested-key matching.

Validation: both new nested-sequence removal cases fail before the removal change. The core/dictionary suites pass with 798 tests, 61 subtests and one existing skip. Every configured pre-commit hook passes, including Mypy. The branch is rebased onto current main. AI-assisted implementation and verification.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 19:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.51%. Comparing base (7c7be21) to head (0d0d91b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #616      +/-   ##
==========================================
- Coverage   98.52%   98.51%   -0.01%     
==========================================
  Files          64       64              
  Lines        2437     2429       -8     
==========================================
- Hits         2401     2393       -8     
  Misses         36       36              
Flag Coverage Δ
unittests 98.51% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fabiocaccamo fabiocaccamo left a comment •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hi @xiehuanyi,
thank you for this PR, the fix is clean and I like that it also removes the duplicated code.

I have only one request before merging: remove(..., deep=True) in benedict/core/remove.py has exactly the same limitation (it only looks one list/tuple level deep). If we fix only rename, the two methods will behave differently.

Could you apply the same fix to remove too, with a couple of unit tests?

Thank you!

@xiehuanyi
xiehuanyi force-pushed the fix/deep-rename-nested-sequences branch from 834588a to 0d0d91b Compare October 8, 2026 16:46
@xiehuanyi xiehuanyi changed the title Recurse through nested lists and tuples during deep rename Recurse through nested lists and tuples during deep rename and remove Oct 8, 2026
@fabiocaccamo
fabiocaccamo merged commit 7a363d4 into fabiocaccamo:main Oct 9, 2026
18 checks passed
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.

3 participants