Skip to content

fix(data-classes): handle keyword arguments in CaseInsensitiveDict.update - #8518

Merged
leandrodamascena merged 1 commit into
aws-powertools:developfrom
chiruu12:fix/case-insensitive-dict-kwargs
Oct 6, 2026
Merged

leandrodamascena merged 1 commit into
aws-powertools:developfrom
chiruu12:fix/case-insensitive-dict-kwargs

Conversation

@chiruu12

@chiruu12 chiruu12 commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Issue number: closes #8517

Summary

Changes

CaseInsensitiveDict.update looped over kwargs itself, so it got key strings rather than (key, value) pairs. It now iterates kwargs.items().

Added tests/unit/data_classes/required_dependencies/test_common.py covering keyword arguments in both the constructor and update(). Both tests fail on develop and pass with the change.

User experience

Before, CaseInsensitiveDict(ab=1) produced {'a': 'b'} and any keyword name that is not exactly two characters long raised ValueError, including event.headers.update(User_Agent="test").

After, keyword arguments are stored as lowercased keys with their values, same as a mapping passed positionally.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Copilot AI balanced review requested due to automatic review settings October 4, 2026 22:08
@chiruu12
chiruu12 requested a review from a team as a code owner October 4, 2026 22:08
@chiruu12
chiruu12 requested a review from svozza October 4, 2026 22:08
@boring-cyborg boring-cyborg Bot added the tests label Oct 4, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Oct 4, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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.

@sonarqubecloud

sonarqubecloud Bot commented Oct 4, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.92%. Comparing base (556478f) to head (4a25186).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #8518   +/-   ##
========================================
  Coverage    96.92%   96.92%           
========================================
  Files          317      317           
  Lines        15911    15911           
  Branches      1398     1398           
========================================
  Hits         15422    15422           
  Misses         353      353           
  Partials       136      136           

☔ 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.

@leandrodamascena leandrodamascena 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.

Thanks for fixing this, @chiruu12! Glad you caught the two-character case too, since that was silently storing the wrong value. I tried a few extra cases with your fix and they all passed. Looks good to me!

@mergify

mergify Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again.

@leandrodamascena
leandrodamascena merged commit 3e4d498 into aws-powertools:develop Oct 6, 2026
20 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: CaseInsensitiveDict mishandles keyword arguments in update() and the constructor

3 participants