Skip to content

Validate keypaths during in-place dictionary union - #643

Open
Gabrieljr42 wants to merge 1 commit into
fabiocaccamo:mainfrom
Gabrieljr42:fix/ior-keypath-validation
Open

Gabrieljr42 wants to merge 1 commit into
fabiocaccamo:mainfrom
Gabrieljr42:fix/ior-keypath-validation

Conversation

@Gabrieljr42

Copy link
Copy Markdown
Contributor

Describe your changes

b |= mapping bypasses the keypath checks used by b.update(mapping). With the default separator, b |= {'invalid.key': 1} stores an invalid literal key that cannot be accessed normally through keypaths, while update() rejects the same input.

Route KeypathDict.__ior__ through its validated update() and return the same object. Regression coverage includes pointer-backed and unwrapped dictionaries, empty updates, custom/disabled separators, unchanged data after rejection, and frozen dictionaries.

Validation: the new regression fails before the fix. The 120 focused dictionary/freeze tests and all pre-commit hooks, including Ruff and mypy, pass. A broader run passed 960 tests with 32 URL-dependent tests skipped; the complete suite could not finish against unreachable remote URL fixtures. No test configuration was changed.

Related issue

Newly reproduced bug; no existing issue found for this validation bypass.

Checklist before requesting a review

  • I have performed a self-review of my code.
  • I have added tests for the proposed changes.
  • I have run the full test suite without errors. Remote URL fixtures were unavailable as described above; focused tests and pre-commit passed.

Implementation used a Luna agent, followed by a separate diff review and rerun of the focused tests and pre-commit hooks.

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.70%. Comparing base (e910141) to head (c011306).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #643   +/-   ##
=======================================
  Coverage   98.70%   98.70%           
=======================================
  Files          65       65           
  Lines        2476     2479    +3     
=======================================
+ Hits         2444     2447    +3     
  Misses         32       32           
Flag Coverage Δ
unittests 98.70% <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.

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